/* KaspiCheck Admin Panel — Premium Apple / Bento UI Light Theme */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Backgrounds */
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f3f4f6;

    /* Branding / Accent - Sleek Dark Slate for a modern Fintech look */
    --accent: #0f172a;
    --accent-hover: #1e293b;
    --accent-glow: rgba(15, 23, 42, 0.15);
    --gradient-primary: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Status Colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);

    /* Borders & Shadows */
    --border-primary: #e5e7eb;
    --border-secondary: #f3f4f6;
    
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 28px;
    
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    --shadow-button: 0 4px 6px rgba(15, 23, 42, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ──────────────────────────────── */

.layout {
    display: flex;
    min-height: 100vh;
    padding: 20px;
    gap: 20px;
}

.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-floating);
    padding: 32px 0;
    position: fixed;
    top: 20px;
    left: 20px;
    bottom: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.main {
    margin-left: 300px;
    /* 280 + 20 */
    flex: 1;
    padding: 12px 20px 32px;
    transition: margin 0.4s ease;
    max-width: calc(100% - 300px);
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
}

.mobile-header h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.menu-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-primary);
    cursor: pointer;
}

/* ── Sidebar ─────────────────────────────── */

.sidebar-logo {
    padding: 0 32px 32px;
    position: relative;
}

.sidebar-logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
    line-height: 1.2;
}

.sidebar-logo span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: block;
    margin-top: 4px;
}

.sidebar-mode {
    padding: 16px;
    margin: 0 24px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
}

.sidebar-mode label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 12px;
    padding-left: 4px;
}

.mode-toggle {
    display: flex;
    background: var(--border-primary);
    border-radius: 12px;
    overflow: hidden;
    padding: 4px;
    gap: 4px;
}

.mode-toggle button {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    transition: var(--transition);
}

.mode-toggle button.active {
    background: var(--bg-secondary);
    color: var(--accent);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.sidebar-nav {
    padding: 8px 0;
    flex: 1;
    overflow-y: auto;
}

/* Scrollbar hiding for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 0;
}

.nav-section {
    padding: 12px 32px 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 4px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-primary);
}

.nav-item.active {
    color: var(--accent);
    background: rgba(15, 23, 42, 0.04);
    font-weight: 600;
}

.nav-item .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item:hover .icon {
    transform: scale(1.15) rotate(-5deg);
}

.nav-item.active .icon {
    transform: scale(1.1);
    color: var(--accent);
}

/* ── Page Header ─────────────────────────── */

.page-header {
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 34px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
    line-height: 1.2;
}

.page-header p {
    color: var(--text-secondary);
    margin-top: 6px;
    font-size: 16px;
    font-weight: 400;
}

/* ── Stat Cards ──────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-primary);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-card .label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: auto;
    letter-spacing: -1px;
    line-height: 1;
}

.stat-card .sub {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 12px;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.05;
    background: var(--text-primary);
    pointer-events: none;
}

.stat-card.success::after {
    background: var(--success);
    opacity: 0.1;
}

.stat-card.danger::after {
    background: var(--danger);
    opacity: 0.1;
}

.stat-card.warning::after {
    background: var(--warning);
    opacity: 0.1;
}

.stat-card.accent::after {
    background: var(--accent);
    opacity: 0.1;
}

.stat-card.success .value {
    color: var(--text-primary);
}

.stat-card.danger .value {
    color: var(--text-primary);
}

.stat-card.warning .value {
    color: var(--text-primary);
}

.stat-card.accent .value {
    color: var(--text-primary);
}

/* ── Tables ──────────────────────────────── */

.data-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid var(--border-primary);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-secondary);
}

.table-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.table-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

thead th {
    text-align: left;
    padding: 16px 32px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-primary);
}

tbody td {
    padding: 20px 32px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-secondary);
    vertical-align: middle;
}

tbody tr {
    transition: background 0.2s;
}

tbody tr:hover {
    background: var(--bg-primary);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges ──────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.2px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.badge-accent {
    background: var(--accent-glow);
    color: var(--accent);
}

.badge-ghost {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

/* ── Buttons ─────────────────────────────── */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-button);
}

.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(67, 24, 255, 0.3);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #e9edf7;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 10px;
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 5px 14px rgba(5, 205, 153, 0.2);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.04);
}

/* ── Forms / Modals ──────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 20, 55, 0.15);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    min-width: 440px;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-floating);
    position: relative;
    border: 1px solid var(--border-primary);
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

.modal.modal-wide {
    max-width: 780px;
    min-width: 600px;
}

@keyframes modalPop {
    0% {
        transform: scale(0.95) translateY(20px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal h3 {
    margin-bottom: 32px;
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.modal .close {
    position: absolute;
    top: 24px;
    right: 24px;
    cursor: pointer;
    color: var(--text-muted);
    background: var(--bg-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    transition: var(--transition);
}

.modal .close:hover {
    background: #e9edf7;
    color: var(--danger);
    transform: rotate(90deg);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    font-weight: 500;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    background: var(--bg-card);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── Alert ───────────────────────────────── */

.alert {
    padding: 18px 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 14px;
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

/* ── Login Page ──────────────────────────── */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 56px 48px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-soft);
    text-align: center;
}

.login-card h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 16px;
    font-weight: 500;
}

.login-card .form-group {
    text-align: left;
}

.login-card .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 16px;
    font-size: 16px;
    margin-top: 10px;
}

/* ── Toggle Switch ───────────────────────── */

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-secondary);
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle {
    position: relative;
    width: 50px;
    height: 30px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle .slider {
    position: absolute;
    inset: 0;
    background: #e5e7eb;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
}

.toggle .slider:before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle input:checked+.slider {
    background: var(--success);
}

.toggle input:checked+.slider:before {
    transform: translateX(20px);
}

/* ── Utility & Links ───────────────────────── */

a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

.text-success {
    color: var(--success);
    font-weight: 700;
}

.text-danger {
    color: var(--danger);
    font-weight: 700;
}

.text-warning {
    color: var(--warning);
    font-weight: 700;
}

.text-muted {
    color: var(--text-muted);
}

.text-right {
    text-align: right;
}

.mt-16 {
    margin-top: 24px;
}

.mb-8 {
    margin-bottom: 12px;
}

.hidden {
    display: none !important;
}

/* ── Custom Data Display ─────────────────── */
/* Additional robust styling for data output in modals */
.modal p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
}

.modal p strong {
    color: var(--text-primary);
    font-weight: 700;
}

.modal hr {
    border: none;
    border-top: 1px solid var(--border-primary);
    margin: 24px 0;
}

/* ── Mobile Adaptation ───────────────────── */

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-120%);
        box-shadow: 20px 0 50px rgba(11, 20, 55, 0.15);
        border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 0 0 32px 0;
        max-width: 100%;
    }

    .mobile-header {
        display: flex;
        border-radius: 0;
        position: sticky;
        top: 0;
        z-index: 90;
        margin-bottom: 20px;
    }

    .page-header,
    .stats-grid,
    .data-table-wrapper {
        padding: 0 20px;
    }

    .data-table-wrapper {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .table-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .modal {
        min-width: 90vw;
        padding: 24px;
    }
}