/* ========================================
   ROOT VARIABLES
   ======================================== */
:root {
    --purple-900: #663D7D;
    --purple-800: #B084B8;
    --purple-700: #583A78;
    --purple-600: #65377A;
    --purple-500: #AB31CC;
    --purple-400: #AB47BC;
    --purple-300: #CBA1D4;
    --purple-200: #E1BEE7;
    --purple-100: #F3E5F5;
    --purple-50: #F8F0FA;
    --silver-300: #B0B0B0;
    --silver-200: #D0D0D0;
    --silver-100: #E8E8E8;
    --silver-50: #F5F5F5;
    --white: #FFFFFF;
    --black: #1A1A2E;
    --text-primary: #1A0533;
    --text-secondary: #4A4A6A;
    --shadow-color: rgba(74, 20, 140, 0.25);
    --shadow-sm: 0 2px 8px rgba(74, 20, 140, 0.12);
    --shadow-md: 0 4px 20px rgba(74, 20, 140, 0.18);
    --shadow-lg: 0 8px 40px rgba(74, 20, 140, 0.25);
    --shadow-xl: 0 12px 60px rgba(74, 20, 140, 0.35);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   RESET
   ======================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Cairo', 'Inter', system-ui, sans-serif;
    background: linear-gradient(135deg, var(--purple-50) 0%, var(--silver-50) 100%);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}
html[dir="ltr"] body { font-family: 'Inter', 'Cairo', system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }

/* ========================================
   HEADER
   ======================================== */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--purple-100);
    box-shadow: var(--shadow-sm);
}
.header-inner {
    max-width: 1280px; margin: 0 auto;
    padding: 14px 24px;
    display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 12px;
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: var(--white);
    display: grid; place-items: center;
    font-weight: 700; font-size: 20px;
    box-shadow: var(--shadow-md);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-weight: 700; color: var(--purple-700); font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--text-secondary); }

.main-nav { display: flex; gap: 22px; margin-inline-start: auto; }
.main-nav a {
    font-weight: 600; font-size: 14px; color: var(--text-secondary);
    padding: 8px 4px; position: relative;
    transition: var(--transition);
}
.main-nav a:hover { color: var(--purple-500); }
.main-nav a::after {
    content: ''; position: absolute; bottom: 0; inset-inline: 0;
    height: 2px; background: var(--purple-500);
    transform: scaleX(0); transform-origin: center;
    transition: var(--transition);
}
.main-nav a:hover::after { transform: scaleX(1); }

.lang-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: var(--radius-sm);
    background: var(--purple-100); color: var(--purple-700);
    font-weight: 600; font-size: 13px; cursor: pointer;
    border: 1px solid var(--purple-200);
    transition: var(--transition);
}
.lang-btn:hover { background: var(--purple-200); box-shadow: var(--shadow-sm); }

/* ========================================
   LAYOUT
   ======================================== */
.site-main { max-width: 1280px; margin: 0 auto; padding: 40px 24px 80px; }

.hero {
    text-align: center; padding: 60px 20px 40px;
}
.hero h1 {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700; color: var(--purple-700);
    margin-bottom: 12px;
}
.hero p { color: var(--text-secondary); font-size: 16px; }

.section { margin-bottom: 60px; }
.section-head {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 26px;
}
.section-head h2 {
    font-size: clamp(20px, 2.4vw, 26px);
    color: var(--purple-700); font-weight: 700;
}
.count-badge {
    background: var(--purple-500); color: var(--white);
    font-size: 12px; font-weight: 700;
    padding: 3px 12px; border-radius: 999px;
}

/* ========================================
   JOB CARDS GRID
   ======================================== */
.jobs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}
.jobs-grid--muted { opacity: 0.75; }

.job-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--purple-100);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex; flex-direction: column;
    min-height: 220px;
}
.job-card::before {
    content: ''; position: absolute; top: 0; inset-inline: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--purple-500), var(--purple-300));
    transform: scaleX(0); transform-origin: inline-start;
    transition: var(--transition);
}
.job-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--purple-300);
}
.job-card:hover::before { transform: scaleX(1); }

