/* =========================================================================
   CAS Level 11→12 Promotion File Generator
   Design: "Ministry Editorial" — refined government document aesthetic
   Palette: deep teal · warm gold · cream ivory · charcoal serif display
   ========================================================================= */

:root {
  /* Core palette */
  --ink:            #0d1f2d;
  --ink-soft:       #2a3f52;
  --ink-muted:      #5b6b7d;
  --ink-faint:      #8a97a5;

  --surface:        #ffffff;
  --surface-warm:   #fdfbf5;
  --surface-cream:  #faf6eb;
  --bg:             #f4ede0;
  --bg-deep:        #ebe0ce;

  --accent:         #0d5f4f;
  --accent-dark:    #084232;
  --accent-light:   #1a7a67;
  --accent-tint:    #dcece6;

  --gold:           #b8935a;
  --gold-dark:      #8a6b3c;
  --gold-light:     #d4b47f;
  --gold-tint:      #f5ebd8;

  --err:            #b8392f;
  --good:           #1f7a4c;

  --font-display:   "Georgia", "Times New Roman", "Palatino Linotype", serif;
  --font-body:      -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
                    "Arial", sans-serif;
  --font-guj:       "Shruti", "Nirmala UI", "Noto Sans Gujarati", sans-serif;
  --font-mono:      "SF Mono", "Monaco", "Menlo", "Consolas", monospace;

  --shadow-sm:      0 1px 2px rgba(13, 31, 45, 0.04);
  --shadow-md:      0 4px 14px rgba(13, 31, 45, 0.08), 0 1px 3px rgba(13, 31, 45, 0.06);
  --shadow-lg:      0 12px 32px rgba(13, 31, 45, 0.10), 0 3px 8px rgba(13, 31, 45, 0.05);
  --shadow-glow:    0 0 0 3px rgba(13, 95, 79, 0.12);

  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:        cubic-bezier(0.4, 0, 1, 1);
  --ease-bounce:    cubic-bezier(0.34, 1.56, 0.64, 1);

  --r-xs:  4px;
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  24px;
}

* { box-sizing: border-box; }
*::selection { background: var(--gold-tint); color: var(--ink); }

html, body {
  margin: 0; padding: 0;
  font-family: var(--font-body);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 1200px 600px at 50% -200px, rgba(13, 95, 79, 0.08), transparent 60%),
    radial-gradient(ellipse 900px 600px at 100% 100%, rgba(184, 147, 90, 0.06), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(180deg, var(--accent-dark) 0%, var(--accent) 100%);
  color: var(--surface-warm);
  border-bottom: 3px solid var(--gold);
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 4px 20px rgba(8, 66, 50, 0.2);
}
.app-header::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0; bottom: 0;
  background-image:
    repeating-linear-gradient(45deg,
      transparent 0, transparent 20px,
      rgba(255,255,255,0.015) 20px, rgba(255,255,255,0.015) 21px);
  pointer-events: none;
}
.app-header .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
}
.brand { display: flex; gap: 18px; align-items: center; }
.logo {
  font-size: 30px;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(212, 180, 127, 0.35);
  border-radius: var(--r-md);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--surface-warm);
}
.brand .sub {
  margin: 4px 0 0;
  color: var(--gold-light);
  font-size: 13px;
  letter-spacing: 0.02em;
  font-style: italic;
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar .btn {
  background: rgba(255,255,255,0.08);
  border-color: rgba(212, 180, 127, 0.4);
  color: var(--surface-warm);
  backdrop-filter: blur(8px);
}
.toolbar .btn:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--gold-light);
  color: var(--gold-light);
  transform: translateY(-1px);
}

/* ===== MAIN ===== */
.app-main { padding: 32px 0 80px; }

/* ===== STEPS ===== */
.steps {
  display: flex;
  gap: 6px;
  margin: 8px 0 28px;
  overflow-x: auto;
  padding: 4px 0 10px;
  scrollbar-width: thin;
  counter-reset: step;
}
.steps::-webkit-scrollbar { height: 6px; }
.steps::-webkit-scrollbar-thumb { background: var(--bg-deep); border-radius: 3px; }

.step-pill {
  flex: 0 0 auto;
  padding: 9px 18px 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--bg-deep);
  background: var(--surface-warm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  counter-increment: step;
}
.step-pill::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-deep);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: all 0.25s var(--ease-out);
}
.step-pill:hover {
  border-color: var(--accent-light);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.step-pill:hover::before { background: var(--accent-tint); color: var(--accent); }
.step-pill.active {
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  color: var(--surface-warm);
  border-color: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(13, 95, 79, 0.25);
  transform: translateY(-1px);
}
.step-pill.active::before {
  background: var(--gold);
  color: var(--accent-dark);
}
.step-pill.visited:not(.active) {
  background: var(--accent-tint);
  color: var(--accent-dark);
  border-color: var(--accent-light);
}
.step-pill.visited:not(.active)::before {
  content: "✓";
  background: var(--accent);
  color: var(--surface-warm);
  font-size: 12px;
}

/* ===== STEP PANELS ===== */
.step {
  display: none;
  background: var(--surface);
  border: 1px solid var(--bg-deep);
  border-radius: var(--r-lg);
  padding: 36px 40px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  animation: stepIn 0.4s var(--ease-out);
}
.step.active { display: block; }
@keyframes stepIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.step::before {
  content: "";
  position: absolute;
  top: 0; left: 40px; right: 40px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-light) 20%, var(--gold) 50%, var(--gold-light) 80%, transparent);
  opacity: 0.7;
  border-radius: 999px;
  transform: translateY(-1px);
}

.step h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.step h2::first-letter {
  color: var(--accent);
  font-size: 1.15em;
}
.step .hint {
  margin: 0 0 24px;
  color: var(--ink-muted);
  font-size: 14px;
  font-style: italic;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--bg-deep);
}

/* ===== FIELDS ===== */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px 24px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field input[type="text"],
.field textarea,
.field select {
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  padding: 11px 14px;
  border: 1.5px solid var(--bg-deep);
  border-radius: var(--r-sm);
  background: var(--surface-warm);
  color: var(--ink);
  transition: all 0.2s var(--ease-out);
  width: 100%;
  line-height: 1.4;
}
.field input[type="text"]:hover,
.field textarea:hover,
.field select:hover {
  border-color: var(--ink-faint);
}
.field input[type="text"]:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-glow);
}
.field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6b7d' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ===== YEAR TABS ===== */
.year-tabs {
  display: flex;
  gap: 0;
  margin: 20px 0 24px;
  border-bottom: 2px solid var(--bg-deep);
  overflow-x: auto;
}
.year-tab {
  padding: 12px 24px;
  border: none;
  background: transparent;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  color: var(--ink-muted);
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  font-family: var(--font-body);
  white-space: nowrap;
  transition: all 0.2s var(--ease-out);
  position: relative;
}
.year-tab:hover {
  color: var(--accent);
  background: var(--accent-tint);
}
.year-tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--gold);
  font-weight: 700;
  background: linear-gradient(180deg, transparent 0%, var(--gold-tint) 100%);
}
.year-tab.active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 2px;
  background: var(--gold);
  border-radius: 999px;
}

.section-head {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-dark);
  margin: 28px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-deep);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.01em;
}
.section-head::before {
  content: "";
  display: inline-block;
  width: 4px; height: 18px;
  background: var(--gold);
  border-radius: 2px;
}
.section-head:first-child { border-top: none; padding-top: 0; }

/* ===== BUTTONS ===== */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--bg-deep);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  border-color: var(--accent-dark);
  color: var(--surface-warm);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(13, 95, 79, 0.2);
}
.btn.primary:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: var(--gold-light);
  box-shadow: 0 6px 20px rgba(13, 95, 79, 0.35);
  transform: translateY(-2px);
}
.btn.ghost { background: transparent; }
.btn.big {
  padding: 16px 36px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== LISTS ===== */
.list-block {
  margin: 18px 0 30px;
  border: 1px solid var(--bg-deep);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-warm);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s var(--ease-out);
}
.list-block:hover { box-shadow: var(--shadow-md); }
.list-header {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-warm) 100%);
  padding: 12px 16px;
  border-bottom: 1.5px solid var(--bg-deep);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  font-family: var(--font-display);
}
.list-header .btn-add {
  font-size: 12px;
  padding: 5px 12px;
  background: var(--accent-tint);
  border-color: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 600;
}
.list-header .btn-add:hover {
  background: var(--accent);
  color: var(--surface-warm);
}
.list-rows { padding: 12px 14px; }
.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--bg-deep);
  transition: background 0.2s var(--ease-out);
  border-radius: var(--r-sm);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: rgba(184, 147, 90, 0.04); }
.list-row-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 12px;
}
.list-row-fields .field label {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
.list-row-fields .field input,
.list-row-fields .field textarea {
  font-size: 13px;
  padding: 7px 10px;
}
.row-del {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-faint);
  font-size: 16px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: all 0.2s var(--ease-out);
}
.row-del:hover {
  background: #fde8ea;
  border-color: var(--err);
  color: var(--err);
}

/* ===== DOCUMENTS ===== */
.doc-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--surface-cream);
  border-radius: var(--r-md);
  border: 1px dashed var(--gold-light);
}
.doc-category {
  font-family: var(--font-display);
  margin: 24px 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gold-light);
  display: inline-block;
  padding-right: 20px;
}
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--bg-deep);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  position: relative;
}
.doc-item::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
  border-radius: 3px 0 0 3px;
  transition: background 0.2s var(--ease-out);
}
.doc-item:hover {
  border-color: var(--accent-light);
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
}
.doc-item:hover::before { background: var(--gold); }
.doc-item input {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 17px; height: 17px;
  cursor: pointer;
}
.doc-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.doc-item-desc {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 3px;
  line-height: 1.4;
}
.doc-item.checked {
  background: linear-gradient(135deg, var(--accent-tint) 0%, var(--surface) 60%);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.doc-item.checked::before { background: var(--accent); }

/* ===== STEP NAV ===== */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding: 16px 4px;
}
.step-label {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink-muted);
  font-style: italic;
  text-align: center;
  flex: 1;
}

/* ===== SUMMARY ===== */
.summary-grid {
  display: grid;
  gap: 0;
  background: var(--surface-warm);
  border: 1px solid var(--bg-deep);
  border-radius: var(--r-md);
  overflow: hidden;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  font-size: 14px;
  border-bottom: 1px dashed var(--bg-deep);
  transition: background 0.15s var(--ease-out);
}
.summary-row:last-child { border-bottom: none; }
.summary-row:hover { background: var(--gold-tint); }
.summary-row span {
  color: var(--ink-muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.summary-row strong {
  color: var(--accent-dark);
  font-family: var(--font-display);
  font-weight: 600;
  text-align: right;
  max-width: 65%;
}

.big-action {
  margin-top: 32px;
  padding: 36px;
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 50%, var(--accent-light) 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  border-radius: var(--r-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(13, 95, 79, 0.2);
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.big-action::before,
.big-action::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  opacity: 0.12;
  pointer-events: none;
}
.big-action::before {
  top: -100px; right: -60px;
  background: radial-gradient(circle, var(--gold), transparent 70%);
}
.big-action::after {
  bottom: -100px; left: -60px;
  background: radial-gradient(circle, var(--gold-light), transparent 70%);
}
.big-action .btn.primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-color: var(--gold-dark);
  color: var(--accent-dark);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 18px 42px;
  box-shadow: 0 6px 24px rgba(184, 147, 90, 0.35), inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative;
  z-index: 1;
}
.big-action .btn.primary:hover {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  color: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(184, 147, 90, 0.5), inset 0 1px 0 rgba(255,255,255,0.4);
}
.small-note {
  font-size: 13px;
  color: var(--gold-tint);
  margin: 16px 0 0;
  font-style: italic;
  position: relative;
  z-index: 1;
}
.gen-status {
  margin-top: 20px;
  font-size: 14px;
  color: var(--surface-warm);
  position: relative;
  z-index: 1;
  line-height: 1.6;
}
.gen-status strong { color: var(--gold-light); font-family: var(--font-display); font-size: 20px; }
.gen-status small { color: var(--gold-tint); display: block; margin-top: 4px; }

/* ===== FOOTER ===== */
.app-footer {
  margin-top: 48px;
  padding: 28px 0 40px;
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
  position: relative;
}
.app-footer::before {
  content: "❋";
  display: block;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 12px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translate(-50%, 120px);
  background: linear-gradient(180deg, var(--ink), var(--ink-soft));
  color: var(--surface-warm);
  padding: 14px 24px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15);
  opacity: 0;
  transition: all 0.4s var(--ease-bounce);
  pointer-events: none;
  z-index: 1000;
  border: 1px solid rgba(212, 180, 127, 0.3);
  letter-spacing: 0.02em;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error {
  background: linear-gradient(180deg, #a12e25, var(--err));
  border-color: rgba(255,255,255,0.15);
}
.toast.success {
  background: linear-gradient(180deg, var(--accent-dark), var(--good));
  border-color: var(--gold-light);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .app-header .wrap {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }
  .brand { justify-content: center; }
  .brand h1 { font-size: 22px; text-align: center; }
  .brand .sub { text-align: center; }
  .toolbar { justify-content: center; }
  .step { padding: 24px 20px; }
  .step::before { left: 20px; right: 20px; }
  .step h2 { font-size: 22px; }
  .field-grid { grid-template-columns: 1fr; gap: 14px; }
  .list-row { grid-template-columns: 1fr; }
  .row-del { justify-self: end; }
  .step-nav { flex-direction: row; gap: 8px; flex-wrap: wrap; }
  .step-label { width: 100%; order: -1; margin-bottom: 6px; }
  .big-action { padding: 24px 16px; }
  .big-action .btn.primary { width: 100%; padding: 14px 20px; font-size: 15px; }
}

@media print {
  .app-header, .steps, .step-nav, .app-footer, .toolbar { display: none; }
  .step { box-shadow: none; border: none; }
}
