/* ==========================================================
   Time Tracker — design tokens
   Palette: indigo/violet base with a rotating "project color"
   accent system (rose, amber, teal, sky, violet, lime) used to
   color-tag projects consistently everywhere they appear.
   ========================================================== */
:root {
  --brand: #4f46e5;         /* indigo 600 */
  --brand-dark: #3730a3;    /* indigo 800 */
  --brand-light: #eef2ff;   /* indigo 50 */
  --brand-mid: #818cf8;     /* indigo 400 */

  --accent: #fb7185;        /* rose 400 */
  --accent-dark: #e11d48;

  --bg: #f6f5fd;
  --card: #ffffff;
  --text: #1e1b2e;
  --muted: #6b7280;
  --border: #e6e4f5;

  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #f43f5e;
  --danger-bg: #ffe4e6;
  --info-bg: #dbeafe;
  --info: #2563eb;

  /* Rotating project-color palette */
  --proj-0: #6366f1; /* indigo */
  --proj-1: #fb7185; /* rose */
  --proj-2: #f59e0b; /* amber */
  --proj-3: #14b8a6; /* teal */
  --proj-4: #38bdf8; /* sky */
  --proj-5: #a855f7; /* violet */
  --proj-6: #84cc16; /* lime */
  --proj-7: #f97316; /* orange */

  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(30, 27, 46, 0.06);
  --shadow-md: 0 8px 24px rgba(79, 70, 229, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand {
  font-family: 'Poppins', 'Inter', sans-serif;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

*:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #4338ca 0%, #4f46e5 45%, #6d28d9 100%);
  color: #fff;
  padding: 22px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.sidebar nav a {
  display: block;
  padding: 10px 14px;
  color: rgba(255,255,255,0.82);
  font-size: 0.93rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar nav a:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
}
.sidebar nav a.active {
  background: #fff;
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.sidebar .user-box {
  margin: 20px 12px 0;
  padding: 14px 16px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
}
.sidebar .user-box a { color: #fff; font-weight: 600; }

/* Mobile top bar (hidden on desktop) */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #4338ca, #6d28d9);
  color: #fff;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}
.mobile-topbar .brand { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.05rem; }
.hamburger-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 46, 0.5);
  z-index: 19;
}

/* ---------- Main content ---------- */
.main { flex: 1; padding: 30px; max-width: 1200px; min-width: 0; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h1 { font-size: 1.55rem; margin: 0; font-weight: 700; color: var(--brand-dark); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  border-top: 4px solid var(--brand);
  box-shadow: var(--shadow-sm);
}
.stat-box:nth-child(2) { border-top-color: var(--proj-1); }
.stat-box:nth-child(3) { border-top-color: var(--proj-3); }
.stat-box:nth-child(4) { border-top-color: var(--proj-2); }
.stat-box .label { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-box .value { font-size: 1.75rem; font-weight: 700; margin-top: 4px; color: var(--text); }

/* ---------- Tables (horizontally scrollable on small screens) ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 480px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--brand-light); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--accent-dark); }
.btn-secondary { background: #eef0f7; color: var(--text); }
.btn-secondary:hover { background: #dfe1f0; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; text-align: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge-success { background: var(--success-bg); color: #047857; }
.badge-warning { background: var(--warning-bg); color: #b45309; }
.badge-danger { background: var(--danger-bg); color: #be123c; }
.badge-secondary { background: #eef0f7; color: var(--muted); }
.badge-light { background: #f0f0f0; color: var(--muted); }

/* ---------- Project color chips (the signature touch) ---------- */
.proj-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}
.proj-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--brand-light);
}
.proj-c0 { background: var(--proj-0); }
.proj-c1 { background: var(--proj-1); }
.proj-c2 { background: var(--proj-2); }
.proj-c3 { background: var(--proj-3); }
.proj-c4 { background: var(--proj-4); }
.proj-c5 { background: var(--proj-5); }
.proj-c6 { background: var(--proj-6); }
.proj-c7 { background: var(--proj-7); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.86rem; font-weight: 600; color: var(--text); }
.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.form-row { display: flex; gap: 15px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }

/* ---------- Alerts ---------- */
.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 0.9rem; font-weight: 500; }
.alert-success { background: var(--success-bg); color: #047857; }
.alert-danger { background: var(--danger-bg); color: #be123c; }
.alert-info { background: var(--info-bg); color: var(--info); }

/* ---------- Login page ---------- */
.login-wrapper {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(160deg, #4338ca 0%, #4f46e5 40%, #7c3aed 75%, #db2777 100%);
  padding: 20px;
}
.login-card {
  background: var(--card); padding: 40px; border-radius: 18px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(30, 27, 46, 0.3);
}
.login-card h1 {
  text-align: center; margin-top: 0; color: var(--brand-dark); font-size: 1.5rem; font-weight: 700;
}

/* ---------- Clock in/out page ---------- */
.clock-box { text-align: center; padding: 32px 20px; }
.clock-box .time {
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 700;
  color: var(--brand-dark);
  font-family: 'Poppins', sans-serif;
}
.clock-box .status { color: var(--muted); margin-bottom: 20px; }

/* ---------- Utility ---------- */
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ==========================================================
   Responsive breakpoints
   ========================================================== */
@media (max-width: 900px) {
  .main { padding: 20px 16px; }
  .card { padding: 18px; }
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }

  .mobile-topbar { display: flex; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 260px;
    box-shadow: 8px 0 30px rgba(0,0,0,0.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .main { padding: 18px 14px; }
  .page-header h1 { font-size: 1.3rem; }

  .login-card { padding: 28px 22px; }

  .form-row { gap: 10px; }
  .form-row .form-group { min-width: 100%; }

  .stat-box .value { font-size: 1.4rem; }
}

@media (max-width: 480px) {
  table { font-size: 0.85rem; }
}
