/* ─────────────────────────────────────────
   styles.css — Timedesker
   All visual styles in one place.
   To change a color/font/spacing: edit here only.
   ───────────────────────────────────────── */

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

:root {
  --bg:#f7f6f3; --surface:#fff; --surface2:#f0ede8;
  --border:#e0dbd3; --border2:#ccc8c0;
  --text:#1a1917; --text2:#6b6860; --text3:#9a9790;
  --teal:#0d6e56; --teal-bg:#e1f5ee; --teal-mid:#1d9e75;
  --purple:#4a41b0; --purple-bg:#eeedfe;
  --amber:#7a4a0d; --amber-bg:#faeeda;
  --red:#c0392b; --red-bg:#fdecea;
  --running-bg:#d6f5ea; --paused-bg:#faeeda;
}

body {
  font-family:'IBM Plex Sans',sans-serif;
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  min-height:100vh;
}

/* ── LOADING ── */
#loadingScreen {
  display:flex; min-height:100vh;
  align-items:center; justify-content:center;
  font-family:'IBM Plex Mono',monospace;
  font-size:14px; color:var(--text3);
  flex-direction:column; gap:16px;
}

/* ── AUTH ── */
#authScreen { display:none; min-height:100vh; align-items:center; justify-content:center; }
#authScreen.visible { display:flex; }
.auth-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:16px; padding:40px 36px;
  width:100%; max-width:420px; text-align:center;
}
.auth-logo { font-family:'IBM Plex Mono',monospace; font-size:20px; font-weight:500; margin-bottom:6px; }
.auth-tagline { font-size:13px; color:var(--text3); margin-bottom:28px; }
#clerkAuthContainer { min-height:280px; }

/* ── APP ── */
#appScreen { display:none; }
#appScreen.visible { display:block; }
.app { max-width:820px; margin:0 auto; padding:24px 20px; }

/* ── TOPBAR ── */
.topbar { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; flex-wrap:wrap; gap:10px; }
.topbar-left { display:flex; align-items:center; gap:14px; }
.app-title { font-family:'IBM Plex Mono',monospace; font-size:15px; font-weight:500; letter-spacing:-0.02em; }
.date-nav { display:flex; align-items:center; gap:4px; }
.date-nav-btn { background:var(--surface); border:1px solid var(--border); border-radius:6px; padding:5px 10px; cursor:pointer; font-size:13px; color:var(--text2); line-height:1; }
.date-nav-btn:hover { background:var(--surface2); }
.date-label { font-size:13px; font-weight:500; padding:5px 12px; background:var(--surface); border:1px solid var(--border); border-radius:6px; min-width:130px; text-align:center; cursor:pointer; position:relative; }
#hiddenDate { position:absolute; opacity:0; width:100%; height:100%; top:0; left:0; cursor:pointer; }
.topbar-right { display:flex; gap:8px; align-items:center; }
.btn-outline { background:var(--surface); border:1px solid var(--border); border-radius:6px; padding:6px 12px; font-size:13px; cursor:pointer; color:var(--text); font-family:'IBM Plex Sans',sans-serif; }
.btn-outline:hover { background:var(--surface2); }
.btn-primary { background:var(--text); color:var(--bg); border:1px solid var(--text); border-radius:6px; padding:6px 12px; font-size:13px; cursor:pointer; font-family:'IBM Plex Sans',sans-serif; }
.btn-primary:hover { opacity:0.85; }

/* ── USER MENU ── */
.user-menu { position:relative; }
.user-pill { display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:99px; padding:4px 10px 4px 4px; cursor:pointer; }
.user-pill:hover { background:var(--surface2); }
.user-avatar { width:26px; height:26px; border-radius:50%; background:var(--purple-bg); color:var(--purple); font-size:11px; font-weight:500; display:flex; align-items:center; justify-content:center; }
.user-name { font-size:13px; color:var(--text2); }
.user-dropdown { display:none; position:absolute; top:calc(100% + 6px); right:0; background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:6px; min-width:180px; z-index:50; box-shadow:0 4px 16px rgba(0,0,0,.08); }
.user-dropdown.open { display:block; }
.dropdown-user-info { padding:8px 10px; font-size:12px; color:var(--text3); border-bottom:1px solid var(--border); margin-bottom:4px; word-break:break-all; }
.dropdown-item { padding:8px 10px; font-size:13px; border-radius:5px; cursor:pointer; color:var(--text2); }
.dropdown-item:hover { background:var(--surface2); color:var(--text); }
.dropdown-item.danger:hover { background:var(--red-bg); color:var(--red); }

