@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #f3f4f6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --white: #ffffff;
    --background: #f9fafb;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --border-radius: 0.5rem;
}

html[lang="ar"] body,
html[lang="ar"] input,
html[lang="ar"] select,
html[lang="ar"] textarea,
html[lang="ar"] button {
    font-family: 'Almarai', sans-serif !important;
}

/* Language Toggle Switch */
/* Language Toggle Switch */
.lang-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #9ca3af;
    /* Gray-400 */
    cursor: pointer;
    transition: color 0.3s;
}

.lang-label.active {
    color: #1f2937;
    /* Gray-800 */
    font-weight: 700;
}

.status-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

html[dir="rtl"] .status-card-header {
    flex-direction: row-reverse;
}

.applicant-info-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

html[dir="rtl"] .applicant-info-header {
    flex-direction: row-reverse;
}

.applicant-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: #e2e8f0;
    border: 3px solid var(--white);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.applicant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.applicant-header-text h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
}

.applicant-header-text p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.875rem;
}

.btn-edit-status {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f3f4f6;
    color: var(--text-color);
    border: 1px solid #d1d5db;
}

.btn-edit-status:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    text-decoration: none;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    /* Slate-300 */
    -webkit-transition: .3s;
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .3s;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:focus+.slider {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    /* Primary transparent ring */
}

input:checked+.slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}


.status-section-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    border-inline-start: 5px solid var(--primary-color);
    padding-inline-start: 1rem;
    line-height: 1.2;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #111827;
    margin-top: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Auth Navbar for Language Switcher */
.auth-navbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: flex-end;
    /* Always align to right, regardless of RTL */
    align-items: center;
    padding: 0 2rem;
    box-sizing: border-box;
    z-index: 100;
}

/* Force LTR direction for the navbar container to keep switcher on top-right */
html[dir="rtl"] .auth-navbar {
    direction: ltr;
}

/* Auth Pages */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('fond.jpg') no-repeat center center fixed;
    background-size: cover;
}

.login-container {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: var(--border-radius);
    font-size: 1rem;
    box-sizing: border-box;
    /* Important for padding */
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    text-decoration: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.alert {
    padding: 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
}

.alert.error {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert.success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert.warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Dashboard Layout */
.dashboard-nav {
    background-color: var(--white);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: #111827;
}

.nav-links a {
    color: var(--text-light);
    margin-left: 1.5rem;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text-color);
    text-decoration: none;
}

/* Status Cards */
.status-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    margin-top: 2rem;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Background line (grey) */
.status-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    height: 6px;
    background-color: #e5e7eb;
    z-index: 0;
    border-radius: 99px;
}

/* Colored line overlay - Width controlled by JS or inline style would be best, but we'll use classes */
.status-steps::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    height: 6px;
    background: linear-gradient(to right, #fbbf24, #f97316, #10b981);
    /* Gradiant option if full */
    width: 0%;
    z-index: 0;
    border-radius: 99px;
    transition: width 0.5s ease;
}

/* Status specific widths for the line */
.status-steps.status-yellow::after,
.status-steps.status-vrpg_pending::after {
    width: 0%;
}

.status-steps.status-orange::after,
.status-steps.status-vrpg_ready::after {
    width: 50%;
    background: linear-gradient(to right, #fbbf24, #f97316);
}

.status-steps.status-green::after {
    width: 100%;
    background: linear-gradient(to right, #fbbf24, #f97316, #10b981);
}


.step {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Remove old per-step line */
.step::before {
    display: none;
}

.step-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: #e5e7eb;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-weight: bold;
    border: 4px solid var(--white);
    /* White ring to separate from line */
    transition: all 0.3s ease;
}

/* Active States */
.step.active .step-icon.step-yellow {
    background-color: #fbbf24;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px #fcd34d66;
}

.step.active .step-icon.step-orange {
    background-color: #f97316;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px #fdba7466;
}

.step.active .step-icon.step-green {
    background-color: #10b981;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 0 4px #6ee7b766;
}

.step-title {
    margin-top: 0.75rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6b7280;
    transition: color 0.3s;
}

.step.active .step-title {
    color: #111827;
}

.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-yellow {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-orange {
    background-color: #ffedd5;
    color: #9a3412;
}

.badge-green {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-red {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Diploma Selection Styles */
.diploma-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.diploma-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    user-select: none;
}

.diploma-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1), 0 4px 6px -2px rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
}

.diploma-card.selected {
    border-color: var(--primary-color);
    background-color: #eff6ff;
    box-shadow: 0 0 0 1px var(--primary-color);
}

.diploma-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.4;
}

.diploma-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    margin-left: 1rem;
}

html[dir="rtl"] .diploma-switch {
    margin-left: 0;
    margin-right: 1rem;
}

.diploma-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.diploma-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s ease;
    border-radius: 34px;
}

.diploma-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.diploma-switch input:checked+.slider {
    background-color: var(--primary-color);
}

.diploma-switch input:checked+.slider:before {
    transform: translateX(22px);
}

/* Animations for card status */
.diploma-card .check-icon {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s ease;
    color: var(--primary-color);
}

html[dir="rtl"] .diploma-card .check-icon {
    right: auto;
    left: 0.5rem;
}

.diploma-card.selected .check-icon {
    opacity: 1;
    transform: scale(1);
}

/* Profile Photo Upload Styles */
.personal-section-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .personal-section-grid {
        grid-template-columns: 1fr;
        justify-items: center;
    }
}

.profile-upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 16px;
    border: 2px dashed #e2e8f0;
    transition: all 0.3s ease;
    width: 200px;
    box-sizing: border-box;
}

.profile-upload-container:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.profile-preview-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid var(--white);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.profile-preview-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-preview-wrapper .placeholder-icon {
    color: #94a3b8;
    width: 50px;
    height: 50px;
}

.upload-btn-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.upload-btn-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
}

.btn-upload-label {
    padding: 0.5rem 1.25rem;
    background: var(--white);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-upload-label:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    max-width: 550px;
    width: 90%;
    max-height: 85vh;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    display: flex;
    flex-direction: column;
    animation: modal-appear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.modal-body {
    text-align: center;
    direction: rtl;
    line-height: 1.2;
    /* Restoring a tiny bit of breathing room as 1 is very tight */
    margin-bottom: 1.5rem;
    color: #4b5563;
    font-size: 1rem;
    white-space: pre-line;
    overflow-y: auto;
    padding: 0 10px;
    /* Balanced padding */
    flex-grow: 1;
    font-family: 'Almarai', sans-serif !important;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

html[lang="fr"] .modal-body {
    text-align: center;
    direction: ltr;
    padding: 0 10px;
}

.modal-footer {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.btn-close-modal {
    padding: 0.8rem 3rem;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-close-modal:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}