/* ============================================
   ForgetMeNot — Soft, Modern "AI Interface" Theme
   Inspired by light, airy, pill-shaped medical/AI UIs
   ============================================ */

:root {
    /* Primary vibrant blue from the X-ray UI */
    --primary: #1d4ed8;
    --primary-rgb: 29, 78, 216;
    --primary-light: #eff6ff;
    
    --secondary: #6366f1;
    --accent: #0ea5e9;
    
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;

    /* Soft, premium light mode backgrounds inspired by the provided reference */
    --bg-body: #dce1e8; 
    --bg-sidebar: #f1f4f9;
    --bg-board: transparent;
    --bg-card: #ffffff;
    --bg-card-hover: #ffffff;
    --bg-input: #f1f4f9;
    --bg-surface: #e9eff6;

    /* Text colors - deepening for better readability on soft backgrounds */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-bright: #ffffff;

    /* Soft, organic shadows from the reference */
    --border: rgba(0, 0, 0, 0.05);
    --border-hover: rgba(0, 0, 0, 0.1);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    --shadow-card-hover: 0 20px 30px -10px rgba(0, 0, 0, 0.08), 0 10px 15px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 24px rgba(var(--primary-rgb), 0.1);

    /* Extreme border radius for the "pill" soft look */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-pill: 9999px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Dark Mode Variables === */
html.dark {
    --bg-body: #0b0f19;
    --bg-sidebar: #131b2f;
    --bg-card: #131b2f;
    --bg-card-hover: #17203a;
    --bg-input: #0b0f19;
    --bg-surface: #1e293b;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --border: #1e293b;
    --border-hover: #334155;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --shadow-card-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    
    --primary-light: rgba(29, 78, 216, 0.2);
}

/* === Reset === */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:15px; scroll-behavior:smooth; }
body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--secondary); }

/* ===========================
   SIDEBAR — White, clean, pill navs
   =========================== */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: 250px; height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 1000; overflow-x: hidden;
    transition: width .3s var(--ease), transform .3s var(--ease);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.02);
}
html.dark .sidebar {
    background: var(--bg-sidebar);
    box-shadow: none;
}
@media (min-width: 769px) {
    .sidebar.collapsed { width: 70px; transform: translateX(0); }
    .sidebar.collapsed .sidebar-header { flex-direction: column; padding: 1.5rem 0; gap: 1rem; align-items: center; }
    .sidebar.collapsed .logo-text { display: none; }
    .sidebar.collapsed .desktop-toggle { display: block; margin: 0 auto; }
    
    .sidebar.collapsed .sidebar-nav { padding: 1rem 0.5rem; }
    .sidebar.collapsed .nav-label { display: none; }
    .sidebar.collapsed .nav-link span { display: none; }
    .sidebar.collapsed .nav-link { justify-content: center; padding: .8rem 0; gap: 0; }
    .sidebar.collapsed .nav-link i { margin-right: 0; font-size: 1.2rem; }
    
    .sidebar.collapsed .sidebar-footer { flex-direction: column; gap: 1rem; padding: 1rem 0; align-items: center; }
    .sidebar.collapsed .user-details { display: none; }
    .sidebar.collapsed .user-info { justify-content: center; }
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-logo {
    display: flex; align-items: center; gap: .75rem;
    font-size: 1.2rem; font-weight: 800;
    letter-spacing: -.02em; color: var(--text-primary);
}
.sidebar-logo i {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: 1rem;
}

.sidebar-toggle, .mobile-toggle {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: .5rem; border-radius: var(--radius);
    transition: all .2s var(--ease); font-size: 1.1rem;
}
.sidebar-toggle:hover, .mobile-toggle:hover {
    background: var(--bg-surface); color: var(--text-primary);
}

/* Nav */
.sidebar-nav { flex: 1; padding: 1rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.25rem; }
.nav-link {
    display: flex; align-items: center; gap: .85rem;
    padding: .7rem 1rem; border-radius: var(--radius-pill);
    color: var(--text-secondary); font-weight: 600; font-size: .9rem;
    transition: all .2s var(--ease);
}
.nav-link:hover { 
    background: rgba(var(--primary-rgb), 0.05); 
    color: var(--primary); 
    transform: translateX(4px);
}
.nav-link.active {
    background: var(--primary); color: #fff;
    box-shadow: 0 8px 16px rgba(var(--primary-rgb), 0.2);
}
.nav-link i { width: 20px; text-align: center; font-size: 1rem; opacity: .8; transition: transform 0.2s; }
.nav-link:hover i { transform: scale(1.1); }
.nav-link.active i { opacity: 1; }

.nav-divider { height: 1px; background: var(--border); margin: 1rem 0; }
.nav-label {
    display: block; padding: .5rem 1rem;
    font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .1em; color: var(--text-muted);
}

/* Footer */
.sidebar-footer {
    padding: 1.25rem; border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.user-info { display: flex; align-items: center; gap: .75rem; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem; color: var(--primary);
}
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: .85rem; font-weight: 700; color: var(--text-primary); }
.user-role { font-size: .7rem; color: var(--text-muted); font-weight: 500; }
.logout-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: .5rem; border-radius: var(--radius-pill);
    transition: all .2s var(--ease);
}
.logout-btn:hover { background: rgba(239,68,68,.1); color: var(--danger); }

