/* ===== ROOT & RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #fff8f0;
  --surface:   #ffffff;
  --primary:   #ff6b6b;
  --primary2:  #ff8e53;
  --accent:    #ffd93d;
  --danger:    #e84040;
  --danger2:   #c0392b;
  --text:      #2d2d2d;
  --text-soft: #7a7a8c;
  --border:    #ffe0cc;
  --radius:    18px;
  --shadow:    0 4px 24px rgba(255,107,107,0.12);
  --font-head: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;
  --header-h:  80px;
}

/* ===== NO-SCROLL FULL HEIGHT ===== */
html, body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ===== CONFETTI ===== */
.confetti-container {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999; overflow: hidden;
}
.confetti-piece {
  position: absolute; top: -20px;
  width: 10px; height: 10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ===== HEADER ===== */
header {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary2) 100%);
  position: relative;
  /* No overflow:hidden — would clip the settings dropdown */
  z-index: 200;
}
header::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  pointer-events: none;
}
header::after {
  content: '';
  position: absolute; bottom: -80px; left: 10%;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  pointer-events: none;
}
.header-inner {
  position: relative;
  max-width: 1400px; margin: 0 auto;
  padding: 1rem 1.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.cake-icon {
  font-size: 2.2rem;
  animation: wiggle 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes wiggle {
  0%,100% { transform: rotate(-5deg); }
  50%      { transform: rotate(5deg); }
}
h1 {
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.header-sub {
  color: rgba(255,255,255,0.82);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.1rem;
}

/* ===== SETTINGS GEAR ===== */
.settings-wrap {
  position: relative;
  flex-shrink: 0;
}
.btn-gear {
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.3s;
  color: #fff;
}
.btn-gear:hover { background: rgba(255,255,255,0.28); }
.btn-gear.open { transform: rotate(60deg); }

.settings-dropdown {
  position: fixed;
  top: 60px; right: 1.5rem; /* overridden by JS */
  background: var(--surface);
  border-radius: 16px;
  padding: 0.5rem;
  min-width: 230px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  border: 1.5px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 9999;
}
.settings-dropdown.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}
.settings-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: none;
  background: none;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.settings-item:hover { background: var(--bg); }
.settings-item.danger:hover { background: #fff0f0; }
.si-icon { font-size: 1.3rem; flex-shrink: 0; }
.si-label { font-family: var(--font-body); font-weight: 700; font-size: 0.9rem; color: var(--text); }
.si-desc  { font-size: 0.75rem; color: var(--text-soft); margin-top: 1px; }
.settings-item.danger .si-label { color: var(--danger); }
.settings-divider { height: 1px; background: var(--border); margin: 0.3rem 0.5rem; }

/* ===== TOGGLE SWITCH ===== */
.si-toggle {
  width: 36px; height: 20px;
  border-radius: 20px;
  background: #ccc;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
  margin-left: auto;
}
.si-toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.si-toggle.on {
  background: var(--primary);
}
.si-toggle.on::after {
  transform: translateX(16px);
}

/* ===== TODAY BANNER ===== */
.today-banner {
  background: linear-gradient(90deg, #ffd93d, #ff9f43);
  padding: 0.6rem 1.5rem;
  position: relative; z-index: 0;
}
.today-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 600; color: #2d2d2d;
}
.today-emoji { font-size: 1.3rem; animation: bounce 1s ease infinite alternate; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-5px); } }

/* ===== APP BODY (fills remaining height) ===== */
.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  gap: 1.25rem;
  overflow: hidden;
}

/* ===== LEFT PANEL ===== */
.left-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.left-panel::-webkit-scrollbar { width: 5px; }
.left-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== COMING SOON ===== */
.coming-soon { /* inside left panel */ }
.coming-cards { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; }
.coming-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  box-shadow: var(--shadow);
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}
.coming-card .days-badge {
  background: var(--accent);
  border-radius: 8px;
  padding: 0.2rem 0.55rem;
  font-weight: 700; font-size: 0.75rem; color: #2d2d2d;
  white-space: nowrap;
}
.coming-card .coming-name { font-weight: 700; font-size: 0.88rem; }
.coming-card .coming-date { color: var(--text-soft); font-size: 0.76rem; }

/* ===== SECTION TITLES ===== */
.section-title {
  font-family: var(--font-head);
  font-size: 1.1rem; font-weight: 600; color: var(--text);
  margin-bottom: 0.6rem;
}

/* ===== ADD FORM ===== */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  display: flex; flex-direction: column; gap: 0.85rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
label {
  font-size: 0.78rem; font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase; letter-spacing: 0.5px;
}
input[type="text"], input[type="date"] {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  font-family: var(--font-body); font-size: 0.92rem; color: var(--text);
  background: var(--bg); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,107,0.15);
}
.btn-add {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff; border: none; border-radius: 10px;
  padding: 0.65rem 1.2rem;
  font-family: var(--font-head); font-size: 0.95rem; font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(255,107,107,0.35);
}
.btn-add:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,107,107,0.45); }
.btn-add:active { transform: translateY(0); }
.error-msg { color: var(--primary); font-size: 0.82rem; font-weight: 600; min-height: 1em; }

/* ===== RIGHT: MONTHS SECTION ===== */
.months-section {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.months-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.75rem;
  flex-shrink: 0;
  margin-bottom: 0.75rem;
}
.months-header .section-title { margin-bottom: 0; }
.search-wrap {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.9rem;
  box-shadow: var(--shadow);
}
.search-icon { font-size: 0.85rem; }
#searchInput {
  border: none; background: transparent; outline: none;
  font-family: var(--font-body); font-size: 0.88rem;
  width: 150px;
}

