/* ============================================================
   Start Pomodoro — style.css
   Mobile-first · Dark mode · Inter font
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #0d1b2a;
  --bg-2:         #112236;
  --card:         #1a2e45;
  --card-hover:   #1f3652;
  --border:       #243e58;
  --primary:      #2563eb;
  --primary-h:    #1d4ed8;
  --primary-lt:   #3b82f6;
  --secondary:    #60a5fa;
  --accent:       #93c5fd;
  --green:        #22c55e;
  --green-h:      #16a34a;
  --red:          #ef4444;
  --yellow:       #f59e0b;
  --text:         #f0f6ff;
  --text-muted:   #94a3b8;
  --text-dim:     #64748b;
  --radius:       14px;
  --radius-sm:    8px;
  --shadow:       0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.55);
  --transition:   .22s ease;
  --sidebar-w:    260px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-lt); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, textarea, select { font-family: inherit; outline: none; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Layout Shell ──────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 28px 22px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-logo .logo-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.2;
}
.sidebar-logo .logo-text span { color: var(--primary-lt); }

.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  padding: 8px 10px 4px;
  margin-top: 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  cursor: pointer;
}
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  transition: background var(--transition);
}
.user-chip:hover { background: var(--card-hover); }
.user-chip .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.user-chip .avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip .user-info { flex: 1; min-width: 0; }
.user-chip .user-name {
  font-size: .85rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-chip .user-plan {
  font-size: .7rem; color: var(--text-muted);
}
.badge-premium {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: .6rem; font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  text-transform: uppercase;
}

/* ── Topbar (mobile) ───────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 90;
}
.topbar .topbar-logo {
  font-weight: 700; font-size: 1rem; color: var(--text);
}
.topbar .topbar-logo span { color: var(--primary-lt); }
.btn-menu {
  background: none;
  color: var(--text);
  font-size: 1.4rem;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.btn-menu:hover { background: var(--card); }

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ── Main content ──────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.page-content {
  flex: 1;
  padding: 24px 18px 40px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

/* ── Typography helpers ────────────────────────────────────── */
.page-title {
  font-size: 1.45rem; font-weight: 700;
  margin-bottom: 4px;
}
.page-sub {
  color: var(--text-muted); font-size: .9rem;
  margin-bottom: 28px;
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-sm { padding: 16px 20px; }
.card + .card { margin-top: 16px; }

/* ── Grid ──────────────────────────────────────────────────── */
.grid-2 { display: grid; gap: 16px; }
.grid-3 { display: grid; gap: 16px; }
.grid-4 { display: grid; gap: 16px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-h); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,99,235,.4); }
.btn-secondary {
  background: var(--card-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-green {
  background: var(--green);
  color: #fff;
}
.btn-green:hover { background: var(--green-h); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(34,197,94,.35); }
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { opacity: .88; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary-lt); color: var(--primary-lt); }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ── Form elements ─────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .82rem; font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: .9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}
.form-input::placeholder { color: var(--text-dim); }
.form-hint { font-size: .78rem; color: var(--text-dim); margin-top: 5px; }
.form-error { font-size: .8rem; color: var(--red); margin-top: 5px; }

/* Input with icon */
.input-wrap { position: relative; }
.input-wrap .form-input { padding-left: 42px; }
.input-wrap .input-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim); font-size: 1rem;
  pointer-events: none;
}
.input-wrap .input-toggle {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim); background: none;
  font-size: .95rem; padding: 4px; cursor: pointer;
}

