/* MailCRM - Dark Professional Theme */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
    --bg-deep:     #0a0c10;
    --bg-card:     #111520;
    --bg-sidebar:  #0d1117;
    --bg-hover:    #1a2030;
    --border:      #1e2535;
    --border-glow: #2a3550;
    --accent:      #4f8ef7;
    --accent-glow: rgba(79,142,247,0.15);
    --accent2:     #7c5cbf;
    --green:       #22c55e;
    --red:         #ef4444;
    --yellow:      #f59e0b;
    --text-1:      #e8ecf5;
    --text-2:      #7b8aab;
    --text-3:      #4a5570;
    --sidebar-w:   260px;
    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 4px 24px rgba(0,0,0,0.5);
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-deep);
    color: var(--text-1);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- Typography ---- */
h1,h2,h3,h4 { font-family: 'Syne', sans-serif; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }

/* ---- Layout ---- */
.app-layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    top: 0; left: 0;
    z-index: 100;
    transition: transform .3s ease;
}
.sidebar-logo {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo h2 {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-1);
}
.sidebar-logo h2 span { color: var(--accent); }
.sidebar-logo p { font-size: 0.72rem; color: var(--text-3); margin-top: 2px; letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 24px; }
.nav-section-label {
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0 12px 8px;
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all .2s ease;
    margin-bottom: 2px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(79,142,247,0.2); }
.nav-item .icon { width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
}
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.user-info .name { font-size: 0.82rem; font-weight: 600; color: var(--text-1); }
.user-info .role { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}
.topbar-title h1 { font-size: 1.2rem; font-weight: 700; color: var(--text-1); }
.topbar-title p  { font-size: 0.78rem; color: var(--text-3); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.page-body { padding: 28px 32px; flex: 1; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.card-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-1); }

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color .2s, box-shadow .2s;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    border-radius: 0;
}
.stat-card.blue::before   { background: var(--accent); }
.stat-card.green::before  { background: var(--green); }
.stat-card.red::before    { background: var(--red); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.purple::before { background: var(--accent2); }

.stat-card:hover { border-color: var(--border-glow); box-shadow: var(--shadow); }
.stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 16px;
}
.stat-icon.blue   { background: rgba(79,142,247,.15);  color: var(--accent); }
.stat-icon.green  { background: rgba(34,197,94,.15);   color: var(--green); }
.stat-icon.red    { background: rgba(239,68,68,.15);   color: var(--red); }
.stat-icon.yellow { background: rgba(245,158,11,.15);  color: var(--yellow); }
.stat-icon.purple { background: rgba(124,92,191,.15);  color: var(--accent2); }

.stat-value { font-size: 1.8rem; font-weight: 800; font-family: 'Syne', sans-serif; color: var(--text-1); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-3); margin-top: 4px; font-weight: 500; }

/* ---- Grid helpers ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); font-weight: 600; padding: 8px 12px; text-align: left; }
td { padding: 12px; font-size: 0.85rem; color: var(--text-2); border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); color: var(--text-1); }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.badge-green  { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-red    { background: rgba(239,68,68,.15);  color: var(--red); }
.badge-blue   { background: rgba(79,142,247,.15); color: var(--accent); }
.badge-yellow { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-gray   { background: rgba(107,114,128,.15);color: #9ca3af; }
.badge-purple { background: rgba(124,92,191,.15); color: var(--accent2); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
    border: none;
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #3a7ef0; box-shadow: 0 4px 16px rgba(79,142,247,.35); }
.btn-danger  { background: var(--red); color: white; }
.btn-danger:hover  { background: #dc2626; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #16a34a; }
.btn-outline {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--border-glow); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; letter-spacing: 0.3px; }
.form-control {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-1);
    font-size: 0.88rem;
    font-family: 'DM Sans', sans-serif;
    transition: border-color .2s;
    outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-control::placeholder { color: var(--text-3); }

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: var(--green); }
.alert-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3); color: var(--red); }
.alert-info    { background: rgba(79,142,247,.12);  border: 1px solid rgba(79,142,247,.3); color: var(--accent); }
.alert-warning { background: rgba(245,158,11,.12);  border: 1px solid rgba(245,158,11,.3); color: var(--yellow); }

/* ---- Progress bar ---- */
.progress-bar {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width .5s ease;
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(.95) translateY(8px); } to { opacity:1; transform: none; } }
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text-1); margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.modal-close { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 1.2rem; }
.modal-close:hover { color: var(--text-1); }

/* ---- Notification bell ---- */
.notif-btn {
    position: relative;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-2);
    font-size: 1rem;
    transition: all .2s;
}
.notif-btn:hover { color: var(--text-1); border-color: var(--border-glow); }
.notif-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    display: none;
}
.notif-dot.show { display: block; }

.notif-panel {
    position: absolute;
    top: 60px; right: 32px;
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 200;
    display: none;
    overflow: hidden;
}
.notif-panel.open { display: block; animation: modalIn .15s ease; }
.notif-header { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.85rem; font-weight: 700; color: var(--text-1); display: flex; justify-content: space-between; align-items: center; }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item-msg { font-size: 0.82rem; color: var(--text-1); font-weight: 500; }
.notif-item-time { font-size: 0.72rem; color: var(--text-3); margin-top: 3px; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 0.85rem; }

/* ---- Login page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-deep);
    position: relative;
    overflow: hidden;
}
.login-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(79,142,247,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 80% 90%, rgba(124,92,191,0.05) 0%, transparent 60%);
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--text-1); }
.login-logo h1 span { color: var(--accent); }
.login-logo p { font-size: 0.8rem; color: var(--text-3); margin-top: 4px; letter-spacing: 1px; text-transform: uppercase; }

/* ---- Upload zone ---- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    transition: border-color .2s, background .2s;
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: var(--accent-glow); }
.upload-zone i { font-size: 2.5rem; color: var(--text-3); margin-bottom: 12px; display: block; }
.upload-zone p  { color: var(--text-2); font-size: 0.88rem; }
.upload-zone small { color: var(--text-3); font-size: 0.75rem; }

/* ---- Session timer ---- */
.session-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-2);
}
.session-timer.warning { border-color: var(--yellow); color: var(--yellow); }
.session-timer.danger  { border-color: var(--red);    color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.6; } }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Misc ---- */
.separator { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.text-muted { color: var(--text-3); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.gap-8  { gap: 8px; }
.flex   { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.empty-state { padding: 48px; text-align: center; color: var(--text-3); }
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.empty-state p { font-size: 0.88rem; }

/* Chart bars */
.bar-chart { display: flex; gap: 6px; align-items: flex-end; height: 80px; margin-top: 12px; }
.bar-chart .bar-item { flex: 1; border-radius: 4px 4px 0 0; min-height: 4px; transition: opacity .2s; }
.bar-chart .bar-item:hover { opacity: .8; }
