/* ============================================================
   MedCircuit Admin — Future-Centric Design System
   ============================================================ */

:root {
    /* Brand Palette */
    --primary:        #3b82f6;
    --primary-dark:   #1d4ed8;
    --primary-glow:   rgba(59, 130, 246, 0.35);
    --accent:         #06b6d4;
    --accent-glow:    rgba(6, 182, 212, 0.25);
    --purple:         #8b5cf6;
    --purple-glow:    rgba(139, 92, 246, 0.25);

    /* Sidebar */
    --sidebar-bg:     #080f1e;
    --sidebar-width:  268px;
    --sidebar-border: rgba(59, 130, 246, 0.12);
    --nav-hover:      rgba(59, 130, 246, 0.1);
    --nav-active:     rgba(59, 130, 246, 0.18);

    /* Surfaces */
    --bg-main:        #f0f4f8;
    --surface:        #ffffff;
    --surface-2:      #f8fafc;
    --glass:          rgba(255,255,255,0.72);
    --glass-border:   rgba(255,255,255,0.55);

    /* Text */
    --text-main:      #0f172a;
    --text-muted:     #64748b;
    --text-dim:       #94a3b8;

    /* Semantic */
    --success:        #10b981;
    --success-bg:     #ecfdf5;
    --warning:        #f59e0b;
    --warning-bg:     #fffbeb;
    --danger:         #ef4444;
    --danger-bg:      #fef2f2;
    --info:           #06b6d4;
    --info-bg:        #ecfeff;

    /* UI Chrome */
    --border:         #e2e8f0;
    --shadow-xs:      0 1px 2px rgba(15,23,42,.04);
    --shadow-sm:      0 2px 8px rgba(15,23,42,.07);
    --shadow:         0 4px 20px rgba(15,23,42,.10);
    --shadow-lg:      0 12px 40px rgba(15,23,42,.14);
    --shadow-blue:    0 8px 32px rgba(59,130,246,.18);
    --radius-sm:      8px;
    --radius:         14px;
    --radius-lg:      20px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout Shell ──────────────────────────────────────────── */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.admin-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--sidebar-border);
    scrollbar-width: none;
}

.admin-nav::-webkit-scrollbar { display: none; }

/* subtle top-edge glow */
.admin-nav::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--purple));
    opacity: 0.8;
}

/* ── Brand ─────────────────────────────────────────────────── */
.nav-brand {
    padding: 2rem 1.75rem 1.5rem;
    font-size: 1.35rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.3px;
    color: #f1f5f9;
    flex-shrink: 0;
}

.nav-brand i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

/* ── Nav Section Labels ────────────────────────────────────── */
.nav-section-label {
    padding: 1.25rem 1.75rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(148,163,184,.45);
}

/* ── Nav Links ─────────────────────────────────────────────── */
.nav-links {
    list-style: none;
    padding: 0 0.875rem;
    flex-grow: 1;
}

.nav-links li { margin-bottom: 2px; }
.nav-links li.nav-section-label { margin-bottom: 0; }

.nav-links a {
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(.4,0,.2,1);
    font-weight: 500;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.nav-links a i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.95rem;
    opacity: 0.8;
}

.nav-links a:hover {
    background: var(--nav-hover);
    color: #e2e8f0;
}

.nav-links a:hover i { opacity: 1; }

.nav-links li.active a {
    background: var(--nav-active);
    color: #ffffff;
    font-weight: 600;
}

.nav-links li.active a i {
    color: var(--primary);
    opacity: 1;
    filter: drop-shadow(0 0 6px var(--primary-glow));
}

/* active left-border accent */
.nav-links li.active a::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    box-shadow: 0 0 8px var(--primary-glow);
}

/* ── Nav Footer ────────────────────────────────────────────── */
.nav-footer {
    padding: 1.25rem 1.25rem 1.5rem;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
    background: rgba(255,255,255,.02);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-info img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 2px solid rgba(59,130,246,.35);
    flex-shrink: 0;
}

.user-name  { font-weight: 600; color: #e2e8f0; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 0.7rem; color: #475569; margin-top: 1px; }

#btn-logout {
    background: none;
    border: none;
    cursor: pointer;
    color: #475569;
    font-size: 1rem;
    padding: 0.45rem;
    border-radius: 8px;
    transition: color .2s, background .2s;
    flex-shrink: 0;
    line-height: 1;
}

#btn-logout:hover { color: var(--danger); background: rgba(239,68,68,.12); }

/* ── Main Area ─────────────────────────────────────────────── */
.admin-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ── Top Header ─────────────────────────────────────────────── */
.admin-header {
    height: 72px;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226,232,240,.7);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1.5rem;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    padding: 0.55rem 1.1rem;
    border-radius: 10px;
    width: 360px;
    gap: 10px;
    transition: border-color .2s, box-shadow .2s;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
}

.search-bar i { color: var(--text-muted); font-size: 0.85rem; }

.search-bar input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.875rem;
    color: var(--text-main);
    font-family: inherit;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

.lang-picker {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .2s;
}

.lang-picker:hover { border-color: var(--primary); }

.action-icon {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .2s;
    background: var(--surface-2);
    border: 1.5px solid var(--border);
}

.action-icon:hover { color: var(--primary); border-color: var(--primary); background: var(--glass); }

.dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 7px; height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 1.5px solid white;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
    50%       { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s cubic-bezier(.4,0,.2,1);
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-blue);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(59,130,246,.30);
    filter: brightness(1.06);
}

.btn-text {
    background: none;
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-text:hover { background: var(--primary-light, #eff6ff); }

/* ── Content Area ───────────────────────────────────────────── */
.admin-content {
    padding: 2rem 2.5rem 3rem;
    animation: fadeSlide 0.35s cubic-bezier(.4,0,.2,1) both;
}

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Page Header Strip ─────────────────────────────────────── */
.page-title-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.page-title-strip h1 {
    font-size: 1.55rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem 1.75rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    cursor: default;
}

/* Decorative gradient corner */
.stat-card::after {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: var(--card-glow, rgba(59,130,246,.06));
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.stat-card:nth-child(1) { --card-glow: rgba(59,130,246,.08); }
.stat-card:nth-child(2) { --card-glow: rgba(245,158,11,.08); }
.stat-card:nth-child(3) { --card-glow: rgba(16,185,129,.08); }
.stat-card:nth-child(4) { --card-glow: rgba(139,92,246,.08); }

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 1.1rem;
}

.stat-data h3 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 3px; }
.stat-data p  { color: var(--text-muted); font-size: 0.82rem; font-weight: 500; }

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.trend-up   { background: #ecfdf5; color: #059669; }
.trend-down { background: #fef2f2; color: #dc2626; }

/* ── Dashboard Grid ─────────────────────────────────────────── */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

/* ── Content Cards ─────────────────────────────────────────── */
.content-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem 2rem;
    border: 1px solid var(--border);
    transition: box-shadow .2s;
}

.content-card:hover { box-shadow: var(--shadow); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

/* ── Data Tables ────────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; }

.admin-table thead tr {
    background: var(--surface-2);
}

.admin-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(226,232,240,.5);
    font-size: 0.875rem;
    color: var(--text-main);
    vertical-align: middle;
}

.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: rgba(59,130,246,.03); }
.admin-table tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.badge::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
}

.badge-warning { background: var(--warning-bg);  color: #92400e; border: 1px solid #fde68a; }
.badge-warning::before { background: var(--warning); }

.badge-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.badge-success::before { background: var(--success); }

.badge-primary { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-primary::before { background: var(--primary); }

.badge-danger  { background: var(--danger-bg);  color: #991b1b; border: 1px solid #fecaca; }
.badge-danger::before { background: var(--danger); }

/* ── Loading Shimmer ────────────────────────────────────────── */
.loading-shimmer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e8edf5 50%, #f1f5f9 75%);
    background-size: 400% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ── Error / Info States ────────────────────────────────────── */
.error {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
}

.loading {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

/* ── Form Elements ──────────────────────────────────────────── */
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-main);
    background: var(--surface);
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Activity Feed ──────────────────────────────────────────── */
.activity-feed > div {
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(226,232,240,.5);
}

.activity-feed > div:last-child { border-bottom: none; }

/* ── Scrollbar (main area) ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-charts-grid { grid-template-columns: 1fr; }
    .dashboard-main-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-nav { transform: translateX(-100%); }
    .admin-main { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr; }
    .admin-content { padding: 1.25rem; }
    .admin-header { padding: 0 1.25rem; }
    .search-bar { width: 200px; }
}

/* ── Utility: Gradient Text ──────────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Glowing Pulse Indicator ────────────────────────────────── */
.pulse-ring {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--success);
    position: relative;
}

.pulse-ring::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--success);
    animation: pulse-ring 1.8s ease-out infinite;
    opacity: 0;
}

@keyframes pulse-ring {
    0%   { transform: scale(.8); opacity: .8; }
    100% { transform: scale(2);  opacity: 0; }
}

/* ── KPI Micro Chart Placeholder ────────────────────────────── */
.sparkline-wrap {
    height: 36px;
    margin-top: 0.5rem;
    opacity: 0.6;
}
