/* ═══ Birthday Reminder — Responsive PWA CSS ═══ */
/* Mobile-first, dark/light theme, no frameworks */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #252836;
  --border: #2d3142;
  --text: #e4e6eb;
  --text2: #9ba1b0;
  --primary: #7c5cfc;
  --primary2: #9b7fff;
  --accent: #ff6b9d;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

[data-theme="light"] {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface2: #f0f1f5;
  --border: #e0e2ea;
  --text: #1a1d27;
  --text2: #6b7280;
  --primary: #6c4ce6;
  --primary2: #8b6ff0;
  --accent: #e91e63;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 60px; /* space for bottom nav */
}

/* ═══ Top App Bar ═══ */
.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.appbar h1 {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.appbar-actions { display: flex; gap: 8px; align-items: center; }

.back-btn {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.back-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ═══ Bottom Navigation (mobile app style) ═══ */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 8px 0;
  padding-bottom: env(safe-area-inset-bottom, 8px);
}
.bottomnav a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--text2);
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
  transition: color 0.2s;
}
.bottomnav a.active { color: var(--primary); }
.bottomnav a svg { width: 24px; height: 24px; }

/* ═══ Main Content ═══ */
.container { max-width: 600px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ═══ Dashboard ═══ */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.stat-card .num { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.stat-card .label { font-size: 0.7rem; color: var(--text2); margin-top: 2px; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══ Contact List ═══ */
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.contact-item:active { transform: scale(0.98); }
.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 1rem;
  flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-info .name { font-weight: 600; font-size: 0.95rem; }
.contact-info .meta { font-size: 0.75rem; color: var(--text2); margin-top: 2px; }
.contact-days {
  text-align: right;
  flex-shrink: 0;
}
.contact-days .days { font-weight: 700; color: var(--primary); font-size: 1.1rem; }
.contact-days .lbl { font-size: 0.65rem; color: var(--text2); }

/* ═══ Search Bar ═══ */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-bar input, .search-bar select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.search-bar input { flex: 1; }
.search-bar input:focus, .search-bar select:focus { border-color: var(--primary); }

/* ═══ FAB (Floating Action Button) ═══ */
.fab {
  position: fixed;
  bottom: 70px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: white;
  border: none;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(124,92,252,0.4);
  cursor: pointer;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.fab:active { transform: scale(0.9); }

/* ═══ Modal ═══ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.modal h2 { margin-bottom: 16px; font-size: 1.2rem; }

/* ═══ Form Elements ═══ */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text2);
  margin-bottom: 4px;
  font-weight: 600;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-full { width: 100%; margin-top: 8px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

/* ═══ Calendar ═══ */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-grid .cal-day-name {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text2);
  font-weight: 700;
  padding: 4px 0;
}
.calendar-grid .cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface2);
  font-size: 0.85rem;
  position: relative;
  cursor: pointer;
}
.calendar-grid .cal-day.today { background: var(--primary); color: white; font-weight: 700; }
.calendar-grid .cal-day.has-birthday::after {
  content: '🎂';
  font-size: 0.6rem;
  position: absolute;
  top: 2px;
  right: 4px;
}
.calendar-grid .cal-day.other-month { opacity: 0.3; }
.cal-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-month-header h2 { font-size: 1.1rem; }
.cal-nav-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text);
  cursor: pointer;
}

/* ═══ Stats Charts ═══ */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; margin: 20px 0; }
.bar { flex: 1; background: linear-gradient(180deg, var(--primary), var(--primary2)); border-radius: 6px 6px 0 0; position: relative; min-height: 2px; display: flex; align-items: flex-start; justify-content: center; padding-top: 4px; }
.bar-count { font-size: 0.65rem; color: white; font-weight: 700; }
.bar-label { text-align: center; font-size: 0.65rem; color: var(--text2); margin-top: 4px; }
.bar-col { display: flex; flex-direction: column; flex: 1; }

/* ═══ Toggle Switch ═══ */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; transition: 0.3s; }
.toggle .slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle input:checked + .slider { background: var(--primary); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ═══ Reminder chips ═══ */
.reminder-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.75rem;
  margin: 4px;
}
.reminder-chip .channel-icon { font-size: 0.8rem; }

/* ═══ Empty State ═══ */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text2); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state .text { font-size: 0.9rem; }

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s, bottom 0.3s;
}
.toast.show { opacity: 1; bottom: 90px; }

/* ═══ Theme Toggle ═══ */
.theme-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
}

/* ═══ Responsive: Tablet/Desktop ═══ */
@media (min-width: 768px) {
  .container { max-width: 800px; padding: 24px; }
  .bottomnav { max-width: 800px; left: 50%; transform: translateX(-50%); border-radius: 12px 12px 0 0; }
  .fab { bottom: 80px; }
  body { padding-bottom: 80px; }
  .appbar { padding: 16px 24px; }
  .appbar h1 { font-size: 1.5rem; }
  .dash-stats { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .container { max-width: 1000px; }
  .dash-stats { grid-template-columns: repeat(5, 1fr); }
}