/* ============================================
   TalentFlow - Corporación Leo Doncel
   Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --blue: #1a3a7e;
    --blue-light: #2a5ab8;
    --blue-pale: #edf2ff;
    --orange: #e67e22;
    --orange-light: #f39c12;
    --orange-pale: #fff8f0;
    --green: #27ae60;
    --red: #e74c3c;
    --gray-50: #f8f9fc;
    --gray-100: #f0f2f5;
    --gray-200: #e0e4ea;
    --gray-300: #c5cad4;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-700);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- HEADER ---- */
.app-header {
    background: linear-gradient(135deg, var(--blue) 0%, #0d2456 100%);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(26,58,126,0.3);
}
.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-icon {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--orange), var(--orange-light));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; color: #fff;
    letter-spacing: -0.5px;
}
.logo-img-header {
    width: 44px; height: 44px;
    border-radius: 10px;
    object-fit: contain;
    background: rgba(255,255,255,0.15);
    padding: 3px;
}
.logo-img-auth {
    width: 90px; height: 90px;
    object-fit: contain;
    margin: 0 auto 14px;
    display: block;
    border-radius: 16px;
}
.auth-logo {
    text-align: center; margin-bottom: 28px;
}
.logo-text h1 { font-size: 18px; font-weight: 700; color: #fff; line-height: 1.2; }
.logo-text span { font-size: 11px; color: rgba(255,255,255,0.7); font-weight: 400; }

.header-user {
    display: flex; align-items: center; gap: 12px;
    color: rgba(255,255,255,0.85); font-size: 13px;
}
.btn-logout {
    padding: 6px 16px; border-radius: 6px;
    background: rgba(255,255,255,0.15); color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer; font-size: 12px; font-weight: 500;
    transition: var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ---- STEPPER ---- */
.stepper-container {
    max-width: 960px; margin: 0 auto; padding: 24px 24px 0;
}
.stepper {
    display: flex; gap: 4px; margin-bottom: 28px;
    overflow-x: auto; padding-bottom: 4px;
}
.step-item {
    flex: 1; min-width: 90px;
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer; position: relative;
}
.step-circle {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--gray-200); color: var(--gray-400);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    transition: var(--transition);
    border: 3px solid transparent;
}
.step-label {
    font-size: 10px; margin-top: 6px; text-align: center;
    color: var(--gray-400); font-weight: 500;
    transition: var(--transition);
}
.step-line {
    position: absolute; top: 18px; left: calc(50% + 20px);
    width: calc(100% - 40px); height: 3px;
    background: var(--gray-200); transition: var(--transition);
}
.step-item:last-child .step-line { display: none; }

.step-item.active .step-circle {
    background: var(--blue); color: #fff;
    border-color: var(--blue-pale);
    box-shadow: 0 0 0 4px rgba(26,58,126,0.15);
}
.step-item.active .step-label { color: var(--blue); font-weight: 600; }

.step-item.completed .step-circle {
    background: var(--green); color: #fff;
}
.step-item.completed .step-label { color: var(--green); }
.step-item.completed .step-line { background: var(--green); }

/* ---- MAIN CONTENT ---- */
.main-container {
    max-width: 960px; margin: 0 auto; padding: 0 24px 40px;
}

/* ---- CARDS ---- */
.card {
    background: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--gray-100);
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 {
    font-size: 17px; font-weight: 700; color: var(--gray-800);
}
.card-header .badge {
    padding: 4px 12px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    background: var(--blue-pale); color: var(--blue);
}
.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px; border-top: 1px solid var(--gray-100);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--gray-50);
}

/* ---- FORM ELEMENTS ---- */
.form-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.form-group { margin-bottom: 0; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--gray-600); margin-bottom: 6px;
}
.form-group label .required {
    color: var(--red); margin-left: 2px;
}

