/* ============================================================
   TimeTrack — Design System
   Inherits from xdinamic: Urbanist, dark-first, accent #3b82f6
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Urbanist:wght@300;400;500;600;700&display=swap');

:root {
  --bg:        #0f1117;
  --bg2:       #1a1d27;
  --bg3:       #252836;
  --bg-hover:  #2a2d3a;
  --border:    #2e3140;
  --t1:        #f0f1f5;
  --t2:        #a0a4b8;
  --t3:        #6b6f82;
  --accent:    #3b82f6;
  --accent-h:  #2563eb;
  --success:   #22c55e;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --purple:    #8b5cf6;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 2px 8px rgba(0,0,0,.3);
  --font:      'Urbanist', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:      'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
  --bg:        #f8f9fb;
  --bg2:       #ffffff;
  --bg3:       #eef0f4;
  --bg-hover:  #e8eaef;
  --border:    #d5d8e0;
  --t1:        #1a1d27;
  --t2:        #5a5e70;
  --t3:        #9a9eb0;
  --shadow:    0 2px 8px rgba(0,0,0,.08);
}

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

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--t1);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

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

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--t1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo h1 svg { color: var(--accent); }
.sidebar-logo .sub { font-size: 11px; color: var(--t3); margin-top: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--t2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--t1); }
.nav-item.active {
  color: var(--accent);
  background: rgba(59,130,246,.08);
  border-left-color: var(--accent);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-bottom {
  margin-top: auto;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.topbar h2 { font-size: 16px; font-weight: 600; }

/* ─── Timer bar ───────────────────────────────────────────── */
.timer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.timer-desc {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--t1);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}
.timer-desc:focus { border-color: var(--accent); }
.timer-desc::placeholder { color: var(--t3); }

.timer-project {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--t2);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  min-width: 160px;
}

.timer-display {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--t1);
  min-width: 100px;
  text-align: center;
  letter-spacing: 1px;
}
.timer-display.running { color: var(--success); }

.btn-timer {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s;
}
.btn-timer:active { transform: scale(.92); }
.btn-timer.start { background: var(--accent); color: #fff; }
.btn-timer.stop  { background: var(--danger); color: #fff; }

/* ─── Content ─────────────────────────────────────────────── */
.content { padding: 24px; flex: 1; }

/* ─── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--t2);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ─── Entry rows ──────────────────────────────────────────── */
.entry-list { display: flex; flex-direction: column; gap: 2px; }

.entry-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background .1s;
}
.entry-row:hover { background: var(--bg-hover); }

.entry-project {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
.entry-project .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.entry-desc { flex: 1; font-size: 13px; color: var(--t1); }
.entry-time {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--t2);
}
.entry-duration {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  min-width: 70px;
  text-align: right;
}
.entry-actions { display: flex; gap: 4px; }

/* ─── Date divider ────────────────────────────────────────── */
.date-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  margin-top: 12px;
}
.date-divider .date-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--t2);
}
.date-divider .date-total {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--t3);
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--t1);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { background: var(--bg-hover); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-icon {
  width: 28px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  background: transparent; border: none; color: var(--t3);
  cursor: pointer;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--t1); }

/* ─── Stat cards ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.stat-label { font-size: 11px; color: var(--t3); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--t3); margin-top: 2px; }

/* ─── Login ───────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 380px;
  max-width: 90vw;
}
.login-box h1 { text-align: center; margin-bottom: 24px; font-size: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; color: var(--t2); margin-bottom: 4px; font-weight: 500; }
.form-group input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--t1);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}
.form-group input:focus { border-color: var(--accent); }
.form-error { color: var(--danger); font-size: 12px; margin-top: 8px; text-align: center; }

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

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .timer-bar { flex-wrap: wrap; }
  .timer-desc { min-width: 100%; order: -1; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
