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

:root {
    --indigo: #4f46e5;
    --indigo-hover: #4338ca;
    --indigo-50: #eef2ff;
    --indigo-100: #e0e7ff;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --red-500: #ef4444;
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-600: #16a34a;
    --radius: 16px;
    --radius-sm: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--slate-50);
    color: var(--slate-800);
    line-height: 1.6;
}

.hidden { display: none !important; }

/* ---- Hero ---- */
.hero {
    position: relative;
    height: 300px;
    overflow: hidden;
}
.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.05);
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15,23,42,.8), rgba(15,23,42,.4), transparent);
}
.hero-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 24px;
}
.hero-content h1 {
    font-size: 40px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.hero-content p {
    color: #c7d2fe;
    font-size: 17px;
    max-width: 600px;
    font-weight: 500;
}

/* ---- Form Main ---- */
.form-main {
    max-width: 900px;
    width: 100%;
    margin: -64px auto 0;
    padding: 0 24px 96px;
    position: relative;
    z-index: 10;
}

/* ---- Form Section Card ---- */
.form-section {
    background: #fff;
    padding: 28px 32px;
    border-radius: var(--radius);
    border: 1px solid var(--slate-100);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.section-icon {
    padding: 12px;
    background: var(--indigo-50);
    border-radius: var(--radius-sm);
    color: var(--indigo);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--slate-800);
}

.section-desc {
    font-size: 14px;
    color: var(--slate-500);
    margin-top: 2px;
}

/* ---- Fields Grid ---- */
.fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.fields-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full-width { grid-column: 1 / -1; }

.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-700);
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--slate-800);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.small-input { max-width: 200px; }
.half-width { max-width: 50%; }

/* Input with icon */
.input-icon {
    position: relative;
}
.input-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--slate-400);
    pointer-events: none;
}
.input-icon.textarea-icon i {
    top: 14px;
    transform: none;
}
.input-icon input,
.input-icon select,
.input-icon textarea {
    padding-left: 40px;
}

/* ---- Checkbox ---- */
.checkbox-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--indigo-50);
    border: 1px solid var(--indigo-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.checkbox-field input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--indigo);
    flex-shrink: 0;
}
.checkbox-field span {
    font-size: 14px;
    font-weight: 500;
    color: var(--slate-700);
}
.bed-check {
    background: var(--green-50);
    border-color: var(--green-100);
    margin-bottom: 20px;
}
.bed-check input[type="checkbox"] {
    accent-color: var(--green-600);
}

/* ---- Photo Section ---- */
.photo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.photo-preview {
    position: relative;
    width: 192px;
    height: 192px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--slate-100);
    border: 2px dashed var(--slate-300);
    display: flex;
    align-items: center;
    justify-content: center;
}
.photo-placeholder {
    font-size: 64px;
    color: var(--slate-300);
}
.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--red-500);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s;
}
.photo-preview:hover .photo-remove { opacity: 1; }

.photo-actions {
    display: flex;
    gap: 16px;
    max-width: 360px;
    width: 100%;
}
.btn-capture, .btn-upload {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
    border: none;
}
.btn-capture {
    background: var(--indigo-50);
    color: var(--indigo);
    border: 1px solid var(--indigo-100);
}
.btn-capture:hover { background: var(--indigo-100); }
.btn-upload {
    background: var(--slate-900);
    color: #fff;
}
.btn-upload:hover { background: var(--slate-800); }

/* ---- Academic Sub-sections ---- */
.academic-content { width: 100%; }

.sub-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--slate-800);
    margin-bottom: 12px;
}

.dynamic-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--slate-100);
}

.dynamic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.btn-add {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--indigo);
    background: none;
    border: none;
    cursor: pointer;
    transition: color .2s;
}
.btn-add:hover { color: var(--indigo-hover); }

.degree-card {
    position: relative;
    background: var(--slate-50);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-200);
    margin-bottom: 12px;
}

.degree-card .remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--slate-200);
    color: var(--red-500);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.degree-card .remove-btn:hover { background: #fef2f2; }

.degree-card .fields-grid { gap: 12px; }

/* ---- Experience Block ---- */
.exp-card {
    position: relative;
    background: var(--slate-50);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--slate-200);
    margin-bottom: 16px;
}
.exp-card .remove-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    font-size: 18px;
}
.exp-card .remove-btn:hover { color: var(--red-500); }

.btn-add-dashed {
    width: 100%;
    padding: 16px;
    border: 2px dashed var(--indigo-100);
    border-radius: var(--radius);
    background: none;
    color: var(--indigo);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .2s, border-color .2s;
}
.btn-add-dashed:hover {
    background: var(--indigo-50);
    border-color: var(--indigo);
}

/* ---- Submit Button ---- */
.submit-bar {
    position: sticky;
    bottom: 24px;
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--indigo);
    color: #fff;
    padding: 16px 40px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(79,70,229,.25);
    transition: background .2s, transform .2s, box-shadow .2s;
}
.btn-submit:hover {
    background: var(--indigo-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(79,70,229,.35);
}
.btn-submit:active { transform: scale(.98); }
.btn-submit:disabled { opacity: .7; cursor: not-allowed; transform: none; }

/* ---- Footer ---- */
.form-footer {
    margin-top: 96px;
    padding-bottom: 48px;
    text-align: center;
    color: var(--slate-400);
    font-size: 14px;
}

/* ---- Thank You Screen ---- */
#thankYouView {
    min-height: 100vh;
    background: var(--slate-50);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.ty-card {
    max-width: 520px;
    width: 100%;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.12);
    border: 1px solid var(--slate-100);
}
.ty-header {
    background: var(--indigo);
    padding: 48px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.ty-header::before, .ty-header::after {
    content: '';
    position: absolute;
    width: 256px;
    height: 256px;
    background: rgba(255,255,255,.08);
    border-radius: 50%;
    filter: blur(60px);
}
.ty-header::before { top: -80px; right: -80px; }
.ty-header::after { bottom: -80px; left: -80px; }
.ty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 50%;
    margin-bottom: 20px;
    font-size: 40px;
    color: var(--indigo);
}
.ty-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}
.ty-header p {
    color: #c7d2fe;
    font-size: 17px;
}
.ty-body {
    padding: 40px 32px;
    text-align: center;
}
.ty-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--slate-500);
    margin-bottom: 8px;
}
.ty-ref {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}
.ty-ref span {
    font-size: 36px;
    font-weight: 900;
    font-family: "Courier New", monospace;
    color: var(--slate-800);
    letter-spacing: -1px;
}
.ty-ref button {
    padding: 8px;
    background: none;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    border-radius: 8px;
    font-size: 18px;
    transition: color .2s, background .2s;
}
.ty-ref button:hover {
    color: var(--indigo);
    background: var(--indigo-50);
}
.ty-email-box {
    background: var(--slate-50);
    border: 1px solid var(--slate-100);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}
.ty-email-box i { color: var(--indigo); font-size: 20px; }
.ty-email-box strong { color: var(--indigo); display: block; margin-top: 4px; }
.ty-email-box p { color: var(--slate-500); font-size: 14px; line-height: 1.7; margin-top: 8px; }
.ty-email-box p strong { color: var(--slate-900); display: inline; }
.ty-note {
    color: var(--slate-500);
    font-style: italic;
    font-size: 14px;
    margin-bottom: 32px;
    line-height: 1.7;
}
.ty-back {
    background: none;
    border: none;
    color: var(--indigo);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: gap .2s;
}
.ty-back:hover { gap: 12px; }
.ty-footer {
    background: var(--slate-50);
    border-top: 1px solid var(--slate-100);
    padding: 16px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--slate-400);
}

/* ---- Camera Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}
.camera-modal {
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.camera-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--slate-100);
}
.camera-header h3 { font-weight: 700; color: var(--slate-800); }
.camera-header button {
    font-size: 24px;
    background: none;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
}
.camera-header button:hover { color: var(--red-500); }
#cameraVideo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #000;
    display: block;
}
.camera-actions { padding: 20px; }
.camera-actions .btn-submit { width: 100%; justify-content: center; }

/* ---- Email Confirmation Modal ---- */
.email-modal {
    background: #fff;
    border-radius: 24px;
    max-width: 420px;
    width: 100%;
    padding: 32px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.email-modal-icon {
    width: 56px;
    height: 56px;
    background: var(--indigo-50);
    color: var(--indigo);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 16px;
}
.email-modal h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: 8px;
}
.email-modal p {
    font-size: 14px;
    color: var(--slate-500);
    margin-bottom: 24px;
    line-height: 1.5;
}
.email-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.btn-email-yes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--indigo);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.btn-email-yes:hover { background: var(--indigo-hover); }
.btn-email-no {
    padding: 12px 24px;
    background: none;
    color: var(--slate-500);
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.btn-email-no:hover { background: var(--slate-50); }

/* ---- Phase 2 Intro Modal ---- */
.phase2-modal {
    background: #fff;
    border-radius: 24px;
    max-width: 480px;
    width: 100%;
    padding: 36px 32px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: modalSlideUp .3s ease;
}
.phase2-modal-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    margin: 0 auto 12px;
}
.phase2-badge {
    display: inline-block;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}
.phase2-modal h3 {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 12px;
}
.phase2-greeting {
    font-size: 14px;
    color: #475569;
    margin-bottom: 20px;
    line-height: 1.6;
}
.phase2-info-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    text-align: left;
    margin-bottom: 24px;
}
.phase2-info-box > p {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
}
.phase2-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.phase2-checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #475569;
    line-height: 1.5;
}
.phase2-checklist li i {
    color: #4f46e5;
    margin-top: 1px;
    flex-shrink: 0;
}
.phase2-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.btn-phase2-yes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s;
}
.btn-phase2-yes:hover { opacity: .9; }
.btn-phase2-later {
    padding: 12px 24px;
    background: none;
    color: #64748b;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s;
}
.btn-phase2-later:hover { background: #f1f5f9; }
.phase2-later-note {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 12px;
    margin-bottom: 0;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero { height: 220px; }
    .hero-content h1 { font-size: 28px; }
    .hero-content p { font-size: 14px; }
    .form-main { margin-top: -40px; padding: 0 16px 80px; }
    .form-section { padding: 20px; }
    .fields-grid { grid-template-columns: 1fr; }
    .fields-grid.cols-4 { grid-template-columns: 1fr 1fr; }
    .submit-bar { position: fixed; bottom: 0; left: 0; right: 0; padding: 16px; background: #fff; border-top: 1px solid var(--slate-200); z-index: 50; }
    .btn-submit { width: 100%; justify-content: center; }
    .photo-actions { flex-direction: column; }
    .half-width { max-width: 100%; }
}

@media (max-width: 480px) {
    .fields-grid.cols-4 { grid-template-columns: 1fr; }
}

/* ---- CV Upload Section ---- */
.cv-upload-section {
    border: 2px solid #fbbf24;
    background: #fffef5;
}
.cv-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    border: 2px dashed var(--slate-300);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    text-align: center;
}
.cv-upload-area:hover,
.cv-upload-area.dragover {
    border-color: var(--indigo);
    background: var(--indigo-50);
}
.cv-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    margin-top: 12px;
}
.cv-status.loading {
    background: #eef2ff;
    color: var(--indigo);
}
.cv-status.success {
    background: #dcfce7;
    color: #15803d;
}
.cv-status.error {
    background: #fee2e2;
    color: #dc2626;
}
.cv-status .spinner {
    width: 18px;
    height: 18px;
    border: 3px solid var(--indigo-100);
    border-top-color: var(--indigo);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Highlight auto-filled fields */
.auto-filled {
    background: #fefce8 !important;
    border-color: #fbbf24 !important;
    transition: background 2s, border-color 2s;
}