.form-control {
    width: 100%; padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit;
    color: var(--gray-700);
    transition: var(--transition);
    background: #fff;
}
.form-control:focus {
    outline: none; border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26,58,126,0.1);
}
.form-control:disabled {
    background: var(--gray-100); color: var(--gray-400);
    cursor: not-allowed;
}
.form-control.error { border-color: var(--red); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint {
    font-size: 11px; color: var(--gray-400); margin-top: 4px;
}

/* ---- CHECKBOXES ---- */
.checkbox-group {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
}
.checkbox-group input[type="checkbox"] {
    width: 18px; height: 18px; border-radius: 4px;
    accent-color: var(--blue);
}
.checkbox-group label {
    font-size: 13px; color: var(--gray-600); cursor: pointer;
    margin-bottom: 0;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 22px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; font-family: inherit;
    cursor: pointer; border: 2px solid transparent;
    transition: var(--transition); text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    color: #fff;
    box-shadow: 0 2px 8px rgba(26,58,126,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(26,58,126,0.4); }

.btn-orange {
    background: linear-gradient(135deg, var(--orange), var(--orange-light));
    color: #fff;
    box-shadow: 0 2px 8px rgba(230,126,34,0.3);
}
.btn-orange:hover { transform: translateY(-1px); }

.btn-outline {
    background: transparent; color: var(--gray-600);
    border-color: var(--gray-200);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

.btn-danger {
    background: var(--red); color: #fff;
}
.btn-danger:hover { background: #c0392b; }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

.btn-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- FILE UPLOAD ---- */
.file-upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 24px; text-align: center;
    cursor: pointer; transition: var(--transition);
    background: var(--gray-50);
}
.file-upload-zone:hover, .file-upload-zone.dragover {
    border-color: var(--blue); background: var(--blue-pale);
}
.file-upload-zone .icon { font-size: 32px; margin-bottom: 8px; }
.file-upload-zone p { font-size: 13px; color: var(--gray-500); }
.file-upload-zone .file-name {
    margin-top: 8px; font-weight: 600; color: var(--blue);
    word-break: break-all;
}
.file-upload-zone input[type="file"] { display: none; }

/* ---- RECORD LISTS ---- */
.record-list { list-style: none; }
.record-item {
    padding: 14px 18px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center;
    transition: var(--transition);
    background: #fff;
}
.record-item:hover { border-color: var(--blue-light); box-shadow: var(--shadow); }
.record-item.deleted {
    background: #fff5f5; border-color: #fecaca;
    opacity: 0.7;
}
.record-info h4 { font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 2px; }
.record-info p { font-size: 12px; color: var(--gray-500); }
.record-actions { display: flex; gap: 6px; }

.tag {
    display: inline-block; padding: 2px 8px;
    border-radius: 4px; font-size: 10px; font-weight: 600;
}
.tag-blue { background: var(--blue-pale); color: var(--blue); }
.tag-orange { background: var(--orange-pale); color: var(--orange); }
.tag-green { background: #e8f8ef; color: var(--green); }
.tag-red { background: #fde8e8; color: var(--red); }

/* ---- AUTH PAGE ---- */
.auth-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0d2456 0%, var(--blue) 50%, #1a4a9e 100%);
    padding: 24px;
    position: relative; overflow: hidden;
}
.auth-page::before {
    content: ''; position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(230,126,34,0.15), transparent 70%);
    top: -200px; right: -200px; border-radius: 50%;
}
.auth-page::after {
    content: ''; position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(230,126,34,0.1), transparent 70%);
    bottom: -100px; left: -100px; border-radius: 50%;
}

.auth-card {
    background: #fff; border-radius: 20px;
    padding: 40px; max-width: 460px; width: 100%;
    box-shadow: var(--shadow-lg);
    position: relative; z-index: 1;
    animation: slideUp 0.6s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-logo {
    text-align: center; margin-bottom: 28px;
}
.auth-logo .logo-icon {
    width: 60px; height: 60px; margin: 0 auto 12px;
    font-size: 22px;
}
.auth-logo h1 { font-size: 24px; color: var(--gray-800); }
.auth-logo h1 span { color: var(--orange); }
.auth-logo p { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

.habeas-data {
    background: var(--gray-50); border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm); padding: 14px;
    font-size: 11px; color: var(--gray-600);
    line-height: 1.6; max-height: 120px;
    overflow-y: auto; margin-bottom: 16px;
}

.divider {
    text-align: center; margin: 20px 0;
    position: relative;
}
.divider::before {
    content: ''; position: absolute; top: 50%;
    left: 0; right: 0; height: 1px; background: var(--gray-200);
}
.divider span {
    background: #fff; padding: 0 16px;
    font-size: 12px; color: var(--gray-400);
    position: relative;
}

.link-btn {
    background: none; border: none; color: var(--blue);
    cursor: pointer; font-size: 13px; font-weight: 500;
    text-decoration: underline; font-family: inherit;
}
.link-btn:hover { color: var(--orange); }

/* ---- ALERTS ---- */
.alert {
    padding: 12px 18px; border-radius: var(--radius-sm);
    font-size: 13px; margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
}
.alert-info { background: var(--blue-pale); color: var(--blue); border: 1px solid #c7d7f7; }
.alert-success { background: #e8f8ef; color: var(--green); border: 1px solid #a8e6c1; }
.alert-warning { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }
.alert-danger { background: #fde8e8; color: var(--red); border: 1px solid #f8b4b4; }

/* ---- LOADING ---- */
.spinner {
    width: 32px; height: 32px; border-radius: 50%;
    border: 3px solid var(--gray-200);
    border-top-color: var(--blue);
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 12px;
}
.loading-overlay p { color: var(--gray-600); font-size: 14px; font-weight: 500; }

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; visibility: hidden;
    transition: var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: #fff; border-radius: var(--radius);
    max-width: 600px; width: 100%; max-height: 90vh;
    overflow-y: auto; box-shadow: var(--shadow-lg);
    transform: translateY(20px); transition: var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 18px; color: var(--gray-800); }
.modal-close {
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: var(--gray-100); cursor: pointer;
    font-size: 18px; color: var(--gray-500);
    display: flex; align-items: center; justify-content: center;
}
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--gray-100);
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .header-inner { padding: 12px 16px; }
    .logo-text h1 { font-size: 15px; }
    .logo-text span { font-size: 10px; }
    .main-container { padding: 0 12px 24px; }
    .stepper-container { padding: 12px 12px 0; }
    .card-body { padding: 14px; }
    .card-header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
    .card-header h2 { font-size: 15px; }
    .card-footer { padding: 12px 16px; flex-direction: column; gap: 10px; }
    .card-footer .btn { width: 100%; justify-content: center; }
    .auth-card { padding: 24px 18px; margin: 10px; max-width: 100%; }
    .auth-page { padding: 12px; }
    .auth-logo .logo-img-auth { width: 70px; height: 70px; }
    .auth-logo h1 { font-size: 20px; }
    
    /* Stepper horizontal scroll */
    .stepper {
        gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory; padding-bottom: 8px;
    }
    .step-item { min-width: 70px; flex-shrink: 0; scroll-snap-align: center; }
    .step-label { font-size: 8px; line-height: 1.2; }
    .step-circle { width: 28px; height: 28px; font-size: 11px; }
    .step-line { display: none; }
    
    /* Record items stack */
    .record-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .record-actions { width: 100%; display: flex; gap: 6px; }
    .record-actions .btn { flex: 1; justify-content: center; text-align: center; }
    
    /* Modals fullscreen */
    .modal-overlay { padding: 0; }
    .modal { max-width: 100%; max-height: 100vh; border-radius: 0; height: 100vh; }
    .modal-body { padding: 16px; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; min-width: 120px; justify-content: center; }
    
    /* Buttons */
    .btn { padding: 10px 16px; font-size: 13px; }
    .btn-lg { padding: 12px 24px; font-size: 15px; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; justify-content: center; }
    
    /* Header user */
    .header-user { gap: 8px; }
    .header-user span { font-size: 11px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    
    /* Toast */
    .toast-container { top: 10px; right: 10px; left: 10px; }
    .toast { min-width: auto; font-size: 12px; padding: 10px 14px; }
    
    /* Review grid */
    .review-grid { grid-template-columns: 1fr; }
    
    /* Habeas data */
    .habeas-data { font-size: 10px; max-height: 100px; }
    
    /* File inputs */
    .form-control { font-size: 16px; /* prevent iOS zoom */ }
    select.form-control { font-size: 16px; }
}

@media (max-width: 400px) {
    .auth-logo h1 { font-size: 18px; }
    .card-header h2 { font-size: 14px; }
    .step-item { min-width: 60px; }
    .step-circle { width: 26px; height: 26px; font-size: 10px; }
    .logo-img-header { width: 34px; height: 34px; }
}

/* ---- TOAST ---- */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 14px 20px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    box-shadow: var(--shadow-lg); min-width: 280px;
    animation: toastIn 0.4s ease;
    display: flex; align-items: center; gap: 10px;
}
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--red); color: #fff; }
.toast.info { background: var(--blue); color: #fff; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---- REVIEW PAGE ---- */
.review-section { margin-bottom: 16px; }
.review-section h3 {
    font-size: 15px; font-weight: 700; color: var(--blue);
    padding-bottom: 6px; border-bottom: 2px solid var(--blue-pale);
    margin-bottom: 10px;
}
.review-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}
.review-field label { font-size: 10px; color: var(--gray-400); text-transform: uppercase; display: block; }
.review-field span { font-size: 13px; font-weight: 500; color: var(--gray-800); }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center; padding: 40px 20px;
    color: var(--gray-400);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }