/* ============================================
   Reminder System — Main Stylesheet
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --warning: #f59e0b;
    --info: #3b82f6;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
    --transition: .2s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: .9rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); font-size: .875rem; font-weight: 500; transition: var(--transition); white-space: nowrap; }
.btn:hover { background: var(--bg-tertiary); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-tertiary); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: none; color: var(--accent); font-size: .8rem; padding: 4px 8px; }
.btn-link:hover { text-decoration: underline; }
.btn-group { display: flex; gap: 2px; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary); transition: var(--transition); outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { background: #fef2f2; color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 12px; border: 1px solid #fecaca; }

/* ---------- Auth Screen ---------- */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%); padding: 20px; }
.auth-card { background: var(--bg-secondary); border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 32px; }
.logo-icon { font-size: 3rem; margin-bottom: 8px; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.auth-subtitle { color: var(--text-secondary); font-size: .9rem; margin-top: 4px; }

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

/* ---------- Sidebar ---------- */
.sidebar { width: var(--sidebar-width); background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: transform .3s ease; }
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.logo-icon-sm { font-size: 1.5rem; }
.sidebar-title { font-weight: 700; font-size: 1rem; }
.sidebar-toggle { display: none; background: none; border: none; font-size: 1.3rem; color: var(--text-secondary); margin-left: auto; }
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); color: var(--text-secondary); font-size: .9rem; font-weight: 500; transition: var(--transition); margin-bottom: 2px; }
.nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 1.15rem; width: 24px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: .9rem; }
.user-name { font-weight: 600; font-size: .85rem; }
.user-role { font-size: .75rem; color: var(--text-muted); }

/* ---------- Main Content ---------- */
.main-content { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }

/* ---------- Top Bar ---------- */
.topbar { height: var(--topbar-height); background: var(--bg-secondary); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 50; }
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.3rem; }
.page-title { font-size: 1.1rem; font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* ---------- Clock ---------- */
.topbar-clock { font-size: .85rem; font-weight: 500; color: var(--text-secondary); padding: 6px 12px; background: var(--bg-tertiary); border-radius: var(--radius-sm); white-space: nowrap; letter-spacing: .3px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 0; }

/* ---------- Notifications ---------- */
.notification-bell { position: relative; cursor: pointer; font-size: 1.3rem; padding: 6px; border-radius: 50%; transition: var(--transition); }
.notification-bell:hover { background: var(--bg-tertiary); }
.badge { position: absolute; top: 0; right: 0; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.notification-dropdown { position: absolute; top: 100%; right: 0; width: 360px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 200; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .85rem; cursor: pointer; transition: var(--transition); }
.notif-item:hover { background: var(--bg-tertiary); }
.notif-item.unread { background: var(--accent-light); }
.notif-item .notif-title { font-weight: 600; margin-bottom: 2px; }
.notif-item .notif-time { color: var(--text-muted); font-size: .75rem; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: .85rem; }

/* ---------- Pages ---------- */
.pages-container { flex: 1; padding: 24px; overflow-y: auto; }
.page { display: none; }
.page.active { display: block; }

/* ---------- Cards ---------- */
.card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: .95rem; font-weight: 600; }
.card-body { padding: 16px 20px; }

/* ---------- Stats Grid ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-info { flex: 1; }
.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: .8rem; color: var(--text-secondary); }

.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }

/* ---------- Chart ---------- */
.chart-container { display: flex; gap: 12px; flex-wrap: wrap; }
.chart-bar { display: flex; align-items: center; gap: 8px; }
.chart-bar-color { width: 14px; height: 14px; border-radius: 3px; }
.chart-bar-label { font-size: .8rem; color: var(--text-secondary); }
.chart-bar-value { font-size: .85rem; font-weight: 600; }

/* ---------- Kanban ---------- */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; min-height: 500px; }
.kanban-column { min-width: 280px; max-width: 320px; flex: 1; background: var(--bg-tertiary); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 140px); }
.column-header { padding: 14px 16px; font-weight: 600; font-size: .85rem; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); border-radius: var(--radius) var(--radius) 0 0; }
.column-dot { width: 10px; height: 10px; border-radius: 50%; }
.column-count { margin-left: auto; background: var(--bg-tertiary); padding: 1px 8px; border-radius: 10px; font-size: .75rem; color: var(--text-secondary); }
.column-body { flex: 1; padding: 12px; overflow-y: auto; min-height: 60px; }
.column-body.drag-over { background: #dbeafe; border-radius: var(--radius-sm); }

.kanban-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 10px; cursor: grab; transition: box-shadow .2s, transform .15s; }
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card.dragging { opacity: .5; transform: rotate(2deg); }
.kanban-card-title { font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--text-muted); }
.priority-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .7rem; font-weight: 600; color: #fff; }
.kanban-card-deadline { font-size: .75rem; color: var(--text-secondary); }
.kanban-card-tags { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.tag { background: var(--bg-tertiary); padding: 1px 8px; border-radius: 4px; font-size: .7rem; color: var(--text-secondary); }

/* ---------- Calendar ---------- */
.calendar-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.calendar-controls h3 { min-width: 180px; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-header { background: var(--bg-tertiary); padding: 10px; text-align: center; font-size: .8rem; font-weight: 600; color: var(--text-secondary); }
.cal-day { background: var(--bg-secondary); min-height: 100px; padding: 6px; cursor: pointer; transition: var(--transition); }
.cal-day:hover { background: var(--accent-light); }
.cal-day.today { background: var(--accent-light); }
.cal-day.other-month { opacity: .4; }
.cal-day-number { font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.cal-day.today .cal-day-number { color: var(--accent); }
.cal-event { font-size: .7rem; padding: 2px 6px; margin-bottom: 2px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-event.task { background: #dbeafe; color: #1e40af; }
.cal-event.reminder { background: #fef3c7; color: #92400e; }
.cal-event.overdue { background: #fecaca; color: #991b1b; }

/* ---------- Table ---------- */
.filters-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.filter-input, .filter-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); font-size: .85rem; outline: none; }
.filter-input { min-width: 200px; }
.filter-input:focus, .filter-select:focus { border-color: var(--accent); }
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: .8rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; background: var(--bg-tertiary); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.data-table tr:hover td { background: var(--bg-tertiary); }
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: .75rem; font-weight: 600; }
.empty-text { color: var(--text-muted); font-size: .9rem; padding: 24px; text-align: center; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination .btn { min-width: 36px; justify-content: center; padding: 6px 10px; }
.pagination .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .btn:disabled { opacity: .4; cursor: default; }

/* ---------- Admin ---------- */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn { padding: 12px 24px; background: none; border: none; font-size: .9rem; font-weight: 500; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Reminders List ---------- */
.reminders-list { display: flex; flex-direction: column; gap: 10px; }
.reminder-card { display: flex; align-items: center; gap: 16px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; transition: var(--transition); }
.reminder-card:hover { box-shadow: var(--shadow); }
.reminder-icon { font-size: 1.5rem; width: 40px; text-align: center; }
.reminder-info { flex: 1; }
.reminder-text { font-weight: 500; }
.reminder-meta { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.reminder-actions { display: flex; gap: 6px; }
.status-indicator { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-pending { background: var(--warning); }
.status-sent { background: var(--info); }
.status-read { background: var(--success); }
.status-overdue { background: var(--danger); }

/* ---------- Modals ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .15s ease; }
.modal { background: var(--bg-secondary); border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp .2s ease; }
.modal-lg { max-width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.1rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); padding: 4px 8px; line-height: 1; border-radius: 6px; transition: var(--transition); }
.modal-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }

/* ---------- Task Detail ---------- */
.detail-field { margin-bottom: 12px; }
.detail-label { font-size: .8rem; color: var(--text-muted); margin-bottom: 2px; }
.detail-value { font-size: .9rem; }
.comment-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.comment-author { font-weight: 600; font-size: .85rem; }
.comment-time { font-size: .75rem; color: var(--text-muted); }
.comment-text { font-size: .85rem; color: var(--text-secondary); }

/* ---------- Timeline ---------- */
.timeline-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.timeline-controls h3 { min-width: 200px; text-align: center; font-size: .95rem; }
.timeline-container { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-secondary); }
.timeline-header, .timeline-body { display: flex; min-width: max-content; }
.timeline-header { background: var(--bg-tertiary); border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 1; }
.tl-day-label { padding: 8px 4px; font-size: .7rem; font-weight: 600; color: var(--text-secondary); text-align: center; border-right: 1px solid var(--border); white-space: nowrap; flex-shrink: 0; }
.tl-day-label b { color: var(--accent); }
.tl-row { display: flex; border-bottom: 1px solid var(--border); }
.tl-row:hover { background: var(--accent-light); }
.tl-task-label { min-width: 120px; max-width: 120px; padding: 6px 8px; font-size: .8rem; display: flex; align-items: center; gap: 6px; border-right: 1px solid var(--border); overflow: hidden; flex-shrink: 0; background: var(--bg-secondary); z-index: 1; }
.tl-task-name { cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tl-task-name:hover { color: var(--accent); }
.tl-bar { width: 4px; height: 100%; border-radius: 2px; flex-shrink: 0; }
.tl-bar-container { flex: 1; position: relative; height: 36px; min-width: 0; }
.tl-bar-fill { position: absolute; top: 4px; height: 28px; border-radius: 4px; cursor: pointer; transition: opacity .15s; display: flex; align-items: center; padding: 0 8px; font-size: .7rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-bar-fill:hover { opacity: .85; }

/* ---------- Status counts bar ---------- */
.status-counts-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 12px 16px; background: var(--bg-tertiary); border-radius: var(--radius-sm); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar-toggle, .mobile-menu-btn { display: block; }
    .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .dashboard-row { grid-template-columns: 1fr; }
    .kanban-board { flex-direction: column; }
    .kanban-column { max-width: 100%; max-height: none; min-width: auto; }
    .notification-dropdown { width: 300px; right: -60px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filters-bar { flex-direction: column; }
    .filter-input { width: 100%; }
}

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }