/* ============================================================
   admin.css  —  AdminPanel shared stylesheet
   Covers: layout, sidebar, topbar, cards, tables, forms,
           buttons, badges, stat-cards, permissions, merchants,
           subadmins, alerts, login page.
   ============================================================ */

/* ── Google Font loaded in layout head ──────────────────────
   Plus Jakarta Sans: 300,400,500,600,700
   ─────────────────────────────────────────────────────────── */

/* ── CSS Variables ──────────────────────────────────────── */
:root {
    --sidebar-width   : 260px;
    --sidebar-bg      : #0f172a;
    --sidebar-hover   : #1e293b;
    --topbar-height   : 64px;
    --accent          : #3b82f6;
    --accent-dark     : #2563eb;
    --accent-soft     : #eff6ff;
    --page-bg         : #f1f5f9;
    --surface         : #ffffff;
    --border          : #e2e8f0;
    --border-light    : #f1f5f9;
    --text-primary    : #1e293b;
    --text-secondary  : #475569;
    --text-muted      : #64748b;
    --text-faint      : #94a3b8;
    --radius-sm       : 6px;
    --radius-md       : 8px;
    --radius-lg       : 12px;
    --radius-xl       : 14px;
    --shadow-sm       : 0 1px 3px rgba(0,0,0,.04);
    --shadow-md       : 0 4px 16px rgba(0,0,0,.08);
    --shadow-lg       : 0 8px 24px rgba(0,0,0,.10);
   
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background : var(--page-bg);
    color      : var(--text-primary);
    margin     : 0;
}

/* ── Sidebar ────────────────────────────────────────────── */
#sidebar {
    position       : fixed;
    top: 0; left: 0;
    width          : var(--sidebar-width);
    height         : 100vh;
    background     : var(--sidebar-bg);
    display        : flex;
    flex-direction : column;
    transition     : transform .3s ease;
    z-index        : 1040;
    overflow-y     : auto;
}

.sidebar-brand {
    padding      : 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand .brand-name {
    color      : #fff;
    font-weight: 700;
    font-size  : 1.15rem;
    letter-spacing: -.3px;
}
.sidebar-brand .brand-badge {
    font-size    : .65rem;
    background   : var(--accent);
    color        : #fff;
    padding      : 2px 7px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left  : 6px;
}

.sidebar-section-title {
    color         : var(--text-muted);
    font-size     : .65rem;
    font-weight   : 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding       : .75rem 1.25rem .25rem;
    display       : block;
}

.sidebar-nav .nav-link {
    display     : flex;
    align-items : center;
    gap         : .65rem;
    color       : #94a3b8;
    padding     : .55rem 1.25rem;
    font-size   : .875rem;
    font-weight : 500;
    transition  : all .2s;
    border-left : 3px solid transparent;
    margin      : 1px 0;
    text-decoration: none;
}
.sidebar-nav .nav-link i {
    font-size  : 1rem;
    width      : 20px;
    text-align : center;
    flex-shrink: 0;
}
.sidebar-nav .nav-link:hover {
    background      : var(--sidebar-hover);
    color           : #e2e8f0;
    border-left-color: rgba(59,130,246,.4);
}
.sidebar-nav .nav-link.active {
    background      : rgba(59,130,246,.15);
    color           : #93c5fd;
    border-left-color: var(--accent);
}

.sidebar-user {
    margin-top : auto;
    padding    : 1rem 1.25rem;
    border-top : 1px solid rgba(255,255,255,.07);
}
.sidebar-user .user-avatar {
    width        : 36px;
    height       : 36px;
    border-radius: 50%;
    background   : var(--accent);
    display      : flex;
    align-items  : center;
    justify-content: center;
    color        : #fff;
    font-weight  : 700;
    font-size    : .8rem;
    flex-shrink  : 0;
}
.sidebar-user .user-name {
    color      : #e2e8f0;
    font-size  : .83rem;
    font-weight: 600;
}
.sidebar-user .user-role {
    color    : var(--text-muted);
    font-size: .72rem;
}

.sidebar-overlay {
    display   : none;
    position  : fixed;
    inset     : 0;
    background: rgba(0,0,0,.4);
    z-index   : 1035;
}
.sidebar-overlay.show { display: block; }

/* ── Topbar ─────────────────────────────────────────────── */
#topbar {
    position  : fixed;
    top: 0;
    left      : var(--sidebar-width);
    right     : 0;
    height    : var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display   : flex;
    align-items: center;
    padding   : 0 1.5rem;
    gap       : 1rem;
    z-index   : 1030;
    transition: left .3s;
}
.topbar-toggle {
    background: none;
    border    : none;
    color     : var(--text-muted);
    font-size : 1.25rem;
    cursor    : pointer;
    padding   : .25rem;
    display   : none;
}
.topbar-title {
    font-weight: 600;
    font-size  : 1rem;
    color      : var(--text-primary);
}
.topbar-right {
    margin-left: auto;
    display    : flex;
    align-items: center;
    gap        : .75rem;
}
.topbar-btn {
    background  : #f8fafc;
    border      : 1px solid var(--border);
    color       : var(--text-muted);
    border-radius: var(--radius-md);
    padding     : .4rem .7rem;
    font-size   : .875rem;
    cursor      : pointer;
    transition  : all .2s;
}
.topbar-btn:hover { background: var(--page-bg); color: var(--text-primary); }

