/* ===== Global Styles ===== */
:root {
  --main-color: #ff7f50;
  --bg-color: #fff8f2;
  --card-bg: #ffffff;
  --muted: #666;
}

* { box-sizing: border-box; }

body {
  font-family: 'Noto Sans KR', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: var(--bg-color);
  margin: 0;
  color: #222;
}

.container {
  max-width: 960px;
  margin: 24px auto;
  padding: 16px;
}

h1 {
  text-align: center;
  color: var(--main-color);
  margin-bottom: 12px;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

input[type="text"], input[type="number"], input[type="date"], select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e6d6c8;
  margin-right: 8px;
}

button {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--main-color);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform .08s ease, box-shadow .08s ease;
}

button:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
button:active { transform: translateY(0); }

ul#timetable { padding-left: 1.2em; margin-top: 12px; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid #f0e6df;
  text-align: left;
}

th {
  background: var(--main-color);
  color: white;
  font-weight: 700;
}

/* modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.modal[aria-hidden="false"] { display: flex; }

.modal-content {
  background: white;
  border-radius: 10px;
  max-width: 480px;
  width: 100%;
  padding: 16px;
}

.modal ul { list-style: none; padding: 0; max-height: 320px; overflow: auto; margin: 8px 0; }
.modal li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.modal li:hover { background: #faf6f4; }

/* responsive */
@media (max-width: 640px) {
  .container { padding: 12px; }
  input, button { width: 100%; margin: 6px 0; }
  .modal-content { padding: 12px; }
}

/* ===== Skeleton ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--skel-base) 25%,
    var(--skel-shine) 37%,
    var(--skel-base) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

:root {
  --skel-base: #e0e0e0;
  --skel-shine: #f0f0f0;
}

[data-theme="dark"] {
  --skel-base: #2a2a2a;
  --skel-shine: #3a3a3a;
}

/* ===== Fade In ===== */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.35s ease forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ===== Retry ===== */
.retry-box {
  text-align: center;
  padding: 12px;
}

.retry-box button {
  margin-top: 8px;
}

/* ===== Network Banner ===== */
#networkStatus {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #c0392b;
  color: white;
  text-align: center;
  padding: 6px;
  font-size: 14px;
  display: none;
  z-index: 3000;
}

/* ===== Monthly Meal Calendar Grid ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 700;
  margin-top: 8px;
}

.calendar-grid > div {
  padding: 8px 0;
  border-bottom: 1px solid #f0e6df;
}

.calendar-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.calendar-body > div {
  min-height: 90px;
  padding: 6px;
  border-radius: 8px;
  background: #fffdfb;
  border: 1px solid #f0e6df;
  font-size: 13px;
  white-space: pre-line;
}

.calendar-body > div strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.calendar-body > div.today {
  border: 2px solid var(--main-color);
  background: #fff3ec;
}

.calendar-body > div.today strong {
  color: var(--main-color);
}

.calendar-body > div {
  min-height: 90px;
}

/* ===== Weekly Timetable Table ===== */
.weekly-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.weekly-table th, .weekly-table td {
  border: 1px solid #f0e6df;
  padding: 10px;
  text-align: center;
  vertical-align: top;
  min-width: 110px;
}
.weekly-table th {
  background: var(--main-color);
  color: #fff;
  font-weight: 700;
}
.weekly-table .period-col {
  width: 72px;
  background: #fffaf7;
  font-weight: 700;
}
.weekly-table td.empty {
  background: #fffdfb;
  color: #9a9a9a;
  min-height: 56px;
}

@media (max-width: 640px) {
  .weekly-table th, .weekly-table td { padding: 8px; font-size: 13px; }
  .weekly-table { display: block; overflow-x: auto; }
}

/* 모바일 */
@media (max-width: 640px) {
  .calendar-body > div {
    min-height: auto;
    padding: 6px 4px;
    font-size: 12px;
  }

  .calendar-body > div strong {
    font-size: 13px;
  }

  .allergy-info {
    font-size: 12px;
    padding: 8px 10px;
  }
}


/* ===== Allergy Sub Card ===== */
.allergy-info {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;

  /* 카드 안 카드 느낌 */
  border: 1px solid #f0e6df;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);

  font-size: 13px;
  line-height: 1.5;
}

.allergy-info strong {
  display: block;
  margin-bottom: 4px;
  color: var(--main-color);
  font-weight: 700;
}

.allergy-info span {
  color: #444;
}