/* ===========================
   MAIN CONTENT
   =========================== */
.main-content {
    margin-left: 250px; min-height: 100vh;
    transition: margin-left .3s var(--ease);
}
@media (min-width: 769px) {
    .main-content.expanded { margin-left: 70px; }
}

.top-bar {
    padding: 1rem 2rem;
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(var(--primary-rgb), 0.02);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.02);
    position: sticky; top: 0; z-index: 100;
}
html.dark .top-bar {
    background: rgba(11, 15, 25, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.mobile-toggle { display: none; }
.greeting { color: var(--text-muted); font-size: .9rem; font-weight: 500; }
.page-content { padding: 0 2rem 2rem 2rem; }

/* ===========================
   CARDS — Soft, Floating
   =========================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: all .3s var(--ease);
    position: relative;
    overflow: hidden;
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

/* ===========================
   BOARD — Soft columns
   =========================== */
.board {
    display: flex; gap: 1.5rem;
    overflow-x: auto; padding-bottom: 1rem;
    min-height: 300px;
}
.board-column {
    flex: 1; min-width: 280px; max-width: 360px;
    display: flex; flex-direction: column;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-xl);
    padding: 0.5rem;
}
html.dark .board-column {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.board-column-header {
    padding: 0.75rem 1rem;
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 700; font-size: 1rem; color: var(--text-primary);
}
.board-column-header .col-count {
    background: var(--bg-surface); color: var(--text-secondary);
    padding: .2rem .6rem; border-radius: var(--radius-pill);
    font-size: .75rem; font-weight: 700;
}
.board-column-body {
    flex: 1; display: flex; flex-direction: column; gap: 1rem;
    overflow-y: auto; max-height: calc(100vh - 250px); padding: 0.25rem;
}

/* Board Card (Like the AI diagnosis cards) */
.board-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    cursor: pointer;
    transition: all .3s var(--ease);
    position: relative;
    box-shadow: var(--shadow-sm);
    display: block; text-decoration: none;
}
.board-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}
.board-card-title {
    font-weight: 700; font-size: 1.05rem;
    margin-bottom: .4rem; color: var(--text-primary);
    display: flex; justify-content: space-between; align-items: flex-start;
}
.board-card-title .priority-badge {
    background: var(--primary); color: #fff;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 800; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}
.board-card-meta {
    display: flex; flex-direction: column; gap: .35rem;
    font-size: .85rem; color: var(--text-secondary); line-height: 1.4;
}
.board-card-labels {
    display: flex; gap: .5rem; margin-top: 1rem; align-items: center; flex-wrap: wrap;
}
.board-label {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .25rem .75rem; border-radius: var(--radius-pill);
    font-size: .75rem; font-weight: 600;
    background: var(--bg-surface); color: var(--text-secondary);
}
.board-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 1rem; padding-top: 1rem;
    border-top: 1px dashed var(--border);
}
.board-card-actions { display: flex; gap: .5rem; }
.board-card-actions a {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: .85rem;
    background: var(--bg-surface);
    transition: all .2s var(--ease);
}
.board-card-actions a:hover {
    background: var(--primary); color: #fff;
}

/* ===========================
   STAT CARDS — Clean pills
   =========================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem; margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex; align-items: center; gap: 1.25rem;
    transition: all .3s var(--ease);
    box-shadow: var(--shadow-sm);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }

.stat-icon {
    width: 54px; height: 54px; border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.primary { background: rgba(29, 78, 216, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-info {}
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--text-primary); margin-bottom: 0.25rem; }
.stat-label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }

/* ===========================
   ALERTS
   =========================== */
.alert {
    padding: 1rem 1.25rem; border-radius: var(--radius-lg);
    margin-bottom: 1.5rem; display: flex; align-items: center; gap: .75rem;
    font-size: .9rem; font-weight: 500; animation: slideDown .3s var(--ease);
}
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #10b981; }
.alert-danger { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #ef4444; }
.alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); color: #f59e0b; }

@keyframes slideDown {
    from { opacity:0; transform:translateY(-8px); }
    to { opacity:1; transform:translateY(0); }
}

/* ===========================
   BUTTONS — Super rounded
   =========================== */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .7rem 1.4rem; border: none; border-radius: var(--radius-pill);
    font-family: var(--font); font-size: .9rem; font-weight: 700;
    cursor: pointer; transition: all .2s var(--ease);
    text-decoration: none; line-height: 1.4; justify-content: center;
}
.btn-primary {
    background: var(--primary); color: #fff;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.4); }
.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-outline {
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); box-shadow: var(--shadow-sm);
}
.btn-outline:hover { border-color: var(--border-hover); color: var(--text-primary); box-shadow: var(--shadow-card); background: var(--bg-surface); }
.btn-sm { padding: .4rem .85rem; font-size: .8rem; }
.btn-ghost {
    background: none; border: none; color: var(--text-muted);
    padding: .4rem .6rem; border-radius: var(--radius-pill);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-surface); }