/* ── TABS ── */
.tabs { display:flex; gap:2px; background:var(--surface2); border-radius:8px; padding:3px; width:fit-content; margin-bottom:20px; flex-wrap:wrap; }
.tab { padding:6px 14px; border-radius:6px; cursor:pointer; font-size:13px; color:var(--text2); }
.tab:hover { color:var(--text); }
.tab.active { background:var(--surface); color:var(--text); font-weight:500; border:1px solid var(--border); }

/* ── METRICS ── */
.metric-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:20px; }
.metric-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:14px 16px; }
.metric-label { font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--text3); margin-bottom:6px; }
.metric-value { font-family:'IBM Plex Mono',monospace; font-size:22px; font-weight:500; line-height:1; }
.metric-value.teal { color:var(--teal); }
.metric-value.purple { color:var(--purple); }
.metric-value.amber { color:var(--amber); }
.metric-sub { font-size:11px; color:var(--text3); margin-top:4px; }

/* ── PROJECT BLOCKS ── */
.project-block { background:var(--surface); border:1px solid var(--border); border-radius:10px; margin-bottom:12px; overflow:hidden; transition:box-shadow .15s, opacity .15s; }
.project-block.dragging { opacity:.5; box-shadow:0 4px 20px rgba(0,0,0,.15); }
.project-block.drag-over { box-shadow:0 0 0 2px var(--teal-mid); }
.project-block.shared-project { border-color:#9fe1cb; }

.project-header { display:flex; align-items:center; gap:8px; padding:10px 14px; background:var(--surface2); border-bottom:1px solid var(--border); flex-wrap:wrap; cursor:default; }
.drag-handle { color:var(--text3); cursor:grab; font-size:16px; padding:0 2px; user-select:none; line-height:1; flex-shrink:0; }
.drag-handle:active { cursor:grabbing; }
.project-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.project-name-wrap { flex:1; display:flex; align-items:center; gap:8px; min-width:0; }
.project-name { font-weight:500; font-size:14px; outline:none; background:transparent; border:none; color:var(--text); font-family:'IBM Plex Sans',sans-serif; min-width:40px; }
.project-name:focus { background:var(--surface); border-radius:4px; padding:1px 6px; outline:2px solid var(--border2); }
.project-name:empty:before { content:attr(data-placeholder); color:var(--text3); pointer-events:none; }
.task-name:empty:before { content:attr(data-placeholder); color:var(--text3); pointer-events:none; }
.shared-badge { font-size:10px; background:var(--teal-bg); color:var(--teal); border:1px solid #9fe1cb; border-radius:99px; padding:1px 7px; white-space:nowrap; }
.project-total { font-family:'IBM Plex Mono',monospace; font-size:13px; color:var(--text2); white-space:nowrap; }
.proj-btn { background:transparent; border:1px solid var(--border); border-radius:5px; padding:3px 8px; font-size:12px; cursor:pointer; color:var(--text2); font-family:'IBM Plex Sans',sans-serif; white-space:nowrap; }
.proj-btn:hover { background:var(--surface); color:var(--text); }
.proj-share-btn { background:transparent; border:1px solid #9fe1cb; border-radius:5px; padding:3px 8px; font-size:12px; cursor:pointer; color:var(--teal); font-family:'IBM Plex Sans',sans-serif; }
.proj-share-btn:hover { background:var(--teal-bg); }
.proj-delete { background:transparent; border:none; font-size:16px; cursor:pointer; color:var(--text3); padding:2px 4px; line-height:1; }
.proj-delete:hover { color:var(--red); }

/* ── TASK ROWS ── */
.task-row { display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid var(--border); transition:background .1s; position:relative; }
.task-row:last-child { border-bottom:none; }
.task-row:hover { background:#faf9f7; }
.task-row.running { background:var(--running-bg); }
.task-row.running:hover { background:#c8f0e0; }
.task-row.paused { background:var(--paused-bg); }
.task-row.paused:hover { background:#f5d8a0; }
.task-row.dragging-task { opacity:.4; }
.task-row.drag-over-task { border-top:2px solid var(--teal-mid); }

.task-drag-handle { color:var(--text3); cursor:grab; font-size:14px; padding:0 2px; user-select:none; opacity:0; transition:opacity .1s; flex-shrink:0; }
.task-row:hover .task-drag-handle { opacity:1; }
.task-drag-handle:active { cursor:grabbing; }

.check-box { width:16px; height:16px; border-radius:4px; border:1.5px solid var(--border2); flex-shrink:0; cursor:pointer; display:flex; align-items:center; justify-content:center; background:var(--surface); }
.check-box.done { background:var(--teal-mid); border-color:var(--teal-mid); }
.check-box.done::after { content:''; display:block; width:8px; height:5px; border-left:1.5px solid white; border-bottom:1.5px solid white; transform:rotate(-45deg) translate(1px,-1px); }

.task-name { flex:1; font-size:13px; outline:none; background:transparent; cursor:text; min-width:0; }
.task-name:focus { background:var(--surface); border-radius:4px; padding:1px 6px; outline:2px solid var(--border2); }
.task-name.done { text-decoration:line-through; color:var(--text3); }

.time-chip { font-family:'IBM Plex Mono',monospace; font-size:12px; color:var(--text2); background:var(--surface2); border:1px solid var(--border); padding:2px 8px; border-radius:99px; min-width:72px; text-align:center; white-space:nowrap; flex-shrink:0; }
.time-chip.running { background:var(--teal-bg); border-color:#9fe1cb; color:var(--teal); font-weight:500; }
.time-chip.paused  { background:var(--amber-bg); border-color:#f5c875; color:var(--amber); }

.task-actions { display:flex; align-items:center; gap:4px; flex-shrink:0; }

/* Play/Pause/Stop buttons */
.timer-btn { width:28px; height:28px; border-radius:50%; border:1px solid var(--border); background:var(--surface); cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.timer-btn:hover { background:var(--surface2); border-color:var(--border2); }
.play-icon { width:0; height:0; border-top:5px solid transparent; border-bottom:5px solid transparent; border-left:8px solid var(--text2); margin-left:2px; }
.pause-icon { display:flex; gap:2px; }
.pause-icon span { display:block; width:3px; height:9px; background:var(--amber); border-radius:1px; }
.stop-icon { width:9px; height:9px; background:var(--red); border-radius:2px; }

.task-del { background:transparent; border:none; font-size:15px; cursor:pointer; color:var(--text3); padding:2px 4px; opacity:0; transition:opacity .1s; }
.task-row:hover .task-del { opacity:1; }
.task-del:hover { color:var(--red); }

.add-task-row { padding:7px 14px; }
.add-task-link { font-size:12px; color:var(--text3); cursor:pointer; background:none; border:none; font-family:'IBM Plex Sans',sans-serif; }
.add-task-link:hover { color:var(--text2); }

/* ── BANNERS ── */
.error-banner { background:var(--red-bg); border:1px solid #f09595; border-radius:8px; padding:16px 18px; margin-bottom:14px; font-size:13px; color:var(--red); line-height:1.7; }
.rollover-banner { display:flex; align-items:center; justify-content:space-between; gap:12px; background:var(--amber-bg); border:1px solid #f5c875; border-radius:8px; padding:10px 14px; margin-bottom:14px; font-size:13px; flex-wrap:wrap; }
.rollover-banner-text { color:var(--amber); flex:1; }
.rollover-banner-text strong { font-weight:500; }
.rollover-btn { background:var(--amber); color:#fff; border:none; border-radius:6px; padding:6px 14px; font-size:13px; cursor:pointer; font-family:'IBM Plex Sans',sans-serif; white-space:nowrap; }
.rollover-btn:hover { opacity:.88; }
.rollover-dismiss { background:transparent; border:none; font-size:18px; cursor:pointer; color:var(--amber); padding:0 4px; line-height:1; }

/* ── SHARE MODAL ── */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.35); z-index:100; align-items:center; justify-content:center; }
.modal-overlay.open { display:flex; }
.modal { background:var(--surface); border-radius:12px; border:1px solid var(--border); padding:28px; width:100%; max-width:440px; margin:20px; }
.modal-title { font-size:15px; font-weight:500; margin-bottom:6px; }
.modal-sub { font-size:13px; color:var(--text2); margin-bottom:20px; line-height:1.5; }
.share-link-box { display:flex; gap:8px; margin-bottom:10px; }
.share-link-input { flex:1; font-size:11px; font-family:'IBM Plex Mono',monospace; background:var(--surface2); border:1px solid var(--border); border-radius:6px; padding:8px 10px; color:var(--text); outline:none; }
.modal-close { width:100%; margin-top:8px; background:transparent; border:1px solid var(--border); border-radius:6px; padding:8px; font-size:13px; cursor:pointer; color:var(--text2); font-family:'IBM Plex Sans',sans-serif; }
.modal-close:hover { background:var(--surface2); }

/* ── CALENDAR ── */
.cal-header { display:flex; align-items:center; gap:12px; margin-bottom:14px; }
.cal-month-label { font-size:15px; font-weight:500; flex:1; }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-day-label { text-align:center; font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--text3); padding-bottom:4px; }
.cal-day { background:var(--surface); border:1px solid var(--border); border-radius:8px; padding:8px 6px; cursor:pointer; min-height:60px; transition:background .1s; }
.cal-day:hover { background:var(--surface2); }
.cal-day.today { border-color:var(--teal-mid); background:var(--teal-bg); }
.cal-day.other-month { opacity:.35; }
.cal-day-num { font-size:13px; font-weight:500; margin-bottom:4px; }
.cal-day-time { font-family:'IBM Plex Mono',monospace; font-size:11px; color:var(--text2); }
.cal-day-bar { height:3px; background:var(--teal-mid); border-radius:2px; margin-top:5px; }

/* ── REPORTS ── */
.report-section { margin-bottom:24px; }
.report-title { font-size:13px; font-weight:500; color:var(--text2); text-transform:uppercase; letter-spacing:.06em; margin-bottom:12px; }
.report-row { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.report-row:last-child { border-bottom:none; }
.report-name { flex:1; font-size:14px; }
.report-bar-wrap { width:140px; height:6px; background:var(--surface2); border-radius:3px; overflow:hidden; }
.report-bar { height:100%; background:var(--teal-mid); border-radius:3px; }
.report-time { font-family:'IBM Plex Mono',monospace; font-size:13px; color:var(--text2); min-width:68px; text-align:right; }
.week-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.week-col { text-align:center; }
.week-day-label { font-size:11px; color:var(--text3); margin-bottom:6px; text-transform:uppercase; letter-spacing:.04em; }
.week-bar-wrap { height:80px; display:flex; align-items:flex-end; justify-content:center; margin-bottom:4px; }
.week-bar { width:24px; background:var(--teal-bg); border:1px solid #9fe1cb; border-radius:4px 4px 0 0; min-height:3px; }
.week-bar.today-bar { background:var(--teal-mid); border-color:var(--teal); }
.week-time { font-family:'IBM Plex Mono',monospace; font-size:10px; color:var(--text3); }

/* ── EMPTY / SHARED ── */
.empty-state { text-align:center; padding:40px 20px; color:var(--text3); font-size:14px; line-height:1.7; }
.empty-state p { margin-bottom:10px; }
.shared-task-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); }
.shared-task-row:last-child { border-bottom:none; }

.tab-content { display:none; }
.tab-content.active { display:block; }

@media (max-width:520px) {
  .metric-grid { grid-template-columns:1fr 1fr; }
  .metric-grid .metric-card:last-child { grid-column:span 2; }
  .topbar { flex-direction:column; align-items:flex-start; }
}