.job-card--closed { cursor: pointer; }
.job-card--closed:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.job-card-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px;
}
.job-code {
    font-size: 12px; font-weight: 700;
    color: var(--purple-600);
    background: var(--purple-100);
    padding: 4px 10px; border-radius: 6px;
}
.job-status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #22C55E;
    box-shadow: 0 0 0 4px rgba(34,197,94,0.15);
}
.job-status-dot--closed { background: var(--silver-300); box-shadow: 0 0 0 4px rgba(176,176,176,0.15); }

.job-title {
    font-size: 18px; font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    word-wrap: break-word; overflow-wrap: break-word;
}
.job-shortdesc {
    color: var(--text-secondary); font-size: 14px;
    margin-bottom: 16px;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
    word-wrap: break-word; overflow-wrap: break-word;
    flex-grow: 1;
}
.job-card-foot {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--purple-50);
    font-size: 13px;
}
.job-location { color: var(--text-secondary); }
.job-cta { color: var(--purple-500); font-weight: 700; }

/* ========================================
   JOB DETAILS
   ======================================== */
.job-details {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    border: 1px solid var(--purple-100);
}
.job-details-head { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--purple-100); }
.job-code-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: var(--white);
    padding: 6px 14px; border-radius: 999px;
    font-size: 13px; font-weight: 700;
    margin-bottom: 12px;
}
.job-details-title {
    font-size: clamp(22px, 3vw, 32px);
    color: var(--purple-700); margin-bottom: 10px;
    word-wrap: break-word;
}
.job-location-badge { color: var(--text-secondary); font-size: 14px; }

.job-details-body { display: flex; flex-direction: column; gap: 26px; }
.jd-block h2 {
    font-size: 18px; color: var(--purple-600);
    margin-bottom: 10px; font-weight: 700;
    padding-inline-start: 12px;
    border-inline-start: 4px solid var(--purple-400);
}
.jd-content {
    color: var(--text-secondary); font-size: 15px;
    white-space: pre-wrap; word-wrap: break-word; overflow-wrap: break-word;
    line-height: 1.8;
}

.job-details-actions {
    display: flex; gap: 14px; flex-wrap: wrap;
    margin-top: 34px; padding-top: 24px;
    border-top: 1px solid var(--purple-100);
}

/* ========================================
   FORMS
   ======================================== */
.form-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 34px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--purple-100);
    margin-bottom: 26px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label {
    font-weight: 600; font-size: 14px; color: var(--text-primary);
}
.req { color: #DC2626; font-weight: 700; }

.input, .input-file {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--purple-100);
    border-radius: var(--radius-sm);
    background: var(--silver-50);
    font-family: inherit; font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
}
.input:focus {
    outline: none;
    border-color: var(--purple-400);
    background: var(--white);
    box-shadow: 0 0 0 4px var(--purple-100);
}
.input-otp {
    font-size: 24px; letter-spacing: 12px;
    text-align: center; font-weight: 700;
}
.input-file { padding: 10px; cursor: pointer; }

.field-hint { font-size: 12px; color: var(--text-secondary); }

.divider {
    border: none; border-top: 1px solid var(--purple-100);
    margin: 28px 0;
}
.subsection-title {
    font-size: 17px; color: var(--purple-700);
    margin-bottom: 16px; font-weight: 700;
}
.muted { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; }

.form-actions {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-top: 28px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer; border: none;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    color: var(--white);
    box-shadow: var(--shadow-md);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.btn-ghost {
    background: var(--purple-100);
    color: var(--purple-700);
    border: 1px solid var(--purple-200);
}
.btn-ghost:hover { background: var(--purple-200); }
.btn-lg { padding: 14px 30px; font-size: 15px; }

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    margin-bottom: 22px;
    border-inline-start: 4px solid;
}
.alert-error {
    background: #FEF2F2; color: #991B1B; border-color: #DC2626;
}
.alert-success {
    background: #F0FDF4; color: #166534; border-color: #22C55E;
}