/* ===== MONTHS GRID ===== */
.months-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  align-content: start;
  padding-right: 0.25rem;
}
.months-grid::-webkit-scrollbar { width: 6px; }
.months-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.month-card {
  background: var(--surface);
  border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  align-self: start;
}
.month-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0,0,0,0.1); }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.88) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.month-header {
  padding: 0.7rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.month-name {
  font-family: var(--font-head); font-size: 1rem; font-weight: 700;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.month-count {
  background: rgba(255,255,255,0.3);
  border-radius: 20px; padding: 0.1rem 0.55rem;
  font-size: 0.73rem; font-weight: 700; color: #fff;
}
.month-body { padding: 0.6rem 0.9rem 0.9rem; }
.empty-month {
  color: var(--text-soft); font-size: 0.82rem;
  text-align: center; padding: 0.75rem 0; opacity: 0.6;
}

/* ===== BIRTHDAY ITEM ===== */
.birthday-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0.4rem;
  border-radius: 8px;
  transition: background 0.15s;
  position: relative;
}
.birthday-item:hover { background: var(--bg); }
.birthday-item + .birthday-item { border-top: 1px solid #f5e8e0; }
.bday-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 0.8rem; font-weight: 700;
  color: #fff; flex-shrink: 0; text-transform: uppercase;
}
.bday-info {
  flex: 1;
  min-width: 0;        /* allows text-overflow to work */
  overflow: hidden;
}
.bday-name {
  font-weight: 700; font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}
.bday-date { font-size: 0.74rem; color: var(--text-soft); }
.bday-today-badge {
  background: var(--accent); border-radius: 7px;
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem; font-weight: 700; color: #2d2d2d;
  flex-shrink: 0;
  white-space: nowrap;
}
.bday-actions {
  display: flex; gap: 0.2rem;
  opacity: 0; transition: opacity 0.2s;
  position: absolute; right: 0.2rem;
  background: var(--surface);
  border-radius: 6px;
  padding: 0 2px;
}
.birthday-item:hover .bday-actions { opacity: 1; }
.birthday-item:hover { background: var(--bg); }
.birthday-item:hover .bday-actions { background: var(--bg); }
.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 0.9rem; padding: 0.2rem 0.25rem; border-radius: 5px;
  transition: background 0.15s, transform 0.15s;
}
.btn-icon:hover { background: var(--bg); transform: scale(1.15); }

/* ===== MODALS (shared) ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(420px, 90vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  display: flex; flex-direction: column; gap: 1.1rem;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal h3 { font-family: var(--font-head); font-size: 1.25rem; color: var(--text); }
.modal-buttons { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.25rem; }
.btn-cancel {
  background: var(--bg); border: 2px solid var(--border); border-radius: 10px;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-body); font-weight: 600; cursor: pointer; color: var(--text-soft);
  transition: background 0.15s;
}
.btn-cancel:hover { background: var(--border); }
.btn-save {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border: none; border-radius: 10px; padding: 0.6rem 1.4rem;
  font-family: var(--font-body); font-weight: 700; color: #fff; cursor: pointer;
  box-shadow: 0 4px 14px rgba(255,107,107,0.3);
  transition: transform 0.15s;
}
.btn-save:hover { transform: translateY(-1px); }

/* ===== DANGER MODAL ===== */
.modal-danger { text-align: center; }
.danger-icon { font-size: 3rem; line-height: 1; }
.modal-danger h3 { font-size: 1.4rem; }
.danger-text { font-size: 0.9rem; color: var(--text-soft); line-height: 1.5; }
.danger-text strong { color: var(--text); }
.btn-danger {
  background: linear-gradient(135deg, var(--danger), var(--danger2));
  border: none; border-radius: 10px; padding: 0.6rem 1.4rem;
  font-family: var(--font-body); font-weight: 700; color: #fff; cursor: pointer;
  box-shadow: 0 4px 14px rgba(232,64,64,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,64,64,0.4); }

/* ===== CSV EXAMPLE BOX ===== */
.csv-example {
  background: #1e1e2e;
  color: #a6e3a1;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  padding: 1rem 1.2rem;
  border-radius: 10px;
}
.csv-note { font-size: 0.78rem; color: var(--text-soft); }

/* ===== DROP ZONE ===== */
.drop-zone {
  border: 2.5px dashed var(--border);
  border-radius: 14px;
  padding: 1.5rem 1rem;
  text-align: center;
  background: var(--bg);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(255,107,107,0.07);
}
.drop-zone-inner {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
}
.drop-icon { font-size: 2.2rem; line-height: 1; }
.drop-label { font-family: var(--font-head); font-size: 1rem; font-weight: 600; color: var(--text); }
.drop-sub   { font-size: 0.78rem; color: var(--text-soft); }
.drop-types { font-size: 0.72rem; color: var(--text-soft); margin-top: 0.25rem; }

/* ===== IMPORT RESULT MODAL ===== */
.modal-import { text-align: center; }
.import-icon { font-size: 3rem; line-height: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  .app-body { flex-direction: column; overflow-y: auto; padding: 1rem; }
  .left-panel { width: 100%; overflow: visible; }
  .months-section { min-height: 400px; }
  html, body { overflow: auto; height: auto; }
}
