/* ========================================================
   RingScheduler — Premium Dark UI
   ======================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-900: #0a0d14;
    --bg-800: #111521;
    --bg-700: #161b2e;
    --bg-600: #1e2540;
    --bg-500: #252e4d;
    --surface: #1a2035;
    --surface-hover: #202843;
    --border: rgba(255,255,255,0.07);
    --border-accent: rgba(99,179,237,0.25);

    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-glow: rgba(59,130,246,0.35);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-glow: rgba(239,68,68,0.3);

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #4a5568;

    --sidebar-w: 240px;
    --topbar-h: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --transition: 0.2s ease;
}

/* Light Theme Variables */
.theme-light {
    --bg-900: #f8fafc;
    --bg-800: #ffffff;
    --bg-700: #f1f5f9;
    --bg-600: #e2e8f0;
    --bg-500: #cbd5e1;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: rgba(0,0,0,0.1);
    --border-accent: rgba(59,130,246,0.3);

    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-glow: rgba(37,99,235,0.2);
    /* Colors stay similar but adapted for light mode */
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
}

html { font-size: 15px; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-900);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: #fff; }

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

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-800);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-w)));
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(251,191,36,0.6));
    animation: bellWiggle 4s ease-in-out infinite;
}

@keyframes bellWiggle {
    0%,85%,100% { transform: rotate(0); }
    90% { transform: rotate(-15deg); }
    95% { transform: rotate(15deg); }
}

.logo-text { display: flex; flex-direction: column; }
.logo-title { font-size: 0.95rem; font-weight: 700; color: #fff; }
.logo-sub { font-size: 0.7rem; color: var(--text-secondary); }

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(59,130,246,0.1));
    color: var(--accent-light);
    border: 1px solid rgba(59,130,246,0.3);
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.btn-logout {
    font-size: 18px;
    color: var(--text-muted);
    transition: color var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover { color: var(--danger); }

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

/* ---------- Topbar ---------- */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-800);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--surface-hover); color: var(--text-primary); }

.topbar-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-700);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 6px;
}

/* ---------- Content Area ---------- */
.content-area {
    flex: 1;
    padding: 24px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, transparent 60%);
    pointer-events: none;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.card-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 20px; }
.mt-3 { margin-top: 12px; }

/* ---------- Dashboard Grid ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
}

.card-clock {
    grid-column: 1 / 3;
    background: linear-gradient(135deg, #0f1a3d 0%, #1a2752 50%, #0d1736 100%);
    border-color: var(--border-accent);
}

.clock-display { text-align: center; }

.clock-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 4.5rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #fff;
    text-shadow: 0 0 30px rgba(99,179,237,0.5), 0 0 60px rgba(59,130,246,0.3);
    line-height: 1;
    margin-bottom: 8px;
}

.clock-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.clock-meta { margin-top: 16px; display: flex; justify-content: center; }

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.badge-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--profile-color, var(--accent));
    box-shadow: 0 0 8px var(--profile-color, var(--accent));
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.85); }
}

/* Next Bell Card */
.card-next-bell {
    background: linear-gradient(135deg, #0f2518 0%, #0d2010 100%);
    border-color: rgba(16,185,129,0.3);
}

.next-bell-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 3rem;
    font-weight: 800;
    color: var(--success);
    text-shadow: 0 0 20px rgba(16,185,129,0.5);
    line-height: 1;
    margin-bottom: 4px;
}

.next-bell-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.countdown-bar-wrap {
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.countdown-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #34d399);
    border-radius: 999px;
    width: 0;
    transition: width 1s linear;
    box-shadow: 0 0 8px rgba(16,185,129,0.6);
}

.countdown-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
}