/* ========================================
   SUCCESS PAGE
   ======================================== */
.success-wrap {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 640px; margin: 0 auto;
}
.success-check { width: 120px; height: 120px; margin: 0 auto 24px; }
.check-svg { width: 100%; height: 100%; }
.check-circle {
    stroke: var(--purple-500); stroke-width: 2;
    stroke-dasharray: 166; stroke-dashoffset: 166;
    animation: stroke 0.6s cubic-bezier(0.65,0,0.45,1) forwards;
}
.check-mark {
    stroke: var(--purple-500); stroke-width: 4;
    stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 48; stroke-dashoffset: 48;
    animation: stroke 0.4s cubic-bezier(0.65,0,0.45,1) 0.6s forwards;
}
@keyframes stroke { to { stroke-dashoffset: 0; } }

.success-title {
    font-size: clamp(22px, 3vw, 30px);
    color: var(--purple-700); margin-bottom: 12px;
}
.success-sub { color: var(--text-secondary); margin-bottom: 28px; }
.success-sn {
    display: inline-flex; flex-direction: column; gap: 6px;
    background: var(--purple-50);
    border: 2px dashed var(--purple-300);
    border-radius: var(--radius-md);
    padding: 20px 40px; margin-bottom: 32px;
}
.sn-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.sn-value {
    font-size: 32px; font-weight: 700; color: var(--purple-600);
    letter-spacing: 2px;
}
.success-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ========================================
   APPS TABLE
   ======================================== */
.apps-table-wrap { overflow-x: auto; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.apps-table {
    width: 100%; border-collapse: collapse;
    background: var(--white);
    min-width: 720px;
}
.apps-table th, .apps-table td {
    padding: 14px 16px;
    text-align: start;
    border-bottom: 1px solid var(--purple-50);
    font-size: 14px;
}
.apps-table th {
    background: var(--purple-50);
    color: var(--purple-700); font-weight: 700;
    font-size: 13px;
}
.apps-table tr:hover { background: var(--purple-50); }
.status-pill {
    display: inline-block;
    padding: 4px 12px; border-radius: 999px;
    background: var(--purple-100); color: var(--purple-700);
    font-size: 12px; font-weight: 700;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--purple-200);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { color: var(--text-secondary); font-size: 15px; }

/* ========================================
   FOOTER
   ======================================== */
.site-footer {
    background: var(--purple-700);
    color: var(--purple-100);
    padding: 24px;
    text-align: center;
    font-size: 13px;
}
.footer-inner { max-width: 1280px; margin: 0 auto; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
    .main-nav { display: none; }
    .header-inner { padding: 12px 16px; }
    .site-main { padding: 24px 16px 60px; }
    .job-details, .form-card, .success-wrap { padding: 24px; }
}

@media (max-width: 600px) {
    .jobs-grid { grid-template-columns: 1fr; }
    .hero { padding: 40px 16px 24px; }
    .form-grid { grid-template-columns: 1fr; }
    .success-sn { padding: 16px 24px; }
    .sn-value { font-size: 24px; }
    .brand-sub { display: none; }

    /* جدول يتحول لبطاقات على الموبايل */
    .apps-table { min-width: 0; }
    .apps-table thead { display: none; }
    .apps-table, .apps-table tbody, .apps-table tr, .apps-table td { display: block; width: 100%; }
    .apps-table tr {
        margin-bottom: 14px;
        background: var(--purple-50);
        border-radius: var(--radius-sm);
        padding: 12px;
    }
    .apps-table td {
        border: none; padding: 8px 4px;
        display: flex; justify-content: space-between; gap: 12px;
        text-align: end;
    }
    .apps-table td::before {
        content: attr(data-label);
        font-weight: 700; color: var(--purple-700);
        font-size: 12px; text-align: start;
    }
}