/* =====================================================================
   SHOHOJ COMMERCE — Admin Panel CSS v2.0
   Brand: Azure Blue (#0078D4 primary, #005A9E dark, #50C0F0 accent)
   ===================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #0078D4;
    --primary-dark:  #005A9E;
    --primary-light: #EFF6FF;
    --accent:        #50C0F0;
    --midnight:      #001F3F;
    --success:       #10b981;
    --danger:        #ef4444;
    --warning:       #f59e0b;
    --info:          #3b82f6;
    --text:          #1a1f36;
    --muted:         #64748b;
    --border:        #e2e8f0;
    --light-bg:      #f8fafc;
    --font:          'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body { font-family: var(--font); background: #f0f4f8; color: var(--text); }

.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
    width: 248px; background: var(--midnight); color: #fff;
    flex-shrink: 0; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
    padding: 20px 18px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 15px; font-weight: 700; color: #fff;
}
.sidebar-logo {
    width: 36px; height: 36px; background: var(--primary);
    border-radius: 8px; display: flex; align-items: center;
    justify-content: center; font-size: 14px; font-weight: 800;
    color: #fff; flex-shrink: 0;
}
.sidebar-brand span { display: block; font-size: 11px; color: rgba(255,255,255,.45); font-weight: 400; margin-top: 2px; }
.sidebar nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.nav-section-label {
    font-size: 10px; font-weight: 700; color: rgba(255,255,255,.3);
    letter-spacing: 1.5px; text-transform: uppercase;
    padding: 14px 18px 5px; margin-top: 4px;
}
/* Collapsible nav sections (JS-enhanced) */
.nav-section-label.nav-toggle {
    cursor: pointer; display: flex; align-items: center; justify-content: space-between;
    user-select: none; transition: color .15s;
}
.nav-section-label.nav-toggle:hover { color: rgba(255,255,255,.65); }
.nav-section-label.nav-toggle .nav-caret {
    font-size: 9px; transition: transform .18s; opacity: .6; margin-left: 6px;
}
.nav-section-label.nav-toggle.collapsed .nav-caret { transform: rotate(-90deg); }
.sidebar nav a.nav-hidden { display: none !important; }
.nav-section-label.nav-hidden { display: none !important; }
.sidebar nav a {
    display: flex; align-items: center; gap: 9px; position: relative;
    padding: 10px 18px; color: rgba(255,255,255,.6); text-decoration: none;
    font-size: 13.5px; transition: all .18s; border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; border-left-color: rgba(80,192,240,.4); }