/* Ring Now Card */
.card-ring-now {
    background: linear-gradient(135deg, #1f0a0a 0%, #2a0f0f 100%);
    border-color: rgba(239,68,68,0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.btn-ring-now {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border: none;
    border-radius: var(--radius);
    padding: 16px 28px;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(239,68,68,0.4);
    width: 100%;
    justify-content: center;
}

.btn-ring-now:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(239,68,68,0.6);
}

.btn-ring-now:active { transform: scale(0.97); }

.btn-ring-now.ringing {
    animation: ringPulse 0.3s ease-in-out infinite alternate;
}

@keyframes ringPulse {
    from { box-shadow: 0 4px 20px rgba(239,68,68,0.4); }
    to { box-shadow: 0 8px 40px rgba(239,68,68,0.9); }
}

.ring-now-icon { font-size: 1.4rem; }
.ring-now-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 10px; }

/* Today Schedule Card */
.card-today-schedule { grid-column: 1 / 3; }

.bell-list { display: flex; flex-direction: column; gap: 3px; max-height: 300px; overflow-y: auto; }

.bell-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-700);
    border: 1px solid var(--border);
    transition: background var(--transition);
    font-size: 0.85rem;
}

.bell-item:hover { background: var(--surface-hover); }
.bell-item.bell-disabled { opacity: 0.4; }
.bell-item.bell-passed { opacity: 0.5; }
.bell-item.bell-next { border-color: var(--success); background: rgba(16,185,129,0.07); }

.bell-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-light);
    min-width: 48px;
}

.bell-label { flex: 1; color: var(--text-secondary); }

.bell-passed-indicator {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Log Card */
.log-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }

.log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--bg-700);
    font-size: 0.78rem;
}

.log-type { font-size: 0.85rem; }
.log-time { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--text-primary); }
.log-date { color: var(--text-muted); flex: 1; }
.log-ok { color: var(--success); font-weight: 700; }
.log-fail { color: var(--danger); font-weight: 700; }
.log-more-link { font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Bell Type Badges ---------- */
.bell-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.bell-type-lesson  { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.bell-type-warning { background: rgba(234,88,12,0.15); color: #fdba74; border: 1px solid rgba(234,88,12,0.3); }
.bell-type-break   { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
.bell-type-end     { background: rgba(239,68,68,0.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #2563eb);
    color: #fff;
    border-color: rgba(59,130,246,0.5);
    box-shadow: 0 2px 10px rgba(59,130,246,0.25);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(59,130,246,0.4); }

.btn-ghost {
    background: var(--bg-700);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }

.btn-danger-ghost {
    background: rgba(239,68,68,0.08);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.2);
}
.btn-danger-ghost:hover { background: rgba(239,68,68,0.18); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    background: var(--bg-700);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.form-input-sm { max-width: 120px; }
.form-select option { background: var(--bg-700); }
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; display: block; }

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

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ---------- Toggle Switch ---------- */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-600);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 2px; top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: #fff; }

/* ---------- Table ---------- */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    padding: 10px 14px;
    text-align: left;
    background: var(--bg-700);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tr:hover td { background: var(--surface-hover); color: var(--text-primary); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .row-disabled td { opacity: 0.4; }

.time-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-light);
    background: rgba(59,130,246,0.1);
    padding: 3px 10px;
    border-radius: 6px;
}

.action-btns { display: flex; gap: 4px; }

.file-name {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.empty-table-cell { text-align: center; padding: 40px !important; }

/* ---------- Modal ---------- */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.open { display: flex; }

.modal-card {
    background: var(--bg-600);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: none; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; color: #fff; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-hover); color: var(--text-primary); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ---------- Profiles Grid ---------- */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--card-color, var(--accent));
    border-radius: var(--radius);
    padding: 16px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.profile-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.profile-color-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-card-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); flex: 1; }

.active-badge {
    font-size: 0.68rem;
    font-weight: 700;
    background: rgba(16,185,129,0.15);
    color: var(--success);
    border: 1px solid rgba(16,185,129,0.3);
    padding: 2px 8px;
    border-radius: 999px;
}

.profile-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    min-height: 18px;
}

.profile-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Week Assignment Matrix */
.week-matrix {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.week-day-cell { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.week-day-name { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); }
.week-day-select { text-align: center; font-size: 0.72rem; padding: 5px 4px; }

/* Color Picker */
.color-picker-row { display: flex; align-items: center; gap: 12px; }
.color-picker { width: 48px; height: 36px; border: none; background: none; cursor: pointer; border-radius: 6px; padding: 0; }
.color-presets { display: flex; gap: 6px; }
.color-preset { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform var(--transition); }
.color-preset:hover { transform: scale(1.2); border-color: rgba(255,255,255,0.4); }

/* ---------- Settings ---------- */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    transition: border-color var(--transition);
}
.upload-area:hover { border-color: var(--accent); }
.upload-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; }

