:root {
    /* Brand Colors (Constant) */
    --brand-navy: #0a192f;
    --brand-gold: #c5a059;
    --brand-gold-hover: #b08d48;

    /* Semantic Colors (Theme Dependent - Light Default) */
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;

    --text-primary: #0a192f;
    --text-secondary: #64748b;

    --border-color: #e2e8f0;
    --shadow-color: rgba(10, 25, 47, 0.1);

    /* UI Elements */
    --btn-primary-bg: #0a192f;
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: #ffffff;
    --btn-secondary-text: #0a192f;
    --btn-secondary-border: #e2e8f0;

    --btn-ghost-color: #64748b;
    --btn-ghost-border: #e2e8f0;

    /* Spacing */
    --container-width: 1200px;
    --header-height: 80px;

    /* Institutions Section Specific (Light) */
    --bg-inst: #f1f5f9;
    /* Neutral Slate Gray (Very Light) */
    --text-inst-title: #0a192f;
    --text-inst-desc: #64748b;
    --bg-inst-card: #ffffff;
    --border-inst-card: #e2e8f0;
    --text-inst-card: #0a192f;
    --bg-inst-icon: rgba(197, 160, 89, 0.1);
    --pattern-opacity: 0.05;
}

[data-theme="dark"] {
    /* Semantic Colors (Dark Theme) */
    --bg-main: #020c1b;
    --bg-card: #112240;
    --bg-header: #0a192f;

    --text-primary: #e6f1ff;
    --text-secondary: #8892b0;

    --border-color: #233554;
    --shadow-color: rgba(0, 0, 0, 0.4);

    /* UI Elements */
    --btn-primary-bg: #c5a059;
    --btn-primary-text: #0a192f;

    --btn-secondary-bg: #112240;
    --btn-secondary-text: #c5a059;
    --btn-secondary-border: #c5a059;

    --btn-ghost-color: #a8b2d1;
    --btn-ghost-border: #233554;

    /* Institutions Section Specific (Dark) */
    --bg-inst: #020c1b;
    /* Darker than main bg for depth */
    --text-inst-title: #ffffff;
    --text-inst-desc: #a8b2d1;
    --bg-inst-card: rgba(255, 255, 255, 0.03);
    --border-inst-card: rgba(197, 160, 89, 0.2);
    --text-inst-card: #e6f1ff;
    --bg-inst-icon: rgba(197, 160, 89, 0.15);
    --pattern-opacity: 0.03;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

html[dir="ltr"] body {
    font-family: 'Inter', sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    border: none;
    cursor: pointer;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

/* Header */
.main-header {
    height: var(--header-height);
    background-color: var(--bg-header);
    box-shadow: 0 2px 15px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s, border-color 0.3s;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 48px;
    width: auto;
}

.brand-names {
    display: flex;
    align-items: center;
    line-height: 1;
}

.brand-ar {
    font-size: 1.3rem;
    color: var(--brand-gold);
    font-weight: 700;
}

.brand-en {
    font-size: 1.1rem;
    color: var(--brand-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}

/* Language based visibility */
html[dir="rtl"] .brand-en {
    display: none;
}

html[dir="ltr"] .brand-ar {
    display: none;
}

/* Nav & Buttons */
.main-nav {
    display: flex;
    gap: 10px;
}

.btn-ghost {
    background: transparent;
    color: var(--btn-ghost-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--btn-ghost-border);
    transition: all 0.3s ease;
}

.btn-ghost:hover {
    border-color: var(--brand-gold);
    color: var(--text-primary);
}

.nav-link {
    color: var(--text-secondary);
    padding: 8px 16px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--brand-gold);
}

/* Hero Section */
/* Hero Section */
.hero-section {
    padding: 100px 0;
    /* More breathing room */
    background: radial-gradient(circle at top right, var(--bg-card), transparent);
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Logo Pattern Overlay */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/logo_kader.png');
    /* Ensure this path is correct relative to CSS */
    background-size: 30px;
    /* Small repeatable size */
    background-repeat: repeat;
    opacity: 0.03;
    /* Very subtle */
    transform: rotate(-5deg) scale(1.1);
    /* Slight texture effect */
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    max-width: 900px;
    position: relative;
    z-index: 1;
    /* Above pattern */
}

.badge {
    background-color: transparent;
    border: 1px solid var(--brand-gold);
    color: var(--brand-gold);
    padding: 6px 18px;
    border-radius: 4px;
    /* More official/square than round */
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-block;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: 3rem;
    color: var(--text-primary);
    margin-bottom: 24px;
    line-height: 1.4;
    font-weight: 800;
}

.text-highlight {
    color: var(--brand-gold);
    display: block;
    /* Forces new line naturally with br or just visual separation */
    font-size: 0.9em;
    /* Slightly smaller for the second part maybe? Or same. Let's keep it same but colored */
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 56px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
    font-weight: 500;
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 32px;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 220px;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    box-shadow: 0 4px 15px var(--shadow-color);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-color);
    opacity: 0.95;
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border: 2px solid var(--btn-secondary-border);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-color);
    opacity: 0.95;
}

.btn-text {
    display: flex;
    flex-direction: column;
    text-align: start;
}

html[dir="rtl"] .btn-text {
    text-align: right;
}

html[dir="ltr"] .btn-text {
    text-align: left;
}

.btn-text .small {
    font-size: 0.75rem;
    opacity: 0.8;
}

.btn-text .large {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Features Grid */
.features-section {
    padding: 60px 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.feature-card:hover {
    border-color: var(--brand-gold);
    transform: translateY(-5px);
}

.feature-icon {
    color: var(--brand-gold);
    width: 32px;
    height: 32px;
    margin-bottom: 20px;
}

.feature-card h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Footer */
.main-footer {
    background: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
    margin-top: 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    color: var(--text-secondary);
}

.footer-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-gold);
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-logo {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 20px;
}

.footer-logo-img {
    height: 40px;
    width: auto;
    filter: grayscale(100%);
    opacity: 0.5;
}

/* Section Title */
.section-title {
    text-align: center;
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 50px;
}

/* How It Works Section */
.how-it-works-section {
    padding: 60px 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.steps-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.step-item {
    text-align: center;
    padding: 30px;
    max-width: 180px;
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--brand-gold);
    color: var(--brand-navy);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    margin: 0 auto 15px;
    font-family: 'Inter', sans-serif;
}

.step-icon {
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
}

.step-item h4 {
    color: var(--text-primary);
    font-size: 1rem;
}

.step-arrow {
    color: var(--brand-gold);
}

.step-arrow svg {
    width: 24px;
    height: 24px;
}

html[dir="ltr"] .step-arrow svg {
    transform: rotate(180deg);
}

/* Ensure RTL also enforces 0deg just in case */
html[dir="rtl"] .step-arrow svg {
    transform: rotate(0deg);
}

/* Institutions Section */
.institutions-section {
    padding: 100px 0;
    background-color: var(--bg-inst);
    position: relative;
    overflow: hidden;
}

/* Pattern Overlay */
.institutions-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url('../images/logo_kader.png');
    background-size: 60px;
    background-repeat: repeat;
    opacity: var(--pattern-opacity);
    transform: rotate(5deg);
    pointer-events: none;
    z-index: 0;
}



.institutions-section .container {
    position: relative;
    z-index: 1;
}

.institutions-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 50px;
}

.institutions-header .badge {
    background: rgba(197, 160, 89, 0.2);
    border-color: var(--brand-gold);
    margin-bottom: 20px;
}

.institutions-header h2 {
    color: var(--text-inst-title);
    font-size: 2.2rem;
    margin-bottom: 20px;
}

