/**
 * ============================================================
 * YOL HR Agency - Form Styles
 * Application Form, Wizard, Validation
 * ============================================================
 * Developer: Рафиков Камилжан (Rafikov Kamilzhan)
 * Contact: +7 776 952 1020, +7 708 712 3023
 * ============================================================
 */

/* ============================================
   Form Wizard Container
   ============================================ */
.form-wizard {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto 40px;
}

/* Progress Steps */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    padding: 24px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    position: relative;
}
.wizard-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #dee2e6;
    transform: translateY(-50%);
    z-index: 1;
}
.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}
.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #dee2e6;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 6px;
    transition: all 0.3s;
}
.step-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-align: center;
    font-weight: 500;
}
.progress-step.active .step-number {
    background: #4361ee;
    border-color: #4361ee;
    color: #fff;
    box-shadow: 0 0 0 4px rgba(67,97,238,0.2);
}
.progress-step.active .step-label { color: #4361ee; font-weight: 600; }
.progress-step.completed .step-number {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}
.progress-step.completed .step-number::after { content: '✓'; font-weight: 600; }
.progress-step.completed .step-number span { display: none; }

/* Error Container */
.wizard-errors {
    padding: 0 40px;
    padding-top: 20px;
}
.wizard-errors .alert ul {
    margin: 8px 0 0;
    padding-left: 20px;
}
.wizard-errors .alert li {
    font-size: 0.9rem;
    margin-bottom: 2px;
}

/* Wizard Body */
.wizard-body { padding: 40px; }
.form-step { display: none; animation: fadeIn 0.3s ease; }
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.step-title {
    font-size: 22px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
}
.step-title .text-accent { color: #4361ee; }

/* Form Layout */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 0;
}
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}
.form-label.required::after { content: ' *'; color: #dc3545; }
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
}
.form-control:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}
.form-control.form-control-sm { padding: 6px 10px; font-size: 13px; }
.form-hint { font-size: 12px; color: #6c757d; margin-top: 4px; }

/* ============================================
   Validation Styles
   ============================================ */
.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220,53,69,0.1);
}
.field-error {
    font-size: 12px;
    color: #dc3545;
    margin-top: 4px;
    min-height: 0;
}
.field-hint-popup {
    position: absolute;
    background: #dc3545;
    color: #fff;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    margin-top: 2px;
    z-index: 10;
    animation: fadeIn 0.2s;
    white-space: nowrap;
}