.audio-files-list { display: flex; flex-direction: column; gap: 8px; }
.audio-file-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-700); border-radius: var(--radius-sm); }
.audio-icon { font-size: 16px; }
.audio-name { flex: 1; font-size: 0.85rem; color: var(--text-primary); }
.audio-path { font-size: 0.7rem; color: var(--text-muted); }

.role-badge { padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; background: var(--bg-700); color: var(--text-muted); }
.role-admin { background: rgba(139,92,246,0.15); color: #c4b5fd; }

/* ---------- Empty State ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 32px 16px;
    color: var(--text-muted);
}
.empty-state span { font-size: 2.5rem; }
.empty-state p { font-size: 0.85rem; }

/* ---------- Alert ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 8px 24px;
    font-size: 0.875rem;
    border: 1px solid transparent;
}
.alert-success { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-danger  { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }

/* ---------- Toast Notifications ---------- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-600);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 0.85rem;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    max-width: 320px;
}

.toast.show { opacity: 1; transform: none; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.badge-auto   { background: rgba(59,130,246,0.15); color: var(--accent-light); }
.badge-manual { background: rgba(245,158,11,0.15); color: #fcd34d; }

.status-ok   { color: var(--success); font-weight: 600; font-size: 0.85rem; }
.status-fail { color: var(--danger);  font-weight: 600; font-size: 0.85rem; }

/* ---------- Misc ---------- */
.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; }
.text-muted { color: var(--text-muted) !important; }
.section-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

/* ++++++++++++++++++++++++++++++++++++++++++++++
   LOGIN PAGE
   ++++++++++++++++++++++++++++++++++++++++++++++ */

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-900);
}

