/* ============================================
   FORM STYLES — Rekrutmen BPP HIPMI
   Multi-Step Form with Progress Bar
   ============================================ */

/* ============================================
   FORM PAGE LAYOUT
   ============================================ */
.form-page {
    min-height: 100vh;
    background: var(--bg-main);
    padding-top: calc(var(--header-height) + 24px);
    padding-bottom: 60px;
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 24px;
    background: var(--gradient-hero);
    border-radius: var(--radius-xl);
    color: var(--text-on-primary);
    position: relative;
    overflow: hidden;
}

.form-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 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'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%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");
    pointer-events: none;
}

.form-header h1 {
    color: var(--text-on-primary);
    font-size: 1.6rem;
    margin-bottom: 8px;
    position: relative;
}

.form-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    position: relative;
}


/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-container {
    margin-bottom: 40px;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 3px;
    background: #E0DEF0;
    border-radius: 2px;
    z-index: 0;
}

.progress-line {
    position: absolute;
    top: 20px;
    left: 40px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    z-index: 1;
    transition: width var(--transition-slow);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    cursor: pointer;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 3px solid #E0DEF0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition-base);
}

.progress-step.active .step-circle {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-surface);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.15);
}

.progress-step.completed .step-circle {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--text-on-primary);
}

.progress-step.completed .step-circle::after {
    content: '✓';
    font-size: 1rem;
}

.progress-step.completed .step-circle .step-num {
    display: none;
}

.step-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    max-width: 80px;
    transition: color var(--transition-fast);
}

.progress-step.active .step-label,
.progress-step.completed .step-label {
    color: var(--accent);
}


/* ============================================
   FORM CONTAINER
   ============================================ */
.form-wrapper {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 48px;
    box-shadow: var(--shadow-card);
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.form-step {
    display: none;
    animation: fadeInStep 0.4s ease-out;
}

.form-step.active {
    display: block;
}

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

.step-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--bg-main);
}

.step-title .step-icon {
    width: 48px;
    height: 48px;
    background: var(--tag-bg);
    color: var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.step-title h2 {
    font-size: 1.3rem;
}

.step-title p {
    font-size: 0.85rem;
    margin-top: 4px;
}


/* ============================================
   FORM FIELDS
   ============================================ */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-row.single {
    grid-template-columns: 1fr;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

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

.form-group label .optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 2px solid #E0DEF0;
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-fast);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.1);
}

.form-control.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-control.success {
    border-color: var(--success);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239B98B8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 6px;
    display: none;
}

.form-group.has-error .form-error {
    display: block;
}

.form-group.has-error .form-control {
    border-color: var(--danger);
}

/* Character Counter */
.char-counter {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}


/* ============================================
   FILE UPLOAD AREA
   ============================================ */
.upload-area {
    border: 2px dashed #D0CDEF;
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: var(--bg-surface-alt);
    position: relative;
}

.upload-area:hover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.04);
}

.upload-area.dragover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.08);
    transform: scale(1.01);
}

.upload-area.uploaded {
    border-color: var(--success);
    border-style: solid;
    background: rgba(34, 197, 94, 0.04);
}

.upload-area input[type="file"] {
    display: none;
}

.upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--tag-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
}

.upload-area.uploaded .upload-icon {
    background: var(--success-light);
    color: var(--success);
}

.upload-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-text span {
    color: var(--accent);
    font-weight: 600;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Upload Preview */
.upload-preview {
    display: none;
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid #E0DEF0;
}

.upload-area.uploaded .upload-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.upload-preview .file-info {
    flex: 1;
    text-align: left;
}

.upload-preview .file-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.upload-preview .file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-preview .file-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
}

.upload-preview .remove-file {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--danger-light);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    font-size: 1.1rem;
}

.upload-preview .remove-file:hover {
    background: var(--danger);
    color: white;
}

/* Upload Grid (for multiple uploads on same row) */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Upload Success Checkmark */
.upload-check {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    animation: scaleIn 0.3s var(--transition-spring);
}

.upload-area.uploaded .upload-check {
    display: flex;
}


/* ============================================
   DYNAMIC REKOMENDASI SECTION
   ============================================ */
.rekomendasi-container {
    border: 2px solid #E0DEF0;
    border-radius: var(--radius-lg);
    padding: 24px;
    background: var(--bg-surface-alt);
}

.rekomendasi-item {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #E0DEF0;
    position: relative;
    animation: fadeInStep 0.3s ease-out;
}

.rekomendasi-item .item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.rekomendasi-item .item-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--tag-bg);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

.rekomendasi-item .remove-item {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--danger-light);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

.rekomendasi-item .remove-item:hover {
    background: var(--danger);
    color: white;
}