.sidebar nav a.active { background: rgba(0,120,212,.25); color: #fff; border-left-color: var(--primary); font-weight: 600; }
.sidebar nav a .icon { width: 18px; text-align: center; font-size: 15px; }
.nav-badge {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; padding: 2px 7px;
    border-radius: 99px; min-width: 20px; text-align: center;
}
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-footer a { color: rgba(255,255,255,.5); font-size: 13px; text-decoration: none; transition: color .2s; }
.sidebar-footer a:hover { color: #fff; }

/* ── Main area ───────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.topbar {
    background: #fff; padding: 0 28px; height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.05);
    position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 18px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-icon-btn {
    position: relative; padding: 8px 12px; border-radius: 8px;
    color: var(--muted); text-decoration: none; font-size: 15px;
    transition: all .2s;
}
.topbar-icon-btn:hover { background: var(--light-bg); color: var(--text); }
.topbar-badge {
    position: absolute; top: 2px; right: 2px; background: var(--danger);
    color: #fff; font-size: 9px; font-weight: 700; width: 16px; height: 16px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.admin-badge { background: var(--primary-light); color: var(--primary); padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; }

.content { padding: 28px; overflow-y: auto; flex: 1; }

/* ── Stat cards ──────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card {
    background: #fff; border-radius: 12px; padding: 20px 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
}
.stat-card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.stat-card .value { font-size: 30px; font-weight: 800; color: var(--text); margin-top: 6px; line-height: 1; }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
    background: #fff; border-radius: 12px; padding: 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06); border: 1px solid var(--border); margin-bottom: 22px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
    cursor: pointer; text-decoration: none; border: none; transition: all .18s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--light-bg); color: var(--muted); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Tables ──────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
table th {
    background: var(--light-bg); padding: 11px 14px; text-align: left;
    font-size: 11px; color: var(--muted); text-transform: uppercase;
    letter-spacing: .5px; border-bottom: 2px solid var(--border); font-weight: 700;
}
table td { padding: 13px 14px; border-bottom: 1px solid #f1f5f9; font-size: 13.5px; }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #fafbff; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600;
}
.badge::before { content: '●'; font-size: 8px; }
.badge-active  { background: #d1fae5; color: #065f46; }
.badge-inactive{ background: #fee2e2; color: #991b1b; }
.badge-expired { background: #fef3c7; color: #92400e; }
.badge-failed  { background: #fee2e2; color: #991b1b; }
.badge-pending { background: #dbeafe; color: #1e40af; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 13.5px; color: var(--text); transition: border .2s; background: #fff;
    font-family: var(--font);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,120,212,.1); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

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

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert { padding: 13px 16px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal { background: #fff; border-radius: 14px; padding: 28px; width: 90%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #9ca3af; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ── Courier key item ────────────────────────────────────────────── */
.courier-key-item {
    border: 1px solid var(--border); border-radius: 8px; padding: 14px;
    margin-bottom: 10px; display: flex; align-items: center; gap: 12px;
}
.courier-key-info { flex: 1; }
.courier-key-label { font-weight: 600; font-size: 13.5px; }
.courier-key-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.courier-key-actions { display: flex; gap: 6px; }

/* ── Status dots ─────────────────────────────────────────────────── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.status-dot.active  { background: var(--success); }
.status-dot.failed  { background: var(--danger); }
.status-dot.unknown { background: var(--warning); }

/* ── Progress bar ────────────────────────────────────────────────── */
.progress-bar { background: #e5e7eb; border-radius: 999px; height: 6px; overflow: hidden; }
.progress-bar-inner { height: 100%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 999px; }

/* ── Login page ──────────────────────────────────────────────────── */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: linear-gradient(135deg, var(--midnight) 0%, #003875 100%);
}
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 420px; box-shadow: 0 25px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { width: 56px; height: 56px; background: var(--primary); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; color: #fff; margin: 0 auto 12px; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.login-logo p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 14px; }
.empty-state p { font-size: 15px; }

/* ── Search box ──────────────────────────────────────────────────── */
.search-box { display: flex; gap: 10px; margin-bottom: 14px; }
.search-box .form-control { flex: 1; }

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; margin-top: 20px; justify-content: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 7px 12px; border-radius: 6px; font-size: 13px; text-decoration: none;
    border: 1px solid var(--border); color: var(--text);
}
.pagination a:hover { background: var(--light-bg); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Key display ─────────────────────────────────────────────────── */
.key-display {
    font-family: monospace; background: var(--light-bg); border: 1px solid var(--border);
    padding: 10px 14px; border-radius: 8px; font-size: 13px; color: var(--text);
    word-break: break-all;
}
.copy-btn { cursor: pointer; }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; margin-bottom: 22px; border-bottom: 2px solid var(--border); flex-wrap: wrap; }
.tab-btn {
    padding: 11px 20px; font-size: 13.5px; font-weight: 600; color: var(--muted);
    background: none; border: none; cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all .18s; white-space: nowrap;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Renewal / payment page ──────────────────────────────────────── */
.renewal-page { min-height: 100vh; background: linear-gradient(135deg, #0078D4 0%, #001F3F 100%); padding: 40px 20px; }
.renewal-box { max-width: 620px; margin: 0 auto; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.renewal-header { background: linear-gradient(135deg, var(--midnight), #003875); padding: 30px; color: #fff; text-align: center; }
.renewal-header h1 { font-size: 22px; font-weight: 700; }
.renewal-header p { color: rgba(255,255,255,.6); margin-top: 5px; font-size: 13.5px; }
.renewal-body { padding: 30px; }
.plan-card {
    border: 2px solid var(--border); border-radius: 12px; padding: 20px;
    margin-bottom: 12px; cursor: pointer; transition: all .2s;
}
.plan-card:hover, .plan-card.selected { border-color: var(--primary); background: var(--primary-light); }
.plan-card .plan-name { font-weight: 700; font-size: 15px; }
.plan-card .plan-price { font-size: 24px; font-weight: 800; color: var(--primary); }
.plan-card .plan-duration { font-size: 13px; color: var(--muted); }

/* ── Risk indicator ──────────────────────────────────────────────── */
.risk-badge-low    { background: #d1fae5; color: #065f46; padding: 3px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.risk-badge-medium { background: #fef3c7; color: #92400e; padding: 3px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.risk-badge-high   { background: #fee2e2; color: #991b1b; padding: 3px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; }

/* ── Fraud check result card ─────────────────────────────────────── */
.result-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.result-card-header {
    padding: 16px 20px; display: flex; align-items: center;
    justify-content: space-between; border-bottom: 1px solid var(--border);
}
.result-courier-name { font-weight: 700; font-size: 15px; }
.result-card-body { padding: 16px 20px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 12px; }
.result-metric { text-align: center; }
.result-metric .metric-value { font-size: 22px; font-weight: 800; color: var(--text); }
.result-metric .metric-label { font-size: 11px; color: var(--muted); margin-top: 3px; text-transform: uppercase; letter-spacing: .4px; }

/* ── Toast notifications ─────────────────────────────────────────── */
.toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    padding: 14px 20px; border-radius: 10px; font-size: 14px; font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,.15); max-width: 380px;
    animation: slideInRight .3s ease;
}
.toast-success { background: #065f46; color: #fff; }
.toast-error   { background: #991b1b; color: #fff; }
.toast-info    { background: var(--primary); color: #fff; }
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ── Code display ────────────────────────────────────────────────── */
code {
    background: var(--light-bg); border: 1px solid var(--border);
    padding: 2px 6px; border-radius: 4px; font-size: 12px; font-family: monospace;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
}
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .content { padding: 16px; }
}
