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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  min-height: 100vh;
}

/* ── VIEWS ── */
.view { min-height: 100vh; }
.view.hidden { display: none; }
.view.active { display: block; }

/* ── LOGIN ── */
#view-login {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a365d 0%, #2b6cb0 100%);
  min-height: 100vh;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  text-align: center;
}

.login-logo {
  width: 180px;
  height: auto;
  margin: 0 auto 16px;
  display: block;
}

.login-card .subtitle {
  color: #718096;
  font-size: 0.95rem;
  margin-bottom: 32px;
}

.login-card label {
  display: block;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}

.login-card input:focus { border-color: #2b6cb0; }

/* ── TOP BAR ── */
.top-bar {
  background: #1a365d;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.top-bar-left { display: flex; align-items: center; gap: 16px; }

.topbar-logo {
  height: 44px;
  width: auto;
  border-radius: 6px;
  background: #fff;
  padding: 3px 6px;
}

.planner-title-text {
  font-size: 1rem;
  font-weight: 600;
  color: #bee3f8;
  letter-spacing: 0.02em;
}

/* ── BUTTONS ── */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: #2b6cb0;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: #2c5282; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #a0aec0; cursor: not-allowed; }

.btn-logout {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

.btn-back {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-back:hover { background: rgba(255,255,255,0.15); }

.btn-download {
  background: #1a365d;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.btn-download:hover { background: #2b6cb0; }

/* ── SELECT VIEW ── */
.select-main {
  max-width: 560px;
  margin: 60px auto;
  padding: 0 24px;
  text-align: center;
}

.select-main h2 {
  font-size: 1.8rem;
  color: #1a365d;
  margin-bottom: 8px;
}

.select-main p {
  color: #718096;
  margin-bottom: 36px;
}

.select-form {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ── FIELD GROUPS ── */
.field-group {
  margin-bottom: 12px;
}

.field-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4a5568;
  margin-bottom: 4px;
}

.field-group input,
.field-group select {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.field-group input:focus,
.field-group select:focus { border-color: #2b6cb0; }

/* ── TWO-PANEL PLANNER ── */
#view-planner { display: flex; flex-direction: column; height: 100vh; }

.planner-main {
  flex: 1;
  overflow: hidden;
  padding: 20px;
}

.planner-panels {
  display: grid;
  grid-template-columns: 315px 1fr;
  gap: 16px;
  height: 100%;
}

/* ── PANELS ── */
.panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.panel-heading {
  padding: 14px 16px;
  border-bottom: 2px solid #ebf4ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.panel-heading h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a365d;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.panel-left .panel-body {
  padding: 12px 14px;
}

/* ── HOLIDAY BUTTON ── */
.btn-holiday {
  width: 100%;
  padding: 8px 10px;
  background: #fff;
  color: #92400e;
  border: 2px solid #fbbf24;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  margin-bottom: 10px;
  text-align: center;
}

.btn-holiday:hover { background: #fef9c3; }

.btn-holiday.is-holiday {
  background: #fbbf24;
  color: #78350f;
  border-color: #f59e0b;
}

.btn-holiday.is-holiday:hover { background: #fde68a; }

/* ── HOLIDAY ROW ── */
.plan-row.holiday td                   { background: #fef9c3 !important; border-right-color: #fde047; }
.plan-row.holiday .day-cell            { background: #fef08a !important; border-right-color: #fde047; }
.plan-row.holiday.row-active .day-cell { background: #fde047 !important; }
.plan-row.holiday .weekly-cell         { color: #92400e; }

.holiday-badge {
  display: block;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #78350f;
  background: #fbbf24;
  border-radius: 3px;
  padding: 1px 5px;
  margin-top: 3px;
  width: fit-content;
}

/* ── ACTIVE DAY BAR ── */
.active-day-bar {
  background: #ebf8ff;
  border: 1.5px solid #bee3f8;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.78rem;
  color: #2b6cb0;
  margin-bottom: 12px;
  font-weight: 600;
  text-align: center;
}

.active-day-bar.has-day {
  background: #2b6cb0;
  color: #fff;
  border-color: #2b6cb0;
}

/* ── PLAN ROW (day rows in right panel) ── */
.plan-row { cursor: pointer; transition: background 0.15s; }

.plan-row:hover .day-cell {
  background: #c6deff;
}

.plan-row.row-active .day-cell {
  background: #2b6cb0;
  color: #fff;
  border-right-color: #2b6cb0;
}

/* ── EDITABLE CELLS ── */
.editable-cell {
  cursor: text;
  transition: background 0.15s, outline 0.15s;
  min-height: 1em;
}

.editable-cell:hover {
  background: #f0f8ff;
  outline: 1.5px solid #bee3f8;
  border-radius: 3px;
}

.editable-cell:focus {
  outline: 2px solid #2b6cb0;
  background: #ebf8ff;
  border-radius: 3px;
}

.editable-cell:empty::before {
  content: attr(data-placeholder);
  color: #cbd5e0;
  font-style: italic;
  pointer-events: none;
}

/* ── FORM ACTIONS ── */
.form-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.panel-left .btn-primary {
  padding: 10px;
  font-size: 0.9rem;
}

.save-status {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  margin-top: 10px;
}
.save-status.success   { color: #38a169; }
.save-status.error-msg { color: #e53e3e; }

/* ── ACTIVITY PICKER ── */
.activity-picker {
  margin-bottom: 10px;
  padding: 10px;
  background: #ebf8ff;
  border: 2px solid #bee3f8;
  border-radius: 10px;
}

.activity-picker-hint {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2b6cb0;
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.activity-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-card {
  background: #fff;
  border: 2px solid #bee3f8;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.activity-card:hover {
  border-color: #2b6cb0;
  box-shadow: 0 0 0 3px rgba(43,108,176,0.12);
}

.activity-card.selected {
  border-color: #2b6cb0;
  background: #2b6cb0;
}

.activity-card.selected .activity-label,
.activity-card.selected .activity-text { color: #fff; }

.activity-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #2b6cb0;
  white-space: nowrap;
  padding-top: 2px;
  min-width: 50px;
  flex-shrink: 0;
}

.activity-text {
  font-size: 0.8rem;
  color: #2d3748;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

/* ── PREVIEW CARD ── */
.preview-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.preview-header {
  background: #1a365d;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.preview-logo {
  height: 44px;
  width: auto;
  border-radius: 4px;
  background: #fff;
  padding: 2px 5px;
}

.preview-header-text .preview-school {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.preview-header-text .preview-tagline {
  font-size: 0.75rem;
  color: #bee3f8;
  margin-top: 2px;
}

.preview-subject-bar {
  background: #ebf8ff;
  border-bottom: 2px solid #bee3f8;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2b6cb0;
  min-height: 40px;
}

.preview-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  border-bottom: 1px solid #e2e8f0;
}

.preview-row:last-child { border-bottom: none; }

.preview-label {
  padding: 13px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #718096;
  background: #f7fafc;
  border-right: 1px solid #e2e8f0;
}

.preview-value {
  padding: 13px 16px;
  font-size: 0.875rem;
  color: #1a202c;
  line-height: 1.5;
  transition: color 0.15s;
}

.preview-value.empty {
  color: #cbd5e0;
  font-style: italic;
}

/* ── PREVIEW META SECTION ── */
.preview-meta-section {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  border-bottom: 2px solid #e2e8f0;
}

.preview-meta-item {
  padding: 12px 16px;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-meta-item:last-child { border-right: none; }

.preview-meta-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #718096;
}

.preview-meta-value {
  font-size: 0.875rem;
  color: #1a202c;
  font-weight: 600;
  line-height: 1.4;
}

.preview-meta-value.empty {
  color: #cbd5e0;
  font-style: italic;
  font-weight: 400;
}

/* ── WEEKLY TABLE ── */
.weekly-table-wrap {
  overflow-x: auto;
  border-bottom: 2px solid #e2e8f0;
}

.weekly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.weekly-table thead tr {
  background: #1a365d;
  color: #fff;
}

.weekly-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.weekly-table thead th.col-day { width: 18%; }
.weekly-table thead th.col-topic { width: 22%; }
.weekly-table thead th.col-activity { width: 38%; }
.weekly-table thead th.col-assessment { width: 22%; }

.weekly-table tbody tr { border-bottom: 1px solid #e2e8f0; }
.weekly-table tbody tr:last-child { border-bottom: none; }
.weekly-table tbody tr:nth-child(even) { background: #f7fafc; }

.day-cell {
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #1a365d;
  background: #ebf4ff;
  border-right: 1px solid #bee3f8;
  white-space: nowrap;
  vertical-align: top;
}

.weekly-cell {
  padding: 10px 12px;
  color: #1a202c;
  line-height: 1.4;
  vertical-align: top;
  border-right: 1px solid #e2e8f0;
}

.weekly-cell:last-child { border-right: none; }

.weekly-cell.empty {
  color: #cbd5e0;
  font-style: italic;
}

/* ── SHARED ── */
.error {
  color: #e53e3e;
  font-size: 0.875rem;
  margin-bottom: 12px;
  text-align: left;
}

.hidden { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .planner-main { overflow: visible; padding: 16px; }
  .planner-panels { grid-template-columns: 1fr; height: auto; }
  .panel { min-height: auto; }
  .panel-body { overflow-y: visible; }
  #view-planner { height: auto; }
}

@media (max-width: 640px) {
  .login-card { padding: 32px 24px; margin: 16px; }
}