.add-rekomendasi-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: 2px dashed #D0CDEF;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-rekomendasi-btn:hover {
    border-color: var(--accent);
    background: rgba(108, 99, 255, 0.04);
}

.rekomendasi-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--info-light);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: #1e40af;
    margin-bottom: 16px;
}


/* ============================================
   REVIEW STEP (Step 6)
   ============================================ */
.review-section {
    margin-bottom: 28px;
}

.review-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--tag-bg);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.review-section-header h3 {
    font-size: 0.95rem;
    color: var(--tag-text);
}

.review-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
    padding: 0 16px;
}

.review-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 0;
}

.review-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    padding: 6px 0;
    word-break: break-word;
}

.review-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px;
}

.review-file-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--success-light);
    color: #15803d;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.review-file-badge .check {
    color: var(--success);
}

/* Agreement Checkbox */
.agreement-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
    background: var(--bg-surface-alt);
    border-radius: var(--radius-md);
    border: 2px solid #E0DEF0;
    margin-top: 24px;
    cursor: pointer;
}

.agreement-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    margin-top: 2px;
    flex-shrink: 0;
}

.agreement-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    cursor: pointer;
}


/* ============================================
   FORM NAVIGATION BUTTONS
   ============================================ */
.form-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 2px solid var(--bg-main);
}

.btn-prev {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-surface-alt);
    color: var(--text-secondary);
    border: 2px solid #E0DEF0;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-prev:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-next {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: var(--gradient-accent);
    color: var(--text-on-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.35);
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--accent-rgb), 0.45);
}

.btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-submit {
    background: var(--gradient-primary);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.35);
}

.btn-submit:hover {
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.45);
}


/* ============================================
   AUTO-SAVE INDICATOR
   ============================================ */
.autosave-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0;
    transform: translateY(20px);
    transition: all var(--transition-base);
    z-index: 100;
}

.autosave-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

.autosave-indicator .save-icon {
    font-size: 1rem;
}

/* Download Template Link */
.download-template {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 16px;
    transition: all var(--transition-fast);
}

.download-template:hover {
    background: var(--accent-light);
    color: var(--primary);
}


/* ============================================
   LOADING / SUBMITTING OVERLAY
   ============================================ */
.form-loading {
    position: fixed;
    inset: 0;
    background: rgba(30, 28, 94, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    flex-direction: column;
    gap: 24px;
}

.form-loading.active {
    display: flex;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-on-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.loading-subtext {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}


/* ============================================
   SUCCESS PAGE
   ============================================ */
.success-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    padding: 24px;
}

.success-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 64px 48px;
    text-align: center;
    max-width: 560px;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.5s ease-out;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-light);
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 24px;
    animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3); }
    50% { box-shadow: 0 0 0 15px rgba(34, 197, 94, 0); }
}

.success-card h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.success-card .reg-number {
    display: inline-block;
    padding: 10px 24px;
    background: var(--tag-bg);
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: var(--radius-md);
    margin: 16px 0 24px;
    letter-spacing: 1px;
}

.success-card p {
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.success-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}


/* ============================================
   RESPONSIVE — FORM
   ============================================ */
@media (max-width: 768px) {
    .form-wrapper {
        padding: 28px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .upload-grid {
        grid-template-columns: 1fr;
    }

    .progress-steps {
        gap: 4px;
    }

    .step-label {
        display: none;
    }

    .step-circle {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    .review-grid {
        grid-template-columns: 1fr;
    }

    .review-label {
        font-weight: 700;
        color: var(--text-primary);
    }

    .form-nav {
        flex-direction: column-reverse;
        gap: 12px;
    }

    .btn-prev,
    .btn-next {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .form-header {
        padding: 28px 16px;
    }

    .form-header h1 {
        font-size: 1.3rem;
    }

    .upload-area {
        padding: 24px 16px;
    }

    .rekomendasi-container {
        padding: 16px;
    }

    .rekomendasi-item {
        padding: 16px;
    }

    .success-card {
        padding: 40px 24px;
    }

    /* Tap target lebih besar di mobile (>=40px) */
    .remove-file, .remove-item { width: 40px; height: 40px; }
    .btn-prev, .btn-next { padding: 14px 24px; }
}

/* ============================================
   Halaman form: pastikan link "Kembali ke Beranda" tetap tampil di mobile
   (style.css menyembunyikan .nav-links di <=768; form.php tidak punya hamburger)
   ============================================ */
@media (max-width: 768px) {
    .navbar .nav-links { display: flex; }
    .navbar .nav-links a { font-size: 0.85rem; padding: 6px 10px; }
}

/* Progress bar: rapikan garis & lingkaran di layar sangat kecil */
@media (max-width: 480px) {
    .progress-steps::before,
    .progress-line { left: 24px; right: 24px; }
    .step-circle { width: 32px; height: 32px; font-size: 0.75rem; }
}