/* ── Main Content ───────────────────────────────────────── */
#main {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height : 100vh;
    transition : margin-left .3s;
}
.page-content { padding: 2rem 1.75rem; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    border       : 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow   : var(--shadow-sm);
    background   : var(--surface);
}
.card-header {
    background   : var(--surface);
    border-bottom: 1px solid var(--border);
    padding      : 1rem 1.25rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    font-weight  : 600;
    font-size    : .9rem;
    color        : var(--text-primary);
}
.card-footer {
    background   : #f8fafc;
    border-top   : 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-card {
    border-radius: var(--radius-xl);
    padding      : 1.4rem 1.5rem;
    border       : 1px solid var(--border);
    background   : var(--surface);
    display      : flex;
    align-items  : center;
    gap          : 1.1rem;
    transition   : box-shadow .2s;
    text-decoration: none;
    color        : inherit;
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    color     : inherit;
}
.stat-icon {
    width          : 52px;
    height         : 52px;
    border-radius  : var(--radius-lg);
    display        : flex;
    align-items    : center;
    justify-content: center;
    font-size      : 1.4rem;
    flex-shrink    : 0;
}
.stat-label {
    color        : var(--text-muted);
    font-size    : .78rem;
    font-weight  : 500;
    margin-bottom: 2px;
}
.stat-value {
    font-size  : 1.6rem;
    font-weight: 700;
    color      : var(--text-primary);
    line-height: 1;
}

/* ── Tables ─────────────────────────────────────────────── */
.table th {
    font-size     : .75rem;
    font-weight   : 600;
    color         : var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom : 2px solid var(--border);
    background    : #f8fafc;
}
.table td {
    font-size     : .875rem;
    vertical-align: middle;
    border-color  : var(--border-light);
}

/* ── Forms ──────────────────────────────────────────────── */
.form-control,
.form-select {
    border-color : var(--border);
    border-radius: var(--radius-md);
    font-size    : .875rem;
    padding      : .5rem .85rem;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow  : 0 0 0 3px rgba(59,130,246,.12);
}
.form-label {
    font-size    : .83rem;
    font-weight  : 600;
    color        : var(--text-secondary);
    margin-bottom: .35rem;
}
.input-group-text {
    background   : #f8fafc;
    border-color : var(--border);
    color        : var(--text-faint);
    font-size    : .875rem;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
    background   : var(--accent);
    border-color : var(--accent);
    font-weight  : 600;
    font-size    : .875rem;
    border-radius: var(--radius-md);
}
.btn-primary:hover,
.btn-primary:focus {
    background  : var(--accent-dark);
    border-color: var(--accent-dark);
}
.btn-outline-secondary { border-radius: var(--radius-md); font-size: .875rem; }
.btn-warning           { border-radius: var(--radius-md); font-size: .875rem; }
.btn-outline-danger    { border-radius: var(--radius-md); font-size: .875rem; }

/* ── Badges & Status Pills ──────────────────────────────── */
.badge-role {
    padding      : 4px 10px;
    border-radius: 20px;
    font-size    : .7rem;
    font-weight  : 600;
    letter-spacing: .3px;
}
.badge-admin    { background: #fef3c7; color: #92400e; }
.badge-subadmin { background: #e0f2fe; color: #0369a1; }

/* Merchant / general status pills */
.s-pill {
    font-size     : .63rem;
    font-weight   : 700;
    padding       : 3px 9px;
    border-radius : 20px;
    letter-spacing: .4px;
    text-transform: uppercase;
    white-space   : nowrap;
    flex-shrink   : 0;
    display       : inline-block;
}
.s-active    { background: #f0fdf4; color: #16a34a; }
.s-pending   { background: #fefce8; color: #a16207; }
.s-suspended { background: #fef2f2; color: #dc2626; }
.s-rejected  { background: #f1f5f9; color: #64748b; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert-success-custom {
    border-radius: 10px;
    border       : 1px solid #bbf7d0;
    background   : #f0fdf4;
    font-size    : .875rem;
}
.alert-danger-custom {
    border-radius: 10px;
    font-size    : .875rem;
}

/* ── Permissions (subadmin form) ────────────────────────── */
.perm-module-title {
    font-size     : .72rem;
    font-weight   : 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color         : var(--text-muted);
    padding       : .5rem 0 .3rem;
    display       : block;
}
.perm-checkbox .form-check-input:checked {
    background-color: var(--accent);
    border-color    : var(--accent);
}
.perm-checkbox label { font-size: .83rem; color: #374151; }

/* ── Info rows (detail pages) ───────────────────────────── */
.info-row {
    display        : flex;
    justify-content: space-between;
    align-items    : center;
    padding        : .38rem 0;
    border-bottom  : 1px solid var(--border-light);
    font-size      : .84rem;
}
.info-row span  { color: var(--text-muted); }
.info-row strong{ color: var(--text-primary); }
.info-row:last-child { border-bottom: none; }

/* ── Merchant card grid ─────────────────────────────────── */
.merchant-card {
    border-radius: var(--radius-xl);
    transition   : box-shadow .2s, transform .2s;
}
.merchant-card:hover {
    box-shadow: var(--shadow-lg);
    transform : translateY(-2px);
}
.meta-row {
    display    : flex;
    align-items: center;
    gap        : .5rem;
    font-size  : .8rem;
    color      : var(--text-muted);
}
.meta-row i {
    color      : #cbd5e1;
    font-size  : .8rem;
    width      : 14px;
    flex-shrink: 0;
}

/* ── Login Page ─────────────────────────────────────────── */
.login-page-body {
    font-family    : 'Plus Jakarta Sans', sans-serif;
    background     : #0f172a;
    min-height     : 100vh;
    display        : flex;
    align-items    : center;
    justify-content: center;
    padding        : 1rem;
    position       : relative;
    overflow       : hidden;
}
.login-page-body::before,
.login-page-body::after {
    content      : '';
    position     : absolute;
    border-radius: 50%;
    filter       : blur(80px);
    opacity      : .18;
    pointer-events: none;
}
.login-page-body::before {
    width : 400px; height: 400px;
    background: #3b82f6;
    top: -100px; left: -100px;
}
.login-page-body::after {
    width : 350px; height: 350px;
    background: #6366f1;
    bottom: -80px; right: -80px;
}
.login-card {
    background   : #fff;
    border-radius: 20px;
    padding      : 2.5rem 2.25rem;
    width        : 100%;
    max-width    : 420px;
    position     : relative;
    z-index      : 1;
    box-shadow   : 0 25px 60px rgba(0,0,0,.4);
}
.login-logo-circle {
    width          : 56px;
    height         : 56px;
    background     : var(--accent);
    border-radius  : 14px;
    display        : flex;
    align-items    : center;
    justify-content: center;
    margin-bottom  : 1.25rem;
}
.login-title {
    font-size    : 1.4rem;
    font-weight  : 700;
    color        : #0f172a;
    margin-bottom: .25rem;
}
.login-sub {
    color        : var(--text-muted);
    font-size    : .875rem;
    margin-bottom: 1.75rem;
}
.login-card .input-group-text {
    background  : #f8fafc;
    border      : 1.5px solid var(--border);
    border-right: none;
    border-radius: 9px 0 0 9px;
}
.login-card .form-control {
    border    : 1.5px solid var(--border);
    border-left: none;
    border-radius: 0 9px 9px 0;
    transition: border .2s, box-shadow .2s;
}
.login-card .form-control:focus {
    border-color: var(--accent);
    box-shadow  : 0 0 0 3px rgba(59,130,246,.15);
}
.btn-login {
    background   : var(--accent);
    border       : none;
    border-radius: 9px;
    font-weight  : 600;
    font-size    : .9rem;
    padding      : .65rem;
    width        : 100%;
    color        : #fff;
    transition   : background .2s, transform .1s;
    margin-top   : .5rem;
}
.btn-login:hover  { background: var(--accent-dark); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.login-demo-info {
    background   : #f0f9ff;
    border       : 1px dashed #bae6fd;
    border-radius: 9px;
    padding      : .65rem 1rem;
    font-size    : .78rem;
    color        : #0369a1;
    margin-top   : 1.25rem;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 991px) {
    #sidebar              { transform: translateX(-100%); }
    #sidebar.show         { transform: translateX(0); }
    #topbar               { left: 0; }
    #main                 { margin-left: 0; }
    .topbar-toggle        { display: block; }
}

/* ── Utility / Helper Classes ───────────────────────────── */

/* Text sizes */
.text-sm  { font-size: .875rem; }
.text-xs  { font-size: .75rem; }
.text-faint { color: var(--text-faint); }
.fw-500   { font-weight: 500; }
.fw-600   { font-weight: 600; }

/* Colour helpers */
.text-accent  { color: var(--accent); }
.text-success { color: #22c55e !important; }
.text-warning { color: #ca8a04 !important; }
.text-danger  { color: #ef4444 !important; }

/* Soft background + colour pairs */
.bg-accent-soft  { background: #eff6ff; }
.bg-success-soft { background: #f0fdf4; }
.bg-warning-soft { background: #fefce8; }
.bg-danger-soft  { background: #fef2f2; }
.bg-purple-soft  { background: #fdf4ff; }
.text-purple     { color: #a855f7; }

/* Stat card: highlighted border when active filter */
.stat-card-active { border-color: var(--accent); }

/* Icon buttons */
.btn-icon {
    display        : inline-flex;
    align-items    : center;
    justify-content: center;
    width          : 30px;
    height         : 30px;
    border         : none;
    border-radius  : var(--radius-sm);
    font-size      : .78rem;
    cursor         : pointer;
    transition     : opacity .15s;
}
.btn-icon:hover { opacity: .8; }
.btn-icon-blue  { background: #eff6ff; color: var(--accent); }
.btn-icon-green { background: #f0fdf4; color: #22c55e; }
.btn-icon-red   { background: #fef2f2; color: #ef4444; }

/* Soft-colour full buttons */
.btn-soft-blue {
    background   : #eff6ff;
    color        : var(--accent);
    border       : none;
    border-radius: var(--radius-sm);
    font-size    : .8rem;
    font-weight  : 600;
}
.btn-soft-blue:hover { background: #dbeafe; color: var(--accent-dark); }

/* XS rounded modifier for small outline buttons */
.btn-xs-rounded { font-size: .78rem; border-radius: var(--radius-sm); }

/* Permission badges */
.perm-badge {
    display       : inline-block;
    background    : #dbeafe;
    color         : #1d4ed8;
    font-size     : .68rem;
    font-weight   : 600;
    padding       : 2px 8px;
    border-radius : 20px;
    margin-right  : 3px;
    margin-bottom : 3px;
}
.perm-badge-muted { background: #f1f5f9; color: var(--text-muted); }

/* Status toggle button (subadmin table) */
.status-toggle-btn {
    font-size    : .72rem;
    font-weight  : 600;
    padding      : 3px 10px;
    border-radius: var(--radius-sm);
    cursor       : pointer;
}
.status-toggle-active   { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.status-toggle-inactive { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Table avatar */
.table-avatar {
    width          : 30px;
    height         : 30px;
    border-radius  : 50%;
    display        : flex;
    align-items    : center;
    justify-content: center;
    color          : #fff;
    font-size      : .72rem;
    font-weight    : 700;
    flex-shrink    : 0;
}
.table-avatar-blue  { background: var(--accent); }
.table-avatar-green { background: #22c55e; }

/* Topbar avatar + name (used inline in topbar) */
.topbar-avatar {
    width          : 34px;
    height         : 34px;
    border-radius  : 50%;
    background     : var(--accent);
    display        : flex;
    align-items    : center;
    justify-content: center;
    color          : #fff;
    font-weight    : 700;
    font-size      : .75rem;
}
.topbar-user-name { font-size: .83rem; font-weight: 600; color: #374151; }
.sidebar-logout-btn { color: var(--text-muted); background: none; border: none; }
.sidebar-brand-icon {
    width          : 32px;
    height         : 32px;
    background     : var(--accent);
    border-radius  : 8px;
    display        : flex;
    align-items    : center;
    justify-content: center;
    font-size      : .9rem;
}

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-icon  { font-size: 3rem; color: #cbd5e1; display: block; margin-bottom: .75rem; }

