/* ============================================================
   IET DAVV Indore — MSc Applied Mathematics Admission Form
   Style: Institutional Authority × Academic Warmth
   Palette: Deep Maroon / Ivory / Gold Accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,400&family=DM+Mono:wght@400;500&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --maroon:       #6B1A2A;
  --maroon-dark:  #4A0F1C;
  --maroon-light: #8C2D3F;
  --gold:         #C9963A;
  --gold-light:   #E8B96A;
  --ivory:        #FAF6EF;
  --ivory-dark:   #F0E9DC;
  --cream:        #FDF9F3;
  --text-primary: #1E0A10;
  --text-secondary:#5A3A42;
  --text-muted:   #9A7A82;
  --border:       #D9C4B0;
  --border-focus: #C9963A;
  --error:        #C0392B;
  --success:      #1E6B45;
  --shadow-sm:    0 2px 8px rgba(107,26,42,0.08);
  --shadow-md:    0 6px 24px rgba(107,26,42,0.12);
  --shadow-lg:    0 16px 48px rgba(107,26,42,0.18);
  --radius:       6px;
  --radius-lg:    12px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Source Serif 4', Georgia, serif;
  background-color: var(--ivory);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(107,26,42,0.07) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%236B1A2A' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Page Wrapper ---------- */
.page-wrapper {
  max-width: 880px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  animation: fadeInUp 0.7s ease both;
}

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

/* ---------- Header / Letterhead ---------- */
.letterhead {
  background: var(--maroon-dark);
  background-image: linear-gradient(135deg, var(--maroon-dark) 0%, var(--maroon) 60%, var(--maroon-light) 100%);
  color: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 2.25rem 2.5rem 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.letterhead::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -55deg,
    transparent,
    transparent 40px,
    rgba(255,255,255,0.018) 40px,
    rgba(255,255,255,0.018) 80px
  );
  pointer-events: none;
}

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

.logo-wrap {
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.10);
  border: 2px solid rgba(201,150,58,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-wrap svg {
  width: 52px;
  height: 52px;
  fill: var(--gold-light);
  opacity: 0.9;
}

.header-text { position: relative; z-index: 1; }

.header-text .institution {
  font-family: 'Source Serif 4', serif;
  font-weight: 300;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 0.3rem;
  opacity: 0.88;
}

.header-text h1 {
  font-family: 'Playfair Display', 'Georgia', serif;
  font-size: clamp(1.25rem, 3.5vw, 1.65rem);
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
  letter-spacing: -0.01em;
}

.header-text .programme {
  font-family: 'Source Serif 4', serif;
  font-size: 0.88rem;
  color: var(--gold-light);
  margin-top: 0.45rem;
  font-style: italic;
  opacity: 0.9;
}

/* ---------- Form Card ---------- */
.form-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ---------- Application ID Banner ---------- */
.app-meta {
  background: var(--ivory-dark);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.app-meta .meta-item {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.app-meta .meta-item strong {
  color: var(--maroon);
  font-weight: 500;
}

/* ---------- Section ---------- */
.form-section {
  padding: 2rem 2.5rem;
  border-bottom: 1px solid var(--ivory-dark);
  animation: fadeInUp 0.5s ease both;
}

.form-section:last-of-type { border-bottom: none; }

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.6rem;
}

.section-number {
  width: 28px;
  height: 28px;
  background: var(--maroon);
  color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--maroon-dark);
  letter-spacing: 0.01em;
}

.section-header .section-divider {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
  opacity: 0.5;
}

/* ---------- Grid ---------- */
.form-grid {
  display: grid;
  gap: 1.25rem 1.5rem;
}

.grid-2  { grid-template-columns: repeat(2, 1fr); }
.grid-3  { grid-template-columns: repeat(3, 1fr); }

.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ---------- Field Group ---------- */
.field-group { display: flex; flex-direction: column; gap: 0.4rem; }

.field-group label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.field-group label .required {
  color: var(--maroon);
  margin-left: 2px;
}

.field-group label .hint {
  font-weight: 400;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 4px;
}

/* ---------- Inputs ---------- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-family: 'Source Serif 4', serif;
  font-size: 0.93rem;
  color: var(--text-primary);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(201,150,58,0.14);
  background: #fffdf8;
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); font-style: italic; font-size: 0.88rem; }

select {
  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='%236B1A2A' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

/* ---------- Radio & Checkbox Groups ---------- */
.radio-group, .checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding-top: 0.15rem;
}

.radio-label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--maroon);
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- File Upload ---------- */
.file-upload-wrap {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--ivory);
  padding: 1rem 1.25rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.file-upload-wrap:hover {
  border-color: var(--gold);
  background: #fffef9;
}

.file-upload-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  border: none;
  padding: 0;
}

.file-upload-wrap .upload-icon {
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
  color: var(--maroon);
  opacity: 0.6;
}

.file-upload-wrap p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.file-upload-wrap p strong {
  color: var(--maroon);
}

/* ---------- Photo Upload ---------- */
.photo-upload-area {
  width: 110px;
  height: 130px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--ivory);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.photo-upload-area:hover { border-color: var(--gold); }

.photo-upload-area input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
  padding: 0; border: none;
}

.photo-upload-area .photo-icon { font-size: 2rem; opacity: 0.35; }

.photo-upload-area span {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  padding: 0 0.4rem;
}

.photo-field-wrap {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.photo-field-wrap .photo-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
  padding-top: 0.25rem;
}

/* ---------- Table-style marks entry ---------- */
.marks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.marks-table th {
  background: var(--maroon);
  color: #fff;
  font-family: 'Source Serif 4', serif;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.55rem 0.85rem;
  text-align: left;
}

.marks-table th:first-child { border-radius: var(--radius) 0 0 0; }
.marks-table th:last-child  { border-radius: 0 var(--radius) 0 0; }

.marks-table td {
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--ivory-dark);
  vertical-align: middle;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.marks-table tr:nth-child(even) td { background: var(--ivory); }

.marks-table td input {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  font-size: 0.85rem;
  width: 100%;
  background: #fff;
  font-family: 'DM Mono', monospace;
}

.marks-table td input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,150,58,0.15);
}

/* ---------- Declaration ---------- */
.declaration-box {
  background: var(--ivory-dark);
  border: 1px solid var(--border);
  border-left: 3px solid var(--maroon);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-secondary);
  font-style: italic;
}

.declaration-box strong { color: var(--text-primary); font-style: normal; }

/* ---------- Signature Row ---------- */
.signature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.sig-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sig-line {
  border-bottom: 1.5px solid var(--text-primary);
  height: 44px;
  position: relative;
}

.sig-box .sig-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

/* ---------- Submit Button ---------- */
.submit-area {
  background: var(--ivory-dark);
  padding: 1.75rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-top: 1px solid var(--border);
}

.submit-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.5;
}

.submit-note strong { color: var(--maroon); }

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, var(--maroon-dark), var(--maroon));
  color: #fff;
  font-family: 'Source Serif 4', serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.75rem 2.25rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(74,15,28,0.30);
  position: relative;
  overflow: hidden;
}

.btn-submit::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold));
  opacity: 0;
  transition: opacity 0.2s;
}

.btn-submit:hover {
  background: linear-gradient(135deg, var(--maroon), var(--maroon-light));
  transform: translateY(-1px);
  box-shadow: 0 7px 20px rgba(74,15,28,0.35);
}

.btn-submit:hover::after { opacity: 1; }
.btn-submit:active { transform: translateY(0); }

.btn-reset {
  background: transparent;
  color: var(--text-muted);
  font-family: 'Source Serif 4', serif;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1.4rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.btn-reset:hover { color: var(--maroon); border-color: var(--maroon); }

/* ---------- Footer ---------- */
.form-footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.form-footer a { color: var(--maroon); text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  .letterhead { grid-template-columns: 1fr; text-align: center; }
  .logo-wrap   { margin: 0 auto; }
  .form-section { padding: 1.5rem 1.25rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3 { grid-column: span 1; }
  .submit-area { flex-direction: column; align-items: stretch; text-align: center; }
  .signature-row { grid-template-columns: 1fr; }
  .app-meta { flex-direction: column; gap: 0.25rem; }
  .marks-table { font-size: 0.78rem; }
  .marks-table th, .marks-table td { padding: 0.4rem 0.55rem; }
}

@media (max-width: 420px) {
  .header-text h1 { font-size: 1.1rem; }
  .btn-submit { width: 100%; justify-content: center; }
  .btn-reset  { width: 100%; }
}

/* ---------- Print ---------- */
@media print {
  body { background: white; font-size: 11pt; }
  .page-wrapper { padding: 0; max-width: 100%; }
  .letterhead { border-radius: 0; }
  .form-card   { border-radius: 0; box-shadow: none; }
  .btn-submit, .btn-reset, .file-upload-wrap { display: none; }
  input, select, textarea { border: 1px solid #999 !important; box-shadow: none !important; }
  .form-section { break-inside: avoid; }
}
