/* ============================================
   University Course Registration — style.css
   Aesthetic: Refined Academic / Ivory & Deep Navy
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── CSS Variables ── */
:root {
  --navy:       #0d1f3c;
  --navy-mid:   #162b52;
  --gold:       #c9a84c;
  --gold-light: #e8c97e;
  --ivory:      #f8f5ef;
  --cream:      #eee9de;
  --text-dark:  #1a1a2e;
  --text-mid:   #4a4a6a;
  --text-light: #8888aa;
  --white:      #ffffff;
  --error:      #c0392b;
  --success:    #1a6b4a;
  --border:     #d4cfc5;
  --shadow:     0 8px 40px rgba(13, 31, 60, 0.12);
  --shadow-lg:  0 20px 60px rgba(13, 31, 60, 0.18);
  --radius:     4px;
  --radius-lg:  10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  background-color: var(--ivory);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Background Texture ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(201,168,76,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(13,31,60,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Page Layout ── */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.site-header {
  background: var(--navy);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 36px 24px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.crest {
  width: 56px;
  height: 56px;
  background: rgba(201,168,76,0.15);
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.crest svg {
  width: 28px;
  height: 28px;
  fill: var(--gold);
}

.header-text {
  flex: 1;
}

.institution-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}

.header-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.25;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  padding: 52px 24px 80px;
}

/* ── Intro Block ── */
.intro-block {
  margin-bottom: 40px;
  animation: fadeSlideDown 0.6s ease both;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.section-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--gold);
}

.intro-block h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.25;
  margin-bottom: 16px;
}

.intro-block p {
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.75;
  max-width: 560px;
}

/* ── Form Card ── */
.form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: fadeSlideUp 0.7s ease 0.15s both;
}

.form-card-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-card-header h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: 0.02em;
}

.required-note {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.55);
}

.required-note span {
  color: var(--gold-light);
}

.form-body {
  padding: 36px 32px 40px;
}

/* ── Form Fields ── */
.field-group {
  margin-bottom: 28px;
  animation: fadeSlideUp 0.5s ease both;
}

.field-group:nth-child(1) { animation-delay: 0.2s; }
.field-group:nth-child(2) { animation-delay: 0.28s; }
.field-group:nth-child(3) { animation-delay: 0.36s; }
.field-group:nth-child(4) { animation-delay: 0.44s; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 8px;
}

label .req {
  color: var(--gold);
  margin-left: 2px;
}

label .hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.78rem;
  color: var(--text-light);
  margin-left: 6px;
}

input[type="text"],
input[type="email"],
input[type="number"],
textarea {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-dark);
  background: var(--ivory);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.5;
}

textarea {
  resize: vertical;
  min-height: 130px;
  line-height: 1.65;
}

input:focus,
textarea:focus {
  border-color: var(--navy);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(13, 31, 60, 0.08);
}

input.invalid,
textarea.invalid {
  border-color: var(--error);
  background: #fdf5f5;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.08);
}

.field-error {
  display: block;
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 6px;
  min-height: 1.1em;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.field-error.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Divider ── */
.field-divider {
  height: 1px;
  background: var(--cream);
  margin: 32px 0;
}

/* ── Submit Button ── */
.btn-submit {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--gold);
  border: none;
  border-radius: var(--radius);
  padding: 16px 24px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  animation: fadeSlideUp 0.5s ease 0.5s both;
}

.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.btn-submit:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(201, 168, 76, 0.4);
}

.btn-submit:hover::before {
  transform: translateX(100%);
}

.btn-submit:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── Alert Banners ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 28px;
  font-size: 0.88rem;
  line-height: 1.55;
  animation: fadeSlideDown 0.4s ease both;
}

.alert-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-success {
  background: #edf7f2;
  border: 1px solid #a8d5bc;
  color: var(--success);
}

.alert-error {
  background: #fdf1f0;
  border: 1px solid #e8b4b0;
  color: var(--error);
}

/* ── Footer ── */
.site-footer {
  background: var(--navy);
  padding: 24px;
  text-align: center;
}

.site-footer p {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.04em;
}

.site-footer a {
  color: var(--gold);
  text-decoration: none;
}

/* ── PHP Result Page ── */
.result-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--ivory);
}

.result-card {
  max-width: 520px;
  width: 100%;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  text-align: center;
  animation: fadeSlideUp 0.6s ease both;
}

.result-card-top {
  padding: 40px 40px 32px;
}

.result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.8rem;
}

.result-icon.success { background: #edf7f2; }
.result-icon.error   { background: #fdf1f0; }

.result-card h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}

.result-card p {
  font-size: 0.93rem;
  color: var(--text-mid);
  line-height: 1.7;
}

.result-card-footer {
  background: var(--cream);
  padding: 24px 40px;
  border-top: 1px solid var(--border);
}

.btn-back {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--navy);
  background: var(--gold);
  border-radius: var(--radius);
  padding: 12px 28px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-back:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,168,76,0.35);
}

/* ── Animations ── */
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .header-inner  { padding: 28px 20px 24px; gap: 14px; }
  .header-title  { font-size: 1.25rem; }
  .crest         { width: 44px; height: 44px; }
  .crest svg     { width: 22px; height: 22px; }
  .intro-block h2 { font-size: 1.5rem; }
  .form-card-header { padding: 16px 20px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .form-body     { padding: 24px 20px 28px; }
  .main-content  { padding: 36px 16px 60px; }
  .result-card-top    { padding: 32px 24px 24px; }
  .result-card-footer { padding: 20px 24px; }
}