.login-bg {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.login-rings {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(59,130,246,0.12);
    animation: ringExpand 6s ease-in-out infinite;
}

.ring-1 { width: 400px; height: 400px; animation-delay: 0s; }
.ring-2 { width: 650px; height: 650px; animation-delay: 1.5s; }
.ring-3 { width: 900px; height: 900px; animation-delay: 3s; }

@keyframes ringExpand {
    0%   { opacity: 0.6; transform: scale(0.95); }
    50%  { opacity: 0.2; transform: scale(1.03); }
    100% { opacity: 0.6; transform: scale(0.95); }
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon { font-size: 3rem; filter: drop-shadow(0 0 16px rgba(251,191,36,0.7)); display: block; margin-bottom: 10px; }
.login-logo h1 { font-size: 1.6rem; font-weight: 800; color: #fff; margin-bottom: 4px; }
.login-logo p { font-size: 0.8rem; color: var(--text-muted); }

.login-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: #fca5a5;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-form { display: flex; flex-direction: column; gap: 0; }
.login-form .form-group { margin-bottom: 20px; }

.password-wrap { position: relative; }
.password-wrap .form-input { padding-right: 44px; }
.pw-toggle {
    position: absolute;
    right: 10px; top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    font-size: 16px; cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition);
}
.pw-toggle:hover { color: var(--text-primary); }

.login-hint { text-align: center; font-size: 0.72rem; color: var(--text-muted); margin-top: 16px; }

/* ---------- Profile Selector ---------- */
.profile-selector-wrap {
    display: flex; align-items: center; gap: 12px;
}
.profile-selector { min-width: 200px; }

/* ++++++++++++++++++++++++++++++++++++++++++++++
   CALENDAR PAGE
   ++++++++++++++++++++++++++++++++++++++++++++++ */
.calendar-controls { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; }
.month-selector { display: flex; align-items: center; gap: 16px; width: 100%; }
.month-label { font-size: 1.2rem; font-weight: 700; color: #fff; min-width: 150px; text-align: center; margin: 0; }

.calendar-card { padding: 0; overflow: hidden; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--border);
    gap: 1px;
}

.cal-header {
    background: var(--bg-700);
    padding: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.cal-weekend { color: #fca5a5; }

.cal-days {
    display: contents;
}

.cal-day {
    background: var(--surface);
    min-height: 120px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: background var(--transition);
    cursor: pointer;
}
.cal-day:hover { background: var(--surface-hover); }
.cal-day.empty { background: var(--bg-900); cursor: default; }

.cal-day-num {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    align-self: flex-end;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.cal-day.today .cal-day-num {
    background: var(--accent);
    color: #fff;
}

.cal-day.has-override {
    border-top: 2px solid var(--accent);
}

.cal-badge {
    background: rgba(255,255,255,0.1);
    border-left: 3px solid var(--bg, var(--accent));
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge-none { border-left-color: var(--danger); color: #fca5a5; background: rgba(239,68,68,0.1); }

.cal-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.2;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-800); }
::-webkit-scrollbar-thumb { background: var(--bg-500); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .card-clock { grid-column: 1; }
    .card-today-schedule { grid-column: 1; }
    .week-matrix { grid-template-columns: repeat(4, 1fr); }
    .clock-time { font-size: 3rem; }
}

@media (max-width: 600px) {
    .content-area { padding: 12px; }
    .main-content { margin-left: 0; }
    .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
    .sidebar.open { transform: none; }
    .week-matrix { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .layout { flex-direction: column; }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-shrink: 0;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        position: absolute;
        z-index: 100;
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    }
    
    .sidebar.collapsed {
        transform: translateY(0);
    }
    
    .main-content { margin-left: 0; flex-grow: 1; padding-top: 60px; /* space for fixed topbar */ }
    
    .topbar {
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 90;
        border-radius: 0;
        width: 100%;
    }
    
    .card-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .action-btns { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    
    .dashboard-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    
    .table-container { overflow-x: auto; }
    
    .file-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .file-actions { width: 100%; justify-content: space-between; }
    
    .profile-selector-wrap { width: 100%; flex-direction: column; align-items: flex-start; }
    .profile-selector { width: 100%; }
    
    .calendar-grid { font-size: 0.8rem; }
    .cal-day { min-height: 80px; padding: 4px; }
}

/* ---------- Login Page ---------- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-900);
    overflow: hidden;
}

.login-bg {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vw;
    max-width: 800px;
    max-height: 800px;
    pointer-events: none;
    z-index: 0;
}

.ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid var(--accent-glow);
    animation: pulseRing 6s infinite alternate ease-in-out;
}
.ring-1 { width: 300px; height: 300px; animation-delay: 0s; }
.ring-2 { width: 500px; height: 500px; animation-delay: 1s; opacity: 0.6; }
.ring-3 { width: 700px; height: 700px; animation-delay: 2s; opacity: 0.3; }

@keyframes pulseRing {
    from { transform: translate(-50%, -50%) scale(0.95); box-shadow: 0 0 20px rgba(59,130,246,0.1) inset; }
    to { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 0 40px rgba(59,130,246,0.3) inset; }
}

.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    background: rgba(22, 27, 46, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.theme-light .login-card {
    background: rgba(255, 255, 255, 0.9);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}
.login-logo-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
    animation: gentleShake 3s infinite ease-in-out;
}

@keyframes gentleShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 5px;
}
.login-logo p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-left: 3px solid var(--danger);
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.password-wrap .form-input {
    width: 100%;
    padding-right: 40px;
}
.pw-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 4px;
}
.pw-toggle:hover {
    color: var(--text-primary);
}

.btn-full { width: 100%; margin-top: 10px; }

.login-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 25px;
    border-top: 1px solid var(--border);
    padding-top: 15px;
}

@media (max-width: 768px) {
    .layout { flex-direction: column; }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-shrink: 0;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        position: absolute;
        z-index: 100;
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    }
    
    .sidebar.collapsed {
        transform: translateY(0);
    }
    
    .main-content { margin-left: 0; flex-grow: 1; padding-top: 60px; /* space for fixed topbar */ }
    
    .topbar {
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 90;
        border-radius: 0;
        width: 100%;
    }
    
    .card-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .action-btns { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    
    .dashboard-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    
    .table-container { overflow-x: auto; }
    
    .file-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .file-actions { width: 100%; justify-content: space-between; }
    
    .profile-selector-wrap { width: 100%; flex-direction: column; align-items: flex-start; }
    .profile-selector { width: 100%; }
    
    .calendar-grid { font-size: 0.8rem; }
    .cal-day { min-height: 80px; padding: 4px; }
}
