/* ============================================
   DailyDrive — February Habit Tracker
   Modern, dark-themed habit tracker UI
   ============================================ */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --bg-input: #16162a;
  --border: #2a2a4a;
  --border-light: #3a3a5a;
  --text-primary: #f0f0f5;
  --text-secondary: #9898b8;
  --text-muted: #6868a0;
  --accent: #7c5cff;
  --accent-light: #9b7fff;
  --accent-dark: #5a3ed4;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --gradient-1: linear-gradient(135deg, #7c5cff, #4cc9f0);
  --gradient-2: linear-gradient(135deg, #f72585, #b5179e);
  --gradient-3: linear-gradient(135deg, #22c55e, #06b6d4);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  overflow-x: hidden;
  width: 100%;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ============ HEADER ============ */
.header {
  display: flex;
  align-items: center;
  padding: 16px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  gap: 16px;
}

.desktop-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Hamburger button (hidden on desktop) ---- */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
}
.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ---- Mobile streak (hidden on desktop) ---- */
.mobile-streak {
  display: none;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.mobile-streak-fire {
  font-size: 0.95rem;
  line-height: 1;
}

.mobile-streak-count {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--warning);
  line-height: 1;
}

/* ---- Sidebar overlay + drawer (hidden on desktop) ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
}
.sidebar-overlay.show { display: block; }

.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 270px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 300;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.sidebar-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1;
}

.sidebar-btn {
  width: 100%;
  justify-content: center;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.sidebar-username {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.logo-img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.logo-img-lg {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 28px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}


.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--warning);
}

.streak-icon {
  font-size: 1.1rem;
}

/* ============ BUTTONS ============ */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.4);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 10px 24px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.tab:hover {
  color: var(--text-secondary);
  background: var(--bg-card);
}

.tab.active {
  color: var(--accent-light);
  background: rgba(124, 92, 255, 0.12);
}

/* ============ MAIN ============ */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 32px 60px;
  overflow-x: hidden;
}

.tab-content {
  display: none;
  max-width: 100%;
  overflow: hidden;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ TODAY'S CARD ============ */
.today-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.today-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.today-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.today-progress-ring {
  position: relative;
  width: 70px;
  height: 70px;
}

.today-progress-ring svg {
  transform: rotate(-90deg);
  width: 70px;
  height: 70px;
}

.ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 263.9;
  stroke-dashoffset: 263.9;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-light);
}

.today-habits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.habit-check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.habit-check-item:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.habit-check-item.checked {
  border-color: var(--success);
  background: var(--success-bg);
}

.habit-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
  flex-shrink: 0;
}

.habit-check-item.checked .habit-checkbox {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.habit-check-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.habit-check-icon {
  font-size: 1.2rem;
}

/* ============ CALENDAR ============ */
.calendar-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.calendar-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-complete { background: var(--success); }
.legend-partial { background: var(--warning); }
.legend-missed { background: var(--danger); }
.legend-future { background: var(--border); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  min-height: 64px;
}

.calendar-day:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.calendar-day.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}

.calendar-day.empty:hover {
  transform: none;
  box-shadow: none;
}

.calendar-day .day-num {
  font-size: 0.95rem;
  font-weight: 700;
}

.calendar-day .day-status {
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 2px;
}

.calendar-day.complete {
  border-color: var(--success);
  background: var(--success-bg);
}

.calendar-day.complete .day-num { color: var(--success); }

.calendar-day.partial {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.calendar-day.partial .day-num { color: var(--warning); }

.calendar-day.missed {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.calendar-day.missed .day-num { color: var(--danger); }

.calendar-day.today {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow);
}

.calendar-day.future {
  opacity: 0.5;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.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;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-body {
  padding: 20px 24px;
}

.modal-habit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.modal-habit-item:hover {
  border-color: var(--accent);
}

.modal-habit-item.checked {
  border-color: var(--success);
  background: var(--success-bg);
}

/* ============ ANALYTICS ============ */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  overflow: hidden;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
  overflow: hidden;
  min-width: 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-light);
  margin-bottom: 4px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  overflow: hidden;
  min-width: 0;
}

.chart-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.chart-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.chart-wrapper.chart-wrapper-doughnut {
  width: 70%;
  margin: 0 auto;
}

.chart-wrapper canvas {
  max-width: 100%;
  display: block;
}

.chart-card.wide {
  grid-column: span 2;
}

/* ============ HEATMAP ============ */
.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  position: relative;
  cursor: help;
}

.heatmap-cell::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}

.heatmap-cell:hover::after {
  opacity: 1;
}

/* ============ SETTINGS ============ */
.settings-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 700px;
}

.settings-panel h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.settings-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.habit-list-settings {
  margin-bottom: 24px;
}

.habit-setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: var(--transition);
}

.habit-setting-item:hover {
  border-color: var(--border-light);
}

.habit-setting-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 0.9rem;
}

.delete-habit-btn {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.delete-habit-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

.add-habit-form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.add-habit-form input,
.add-habit-form select {
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition: var(--transition);
}

.add-habit-form input {
  flex: 1;
  min-width: 200px;
}

.add-habit-form input:focus,
.add-habit-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}

.add-habit-form select {
  min-width: 150px;
}

.settings-actions {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* ============ TOAST NOTIFICATIONS ============ */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  gap: 8px;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.toast.toast-warning::before { background: var(--danger); }
.toast.toast-success::before { background: var(--success); }
.toast.toast-info::before { background: var(--accent); }

.toast-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.toast-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  flex-shrink: 0;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  animation: toastTimer linear forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

@keyframes toastTimer {
  from { width: 100%; }
  to { width: 0%; }
}

/* ============ FOOTER ============ */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .chart-card.wide {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  /* Show hamburger + mobile streak, hide desktop actions */
  .hamburger { display: flex; }
  .mobile-streak { display: flex; }
  .desktop-actions { display: none !important; }
  .subtitle { display: none; }

  .header {
    padding: 10px 14px;
    gap: 12px;
  }
  .header .logo { margin-right: auto; }
  .logo h1 {
    font-size: 1.15rem;
  }
  .btn-primary {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
  .user-avatar {
    width: 28px;
    height: 28px;
  }
  .main {
    padding: 12px 12px 40px;
  }
  .tabs {
    padding: 6px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tab {
    padding: 8px 12px;
    font-size: 0.75rem;
    white-space: nowrap;
  }
  .today-card {
    padding: 16px;
    margin-bottom: 20px;
  }
  .today-header h2 {
    font-size: 1rem;
  }
  .today-progress-ring {
    width: 56px;
    height: 56px;
  }
  .today-progress-ring svg {
    width: 56px;
    height: 56px;
  }
  .ring-text {
    font-size: 0.75rem;
  }
  .today-habits {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .habit-check-item {
    padding: 12px 14px;
    gap: 10px;
  }
  .habit-check-icon {
    font-size: 1rem;
  }
  .habit-check-label {
    font-size: 0.85rem;
  }
  .habit-checkbox {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
  .section-title {
    font-size: 1rem;
  }
  .calendar-grid {
    gap: 4px;
  }
  .calendar-day {
    min-height: 44px;
    border-radius: 6px;
  }
  .calendar-day .day-num {
    font-size: 0.75rem;
  }
  .calendar-day .day-status {
    font-size: 0.5rem;
  }
  .calendar-day-header {
    font-size: 0.65rem;
    padding: 4px 0;
  }
  .calendar-legend {
    gap: 10px;
    font-size: 0.7rem;
  }
  .analytics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 14px 10px;
  }
  .stat-icon {
    font-size: 1.3rem;
    margin-bottom: 4px;
  }
  .stat-value {
    font-size: 0.95rem;
  }
  .stat-label {
    font-size: 0.65rem;
  }
  .chart-card {
    padding: 14px;
    grid-column: span 2;
  }
  .chart-card.wide {
    grid-column: span 2;
  }
  .chart-card h3 {
    font-size: 0.8rem;
  }
  .chart-card canvas {
    width: 100% !important;
  }
  .settings-panel {
    padding: 20px 16px;
  }
  .add-habit-form {
    flex-direction: column;
  }
  .add-habit-form input,
  .add-habit-form select {
    min-width: 100%;
  }
  .modal {
    max-width: 95vw;
    margin: 12px;
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 14px 16px;
  }
  #toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  .toast {
    padding: 12px 14px;
  }
  .toast-title {
    font-size: 0.8rem;
  }
  .toast-message {
    font-size: 0.75rem;
  }
  .footer {
    font-size: 0.7rem;
    padding: 16px;
  }
}

@media (max-width: 380px) {
  .header {
    padding: 10px 12px;
  }
  .logo h1 {
    font-size: 1.1rem;
  }
  .btn-primary {
    padding: 7px 12px;
    font-size: 0.75rem;
  }
  .main {
    padding: 10px 8px 32px;
  }
  .today-card {
    padding: 14px;
  }
  .today-header h2 {
    font-size: 0.9rem;
  }
  .analytics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .chart-card,
  .chart-card.wide {
    grid-column: span 2;
  }
  .stat-card {
    padding: 12px 8px;
  }
  .stat-value {
    font-size: 0.85rem;
  }
}

/* ============ AUTH SCREEN ============ */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg-primary);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.auth-logo .logo-img-lg {
  width: 48px;
  height: 48px;
}

.auth-logo .logo-icon {
  font-size: 36px;
}

.auth-logo h1 {
  font-size: 2rem;
  font-weight: 900;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 24px;
}

.auth-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 32px;
  line-height: 1.5;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  background: white;
  color: #333;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 12px;
}

.btn-google:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
}

.btn-ghost:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-input);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.auth-note {
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============ USER MENU ============ */
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
}


/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}
