/* ============================================
   shell.css — App shell: sidebar (+ collapse), toolbar, notification bell,
   generic modal/toast/drag-drop infrastructure, keyboard shortcuts overlay,
   base responsive behavior. Part of the app.css split — loads after base.css.
   ============================================ */

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width); height: 100vh;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    flex-shrink: 0; z-index: 100;
    transition: width 0.25s ease, transform 0.3s ease;
}
.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 1.1rem; color: var(--gold);
}
.sidebar-brand i { font-size: 1.3rem; }
.sidebar-close { display: none; }

.sidebar-search { padding: 12px 14px; }
.sidebar-search .input-icon input {
    padding: 9px 14px 9px 36px; font-size: 0.85rem;
    background: var(--bg-darkest); border-radius: var(--radius-sm);
}
.sidebar-search .input-icon i { font-size: 0.95rem; left: 11px; }

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: 8px 0;
}
.nav-section { padding: 4px 0; }
.nav-divider { height: 1px; background: var(--border); margin: 8px 16px; }
.nav-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px 6px;
    font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted);
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 18px; color: var(--text-secondary);
    transition: all var(--transition); cursor: pointer;
    font-size: 0.88rem;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
    background: var(--navy-glow); color: var(--gold);
    border-right: 3px solid var(--gold);
}
.nav-item i { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-item span:first-of-type { flex: 1; }
.nav-count {
    font-size: 0.75rem; padding: 1px 7px;
    background: var(--bg-active); border-radius: 10px;
    color: var(--text-muted); font-weight: 500;
}

.folder-item, .category-item, .badge-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 18px 8px 24px; color: var(--text-secondary);
    font-size: 0.85rem; cursor: pointer;
    transition: all var(--transition);
}
.folder-item:hover, .category-item:hover, .badge-item:hover {
    background: var(--bg-hover); color: var(--text-primary);
}
.folder-item.active, .category-item.active {
    background: var(--navy-glow); color: var(--gold);
    border-right: 3px solid var(--gold);
}
.folder-item .folder-dot, .category-item .cat-dot, .badge-item .badge-dot {
    display: block; flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%;
}
.folder-item span, .category-item span, .badge-item span { flex: 1; }
.folder-item .item-count, .category-item .item-count {
    flex: none; min-width: 20px;
    font-size: 0.72rem; color: var(--text-muted); text-align: right;
}
.folder-item .folder-actions, .category-item .cat-actions, .badge-item .badge-actions {
    display: none; gap: 2px;
}
.folder-item:hover .folder-actions,
.category-item:hover .cat-actions,
.badge-item:hover .badge-actions {
    display: flex;
}
.folder-children { padding-left: 14px; }

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.user-info {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem; color: var(--text-secondary);
}
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--navy); display: flex;
    align-items: center; justify-content: center;
    font-size: 0.85rem; color: var(--gold);
}
.sidebar-actions { display: flex; gap: 2px; }

/* ===== Sidebar collapse (desktop only — mobile keeps the slide-in drawer) ===== */
@media (min-width: 769px) {
    html.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
    html.sidebar-collapsed .sidebar-header { justify-content: center; padding: 16px 8px; }
    html.sidebar-collapsed .sidebar-brand { gap: 0; }
    html.sidebar-collapsed .sidebar-brand span { display: none; }
    html.sidebar-collapsed .sidebar-search { display: none; }
    html.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; }
    html.sidebar-collapsed .nav-item span { display: none; }
    html.sidebar-collapsed #folderSection,
    html.sidebar-collapsed #categorySection,
    html.sidebar-collapsed #badgeSection { display: none; }
    html.sidebar-collapsed .sidebar-footer { flex-direction: column; gap: 10px; padding: 14px 6px; }
    html.sidebar-collapsed .user-info { justify-content: center; }
    html.sidebar-collapsed .user-info span { display: none; }
    html.sidebar-collapsed .sidebar-actions { justify-content: center; }
}

/* ===== Main Area ===== */
.main {
    flex: 1; display: flex; flex-direction: column;
    min-width: 0; height: 100vh;
}

.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px; height: var(--toolbar-height);
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
    flex-shrink: 0;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; }