/* ── Alerts / Flash ────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .88rem;
  font-weight: 500;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 18px;
}
.alert-success { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: #4ade80; }
.alert-error   { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3);  color: #f87171; }
.alert-info    { background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); color: #fbbf24; }

/* ── Pomodoro Timer ────────────────────────────────────────── */
.timer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 32px 0 20px;
}
.timer-ring-wrap { position: relative; width: 240px; height: 240px; }
.timer-ring-wrap svg { transform: rotate(-90deg); }
.timer-ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.timer-ring-prog {
  fill: none;
  stroke: var(--primary-lt);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 691;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
.timer-ring-prog.break { stroke: var(--green); }
.timer-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.timer-time {
  font-size: 3rem; font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.timer-mode {
  font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted);
  margin-top: 2px;
}

.timer-controls { display: flex; gap: 12px; align-items: center; }
.btn-timer-main {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(37,99,235,.4);
}
.btn-timer-main:hover { background: var(--primary-h); transform: scale(1.05); }
.btn-timer-main.running { background: var(--red); box-shadow: 0 4px 20px rgba(239,68,68,.4); }
.btn-timer-sec {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--card-hover);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-timer-sec:hover { background: var(--border); color: var(--text); }

/* Preset chips */
.preset-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
}
.chip {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: .8rem; font-weight: 600;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.chip:hover { border-color: var(--primary-lt); color: var(--primary-lt); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip.five-min {
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.3);
  color: var(--green);
}
.chip.five-min.active { background: var(--green); border-color: var(--green); color: #fff; }

/* Task input */
.task-input-wrap {
  width: 100%;
  max-width: 360px;
  position: relative;
}

/* ── Stat cards ────────────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); }
.stat-sub { font-size: .78rem; color: var(--text-dim); }
.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

/* ── Progress bar ──────────────────────────────────────────── */
.progress-wrap { margin-top: 8px; }
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  transition: width .5s ease;
}
.progress-fill.primary { background: var(--primary-lt); }
.progress-label {
  display: flex; justify-content: space-between;
  font-size: .75rem; color: var(--text-muted);
  margin-top: 5px;
}

/* ── History / Table ───────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.history-item:hover { background: var(--card-hover); }
.history-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--primary-lt);
}
.history-dot.done { background: var(--green); }
.history-dot.cancel { background: var(--red); }
.history-info { flex: 1; min-width: 0; }
.history-task { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: .76rem; color: var(--text-muted); margin-top: 2px; }
.history-badge {
  font-size: .72rem; font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-done    { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-cancel  { background: rgba(239,68,68,.15);  color: var(--red); }
.badge-running { background: rgba(59,130,246,.15); color: var(--primary-lt); }

/* ── Auth pages ────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-icon {
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin: 0 auto 12px;
}
.auth-logo h1 { font-size: 1.25rem; font-weight: 700; }
.auth-logo h1 span { color: var(--primary-lt); }
.auth-logo p { font-size: .84rem; color: var(--text-muted); margin-top: 4px; }
.auth-divider {
  text-align: center;
  color: var(--text-dim);
  font-size: .8rem;
  margin: 18px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%; width: calc(50% - 24px);
  height: 1px; background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }
.auth-footer { text-align: center; margin-top: 20px; font-size: .85rem; color: var(--text-muted); }

/* ── Premium / Pricing ─────────────────────────────────────── */
.pricing-grid { display: grid; gap: 16px; }
.pricing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  position: relative;
  transition: all var(--transition);
}
.pricing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pricing-card.featured {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(37,99,235,.12), rgba(30,58,138,.08));
}
.pricing-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: .7rem; font-weight: 700;
  padding: 4px 14px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
.pricing-name { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.pricing-price {
  font-size: 2.2rem; font-weight: 800; color: var(--text);
  margin: 8px 0 4px;
}
.pricing-price span { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.pricing-period { font-size: .8rem; color: var(--text-dim); margin-bottom: 20px; }
.pricing-features { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.pricing-feature {
  display: flex; align-items: center; gap: 10px;
  font-size: .86rem; color: var(--text-muted);
}
.pricing-feature .icon-check { color: var(--green); font-size: .95rem; }

/* ── Notification dot ──────────────────────────────────────── */
.notif-dot {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  position: absolute; top: 4px; right: 4px;
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,.5); }
  70%  { box-shadow: 0 0 0 14px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}
.fade-in { animation: fadeIn .35s ease both; }
.pulse   { animation: pulse-ring 2s infinite; }

/* ── Divider ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 16px;
  font-size: .88rem; font-weight: 600;
  color: var(--text-muted);
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary-lt); border-bottom-color: var(--primary-lt); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Toggle / Switch ───────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; }
.toggle {
  position: relative;
  width: 44px; height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 99px;
  transition: var(--transition);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  left: 3px; bottom: 3px;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary-lt);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive — tablet ───────────────────────────────────── */
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .timer-ring-wrap { width: 280px; height: 280px; }
  .timer-time { font-size: 3.4rem; }
}

/* ── Responsive — desktop ──────────────────────────────────── */
@media (min-width: 900px) {
  .sidebar { transform: translateX(0); }
  .topbar { display: none; }
  .sidebar-overlay { display: none !important; }
  .main { margin-left: var(--sidebar-w); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .page-content { padding: 36px 40px 60px; }
}

/* ── Responsive — large desktop ────────────────────────────── */
@media (min-width: 1200px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); max-width: 660px; }
}