.institutions-header p {
    color: var(--text-inst-desc);
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Institutions Feature Cards Grid */
.inst-features-grid {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 25px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.inst-feature-card {
    background: var(--bg-inst-card);
    border: 1px solid var(--border-inst-card);
    border-radius: 16px;
    padding: 30px 25px;
    text-align: center;
    min-width: 200px;
    max-width: 250px;
    flex: 1;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.inst-feature-card:hover {
    background: rgba(197, 160, 89, 0.1);
    border-color: var(--brand-gold);
    transform: translateY(-5px);
}

.inst-feature-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-inst-icon);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.inst-feature-icon i {
    width: 28px;
    height: 28px;
    color: var(--brand-gold);
}

.inst-feature-card h4 {
    color: var(--text-inst-card);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

.inst-cta {
    text-align: center;
}

.btn-outline {
    display: inline-block;
    padding: 14px 32px;
    border: 2px solid var(--brand-gold);
    color: var(--brand-gold);
    border-radius: 8px;
    font-weight: 700;
    transition: all 0.3s;
}

.btn-outline:hover {
    background: var(--brand-gold);
    color: var(--brand-navy);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 500px;
    padding: 40px;
    border-radius: 20px;
    position: relative;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    font-size: 2rem;
    color: var(--text-secondary);
    line-height: 1;
    cursor: pointer;
}

html[dir="rtl"] .modal-close {
    right: auto;
    left: 20px;
}

html[dir="ltr"] .modal-close {
    left: auto;
    right: 20px;
}

.modal-icon {
    width: 48px;
    height: 48px;
    color: var(--brand-gold);
    margin-bottom: 20px;
}

.modal-header h3 {
    margin-bottom: 30px;
    color: var(--text-primary);
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
}

.progress-bar .line {
    width: 60px;
    height: 2px;
    background: var(--border-color);
    margin: 0 10px;
}

.progress-bar .step {
    width: 32px;
    height: 32px;
    background: var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-weight: bold;
    font-family: 'Inter', sans-serif;
}

.progress-bar .step.active {
    background: var(--brand-navy);
    color: #ffffff;
}

[data-theme="dark"] .progress-bar .step.active {
    background: var(--brand-gold);
    color: var(--brand-navy);
}

.step-content {
    animation: fadeIn 0.4s ease;
}

.step-content h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.step-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-step {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--bg-main);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 15px;
    border-radius: 12px;
    font-weight: 700;
    margin-top: 20px;
    transition: all 0.2s;
}

.btn-step:hover {
    border-color: var(--brand-gold);
}

.modal-actions {
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.btn-primary-small {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: transparent;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    border-color: var(--brand-gold);
}

.mobile-menu-btn i {
    width: 24px;
    height: 24px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Mobile Menu Button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Navigation */
    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-header);
        flex-direction: column;
        padding: 20px;
        gap: 15px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 10px 30px var(--shadow-color);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 99;
    }

    .main-nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .main-nav .nav-link {
        width: 100%;
        text-align: center;
        padding: 12px;
        border-radius: 8px;
        background: var(--bg-card);
    }

    .main-nav .btn-ghost {
        width: 100%;
        justify-content: center;
    }

    /* Header */
    .header-content {
        padding: 0 16px;
    }

    .logo-img {
        height: 40px;
    }

    .brand-ar {
        font-size: 1rem;
    }

    .brand-en {
        font-size: 0.75rem;
    }

    /* Hero Section */
    .hero-section {
        padding: 60px 0;
    }

    .hero-title {
        font-size: 1.6rem;
        line-height: 1.5;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 40px;
        line-height: 1.7;
    }

    .badge {
        font-size: 0.75rem;
        padding: 5px 14px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 12px 24px;
        min-width: unset;
    }

    /* How It Works Section */
    .how-it-works-section {
        padding: 40px 0;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }

    .steps-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .step-arrow {
        transform: none;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        margin: 5px 0;
    }

    .step-arrow svg {
        display: block;
        transform: rotate(-90deg) !important;
    }

    html[dir="ltr"] .step-arrow svg {
        display: block;
        transform: rotate(-90deg) !important;
    }

    .step-item {
        padding: 20px;
        max-width: 100%;
        width: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .step-icon {
        margin: 0 auto 15px;
    }

    .step-number {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .step-icon {
        width: 40px;
        height: 40px;
    }

    /* Features Section */
    .features-section {
        padding: 40px 0;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .feature-card {
        padding: 24px;
    }

    .feature-card h3 {
        font-size: 1.1rem;
    }

    .feature-card p {
        font-size: 0.9rem;
    }

    /* Institutions Section */
    .institutions-section {
        padding: 50px 0;
    }

    .institutions-header {
        margin-bottom: 30px;
    }

    .institutions-header h2 {
        font-size: 1.5rem;
    }

    .institutions-header p {
        font-size: 0.95rem;
    }

    .inst-features-grid {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .inst-feature-card {
        width: 100%;
        max-width: 100%;
        min-width: unset;
        padding: 25px 20px;
    }

    .inst-feature-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 15px;
    }

    .inst-feature-icon i {
        width: 24px;
        height: 24px;
    }

    .inst-feature-card h4 {
        font-size: 0.95rem;
    }

    .btn-outline {
        padding: 12px 28px;
        font-size: 0.95rem;
    }

    /* Footer */
    .main-footer {
        padding: 30px 0;
        margin-top: 40px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .footer-logo-img {
        height: 35px;
    }

    .footer-links a {
        justify-content: center;
    }

    /* Modal */
    .modal-content {
        padding: 30px 20px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-icon {
        width: 40px;
        height: 40px;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .progress-bar .step {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .progress-bar .line {
        width: 40px;
    }

    .step-content h4 {
        font-size: 1rem;
    }

    .step-content p {
        font-size: 0.9rem;
    }

    .btn-step {
        padding: 12px;
        font-size: 0.9rem;
    }

    .container {
        padding: 0 16px;
    }
}

/* Extra Small Devices */
@media (max-width: 375px) {
    .hero-title {
        font-size: 1.4rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 10px 20px;
    }

    .btn-text .large {
        font-size: 1rem;
    }

    .feature-card {
        padding: 20px;
    }

    .institutions-text h2 {
        font-size: 1.4rem;
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 16px 28px;
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow-color);
    border: 1px solid var(--brand-gold);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1rem;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-notification .toast-icon {
    color: var(--brand-gold);
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .toast-notification {
        width: 90%;
        bottom: 20px;
        padding: 14px 20px;
        font-size: 0.9rem;
    }
}