/* ===========================
   FORMS — Soft inputs
   =========================== */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block; font-size: .85rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: .4rem;
}
.form-input, .form-select, .form-textarea {
    width: 100%; padding: .8rem 1.2rem;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-lg); color: var(--text-primary);
    font-family: var(--font); font-size: .95rem; font-weight: 500;
    transition: all .2s var(--ease);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary); background: var(--bg-card);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.form-input::placeholder { color: var(--text-muted); font-weight: 400; }
.form-textarea { min-height: 100px; resize: vertical; border-radius: var(--radius); }
.form-input-sm { padding: .55rem 1rem; font-size: .9rem; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

/* Date input calendar icon visibility in dark mode */
input[type="date"].form-input,
input[type="date"].form-input-sm {
    color-scheme: dark;
}
html:not(.dark) input[type="date"].form-input,
html:not(.dark) input[type="date"].form-input-sm {
    color-scheme: light;
}

/* ===========================
   TABLE — Clean, airy
   =========================== */
.table-container {
    overflow-x: auto; border-radius: var(--radius-lg);
    background: var(--bg-card);
}
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th {
    padding: 1rem 1.25rem; text-align: left;
    font-size: .75rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted);
    border-bottom: 2px solid var(--bg-body);
}
.data-table td {
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--bg-body);
    font-size: .9rem; font-weight: 500; color: var(--text-primary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-surface); }

/* ===========================
   BADGES — Soft pills
   =========================== */
.badge {
    display: inline-flex; align-items: center;
    padding: .2rem .75rem; border-radius: var(--radius-pill);
    font-size: .75rem; font-weight: 700;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-info { background: rgba(14, 165, 233, 0.15); color: #0ea5e9; border: 1px solid rgba(14, 165, 233, 0.2); }
.badge-secondary { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }

.category-badge {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .3rem .8rem; border-radius: var(--radius-pill);
    font-size: .8rem; font-weight: 600;
}

/* ===========================
   PAGE HEADER
   =========================== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem;
}
.page-title { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; color: var(--text-primary); }
.page-title i { margin-right: .5rem; color: var(--primary); }

/* ===========================
   EMPTY STATE
   =========================== */
.empty-state {
    text-align: center; padding: 3rem 2rem; color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; color: #cbd5e1; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: .4rem; color: var(--text-primary); font-weight: 700; }
.empty-state p { font-size: .9rem; }

/* ===========================
   SECTION DIVIDER
   =========================== */
.section-title {
    font-size: 1.1rem; font-weight: 800; color: var(--text-primary);
    margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem;
}
.section-title i { font-size: 1rem; color: var(--primary); }

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width:768px) {
    .sidebar { transform: translateX(-250px); }
    .sidebar.collapsed { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .page-content { padding: 0 1rem 1rem 1rem; }
    .board { flex-direction: column; }
    .board-column { max-width: 100%; min-width: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
    .form-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; margin-bottom: 1rem; }
    .page-title { font-size: 1.2rem; }

    /* Top-bar header mobile */
    .top-bar { padding: .75rem 1rem !important; }
    .top-bar .card {
        flex-direction: column !important;
        border-radius: var(--radius-xl) !important;
        padding: 1rem !important;
        gap: .75rem !important;
    }
    .top-bar .card > div:first-child {
        width: 100%;
    }
    .top-bar .card > div:last-child {
        width: 100%;
        justify-content: space-between !important;
    }
    .top-bar .btn-primary {
        font-size: .8rem !important;
        padding: .5rem 1rem !important;
    }
    .top-bar img {
        width: 42px !important;
        height: 42px !important;
    }

    /* Account detail grid */
    .detail-grid-2 { grid-template-columns: 1fr !important; }

    /* Dashboard activity sidebar */
    #activitySidebar { width: 100% !important; }
    #activitySidebar > div { width: 100% !important; }

    /* Stat cards compact */
    .stat-card { padding: 1rem; gap: .75rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }
    .stat-value { font-size: 1.4rem; }
}
@media (max-width:480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .top-bar .card > div:last-child .btn-primary span { display: none; }
}

/* ===========================
   THEME SWITCH ANIMATIONS
   =========================== */
.theme-sweep-overlay {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: var(--primary);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: none;
}

.theme-sweep-active {
    animation: sweepAcross 1.2s cubic-bezier(0.7, 0, 0.3, 1) forwards;
}

.theme-icon-anim {
    font-size: 8rem;
    color: #fff;
    filter: drop-shadow(0 0 30px rgba(255,255,255,0.4));
}

@keyframes sweepAcross {
    0% { left: -100%; opacity: 0; }
    30% { opacity: 1; }
    50% { left: 0; opacity: 1; }
    70% { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

.flash-effect {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #fff;
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
}
.theme-flash {
    animation: flashAnim 0.8s ease-out forwards;
}
@keyframes flashAnim {
    0% { opacity: 0; }
    50% { opacity: 0.5; }
    100% { opacity: 0; }
}