/* Age Display */
.age-display {
    font-size: 13px;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.age-display.age-ok { background: #d4edda; color: #155724; }
.age-display.age-bad { background: #f8d7da; color: #721c24; }

/* Vacancy Info */
.vacancy-info {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    padding: 8px 12px;
    background: #e8f4fd;
    border-radius: 6px;
    font-size: 13px;
    color: #1a365d;
    flex-wrap: wrap;
}
.vacancy-info span { display: flex; align-items: center; gap: 4px; }
.vacancy-info i { font-size: 11px; opacity: 0.7; }

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    line-height: 1.5;
}
.alert-warning { background: #fff3cd; border: 1px solid #ffeaa7; color: #856404; }
.alert-info { background: #d1ecf1; border: 1px solid #bee5eb; color: #0c5460; }
.alert-danger { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }
.alert i { font-size: 18px; flex-shrink: 0; margin-top: 2px; }

/* ============================================
   Language Table (Radio - one level per lang)
   ============================================ */
.languages-grid { overflow-x: auto; }
.form-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}
.form-table th, .form-table td {
    border: 1px solid #dee2e6;
    padding: 12px;
    text-align: center;
    vertical-align: middle;
}
.form-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
}
.form-table th small { font-weight: normal; color: #6c757d; display: block; margin-top: 2px; }
.form-table td.lang-name { text-align: left; background: #f8f9fa; }
.language-radio {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #4361ee;
}

/* Language clear buttons */
.lang-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.lang-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid #dc3545;
    color: #dc3545;
    background: #fff;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s;
}
.lang-clear-btn:hover { background: #dc3545; color: #fff; }

/* ============================================
   File Upload
   ============================================ */
.file-upload { position: relative; margin-bottom: 10px; }
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
}
.file-upload-area:hover { border-color: #4361ee; background: rgba(67,97,238,0.02); }
.file-upload-area.dragover { border-color: #4361ee; background: rgba(67,97,238,0.05); }
.file-upload-area.has-file { border-color: #28a745; background: rgba(40,167,69,0.04); }
.file-upload-icon { font-size: 42px; color: #adb5bd; margin-bottom: 12px; }
.file-upload-text { color: #495057; margin-bottom: 4px; font-size: 15px; }
.file-upload-text strong { color: #4361ee; }
.file-upload-hint { font-size: 12px; color: #6c757d; }
.file-input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.file-preview { display: none; margin-top: 10px; }
.file-preview.show {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.file-preview-show { display: flex; align-items: center; gap: 12px; width: 100%; }
.file-preview-thumb { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; border: 1px solid #dee2e6; }
.file-preview-icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; background: #4361ee; border-radius: 6px; color: #fff; font-size: 22px; }
.file-preview-info { flex: 1; }
.file-preview-name { font-weight: 600; color: #212529; font-size: 13px; word-break: break-all; }
.file-preview-size { font-size: 12px; color: #6c757d; margin-top: 2px; }
.file-preview-remove { color: #dc3545; cursor: pointer; padding: 6px; border: none; background: none; font-size: 16px; opacity: 0.7; transition: opacity 0.2s; }
.file-preview-remove:hover { opacity: 1; }

.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 16px 0;
}

/* ============================================
   Repeater Items
   ============================================ */
.repeater-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 12px;
}
.repeater-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}
.repeater-item-title { font-weight: 600; color: #495057; font-size: 15px; }
.repeater-item-remove {
    color: #dc3545;
    cursor: pointer;
    font-size: 18px;
    border: none;
    background: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.15s;
}
.repeater-item-remove:hover { background: rgba(220,53,69,0.1); }
.add-repeater-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4361ee;
    cursor: pointer;
    font-weight: 600;
    padding: 10px 18px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    transition: all 0.2s;
}
.add-repeater-btn:hover { border-color: #4361ee; background: rgba(67,97,238,0.02); }

/* ============================================
   Checkbox & Agreement
   ============================================ */
.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}
.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: #4361ee;
    flex-shrink: 0;
}
.agreement-text {
    background: #f8f9fa;
    border-left: 4px solid #4361ee;
    padding: 18px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    color: #495057;
}
.text-danger { color: #dc3545; }

/* ============================================
   Wizard Footer
   ============================================ */
.wizard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}
.wizard-step-info { font-size: 13px; color: #6c757d; font-weight: 500; }
.wizard-footer .btn {
    min-width: 140px;
    padding: 12px 22px;
    font-weight: 500;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.btn-primary { background: #4361ee; color: #fff; }
.btn-primary:hover { background: #3a56d4; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(67,97,238,0.25); }
.btn-success { background: #28a745; color: #fff; }
.btn-success:hover { background: #218838; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(40,167,69,0.25); }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-muted { color: #6c757d !important; font-size: 14px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }
.my-4 { margin-top: 20px; margin-bottom: 20px; }
hr { border: none; border-top: 2px solid #e9ecef; margin: 28px 0; }

/* ============================================
   Toast
   ============================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 22px;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    z-index: 10000;
    max-width: 380px;
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .form-wizard { margin: 0 10px 30px; }
    .wizard-progress { padding: 16px 10px; }
    .wizard-progress::before { display: none; }
    .step-number { width: 34px; height: 34px; font-size: 14px; }
    .step-label { font-size: 9px; }
    .wizard-body { padding: 20px; }
    .wizard-errors { padding: 0 20px; padding-top: 16px; }
    .form-row { grid-template-columns: 1fr; }
    .photo-upload-grid { grid-template-columns: 1fr; }
    .wizard-footer {
        flex-wrap: wrap;
        gap: 10px;
        padding: 16px 20px;
    }
    .wizard-footer .btn { min-width: auto; flex: 1; }
    .wizard-step-info { order: -1; width: 100%; text-align: center; }
    .step-title { font-size: 18px; }
    
    /* Language table scroll */
    .form-table { min-width: 550px; }
    .form-table th, .form-table td { padding: 8px 6px; font-size: 12px; }
    .language-radio { width: 22px; height: 22px; }
    
    /* iOS zoom fix */
    input[type="date"], input[type="month"], input[type="tel"],
    input[type="email"], input[type="number"], select.form-control {
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .step-label { display: none; }
    .wizard-body { padding: 16px; }
    .form-control { padding: 12px; }
    .step-title { font-size: 17px; flex-direction: column; align-items: flex-start; gap: 4px; }
    .toast { left: 10px; right: 10px; max-width: none; }
}