.toolbar-left h2 { font-size: 1.05rem; font-weight: 600; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

/* ── Notification bell ── */
.notif-bell-wrap { position: relative; }
.notif-bell-badge {
    position: absolute; top: 2px; right: 2px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--danger); color: #fff;
    font-size: 0.62rem; font-weight: 700; line-height: 16px; text-align: center;
    border-radius: 999px; border: 1px solid var(--bg-dark);
}
.notif-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
    width: 340px; max-width: calc(100vw - 32px);
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    overflow: hidden;
}
.notif-dropdown-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    font-weight: 600; color: var(--text-primary); font-size: 0.9rem;
}
.notif-dropdown-header span { display: flex; align-items: center; gap: 8px; }
.notif-dropdown-header i { color: var(--gold); }
.notif-dropdown-list { max-height: 360px; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.notif-item {
    width: 100%; display: flex; align-items: center; gap: 10px;
    background: var(--bg-elevated); border: 1px solid var(--border); border-left-width: 3px;
    border-radius: 8px; padding: 10px 12px; text-align: left; cursor: pointer; color: inherit;
    transition: all var(--transition);
}
.notif-item:hover { border-color: var(--gold); }
.notif-item i { font-size: 1rem; color: var(--text-muted); flex-shrink: 0; }
.notif-item.overdue { border-left-color: var(--danger); }
.notif-item.overdue i { color: var(--danger); }
.notif-item.soon { border-left-color: #e0a52b; }
.notif-item.soon i { color: #e0a52b; }
.notif-item.today { border-left-color: var(--gold); }
.notif-item.today i { color: var(--gold); }
.notif-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-item-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item-meta { font-size: 0.72rem; color: var(--text-muted); }

.content-area {
    flex: 1; display: flex; overflow: hidden;
}

/* ── Shared feature-panel layout (used by every feature panel: Dashboard,
   Habits, Expenses, Calendar, Todos, Stickies, Songs, Pomodoro, Prayers,
   Moods, Fitness, Tools, Bills, Installments) ── */
.feature-panel {
    flex: 1; overflow-y: auto; padding: 24px 28px;
    background: var(--bg-darkest);
    display: flex; flex-direction: column; gap: 20px;
}
.feature-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.feature-header h2 {
    font-size: 1.2rem; font-weight: 700;
    display: flex; align-items: center; gap: 10px; color: var(--text-primary);
}
.feature-header h2 i { color: var(--gold); }
.feature-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 3px; }

@media (max-width: 768px) {
    .feature-panel { padding: 16px; }
}

/* ===== Modals (generic dialog chrome shared by every feature's modals) ===== */
.modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
}
.modal-dialog {
    position: relative; width: 100%; max-width: 480px;
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    max-height: 80vh; display: flex; flex-direction: column;
}
.modal-sm { max-width: 380px; }
.modal-lg { max-width: 960px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 20px; border-top: 1px solid var(--border);
}

.badge-picker-list { display: flex; flex-direction: column; gap: 6px; }
.badge-picker-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: var(--radius-sm);
    cursor: pointer; transition: background var(--transition);
}
.badge-picker-item:hover { background: var(--bg-hover); }
.badge-picker-item input[type="checkbox"] {
    accent-color: var(--gold); width: 16px; height: 16px;
}
.badge-picker-item .badge-preview {
    padding: 2px 10px; border-radius: 8px;
    font-size: 0.8rem; font-weight: 500; color: #fff;
}

.settings-section {
    padding-bottom: 20px; margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.settings-section:last-child { border-bottom: none; margin-bottom: 0; }
.settings-section h4 {
    font-size: 0.95rem; font-weight: 600; margin-bottom: 14px;
    color: var(--gold);
}
.text-muted { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 10px; }

/* ── Backup module checklist (in Settings modal) ── */
.backup-module-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-bottom: 8px;
}
.backup-mod-lbl {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.backup-mod-lbl input[type="checkbox"] {
  accent-color: var(--gold);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed; bottom: 20px; right: 20px;
    z-index: 2000; display: flex; flex-direction: column-reverse; gap: 8px;
}
.toast {
    padding: 12px 20px; border-radius: var(--radius);
    background: var(--bg-elevated); border: 1px solid var(--border);
    color: var(--text-primary); font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
    display: flex; align-items: center; gap: 8px;
}
.toast.success { border-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.info { border-color: var(--info); }
.toast.info i { color: var(--info); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Drag & Drop ===== */
.drop-target { border: 2px dashed var(--gold) !important; background: var(--gold-dim) !important; }
.drag-over { background: var(--gold-dim); }

/* ===== Keyboard Shortcuts Overlay ===== */
.shortcuts-overlay {
    position: fixed; inset: 0; z-index: 1100;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(6px);
}
.shortcuts-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 28px 32px;
    box-shadow: var(--shadow-lg); min-width: 380px;
}
.shortcuts-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.shortcuts-header h3 { font-size: 1rem; font-weight: 600; color: var(--gold); display: flex; align-items: center; gap: 8px; }
.shortcuts-grid { display: flex; flex-direction: column; gap: 10px; }
.shortcut-row {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: var(--text-secondary);
}
.shortcut-row span { flex: 1; margin-left: 8px; }
kbd {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 3px 8px; border-radius: 5px; font-size: 0.75rem; font-family: var(--font);
    background: var(--bg-elevated); border: 1px solid var(--border-light);
    color: var(--text-primary); font-weight: 600; min-width: 28px;
}

/* ===== Responsive (base app shell: sidebar drawer, notes/editor mobile layout) ===== */
@media (max-width: 1024px) {
    .notes-panel { width: 300px; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed; left: 0; top: 0;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: flex; }
    .sidebar-overlay {
        position: fixed; inset: 0; z-index: 99;
        background: rgba(0,0,0,0.5);
        display: none;
    }
    .sidebar-overlay.open { display: block; }

    .notes-panel {
        width: 100%; border-right: none;
    }
    .editor-panel {
        position: fixed; inset: 0; z-index: 50;
        background: var(--bg-darkest);
    }
    .editor-panel .editor-toolbar .editor-meta { display: none; }
    .hide-mobile { display: none; }

    .format-toolbar { padding: 4px 8px; }
    .fmt-btn { width: 28px; height: 28px; font-size: 0.9rem; }

    .shortcuts-box { min-width: 0; width: 90vw; padding: 20px; }
}
