@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');
/* ==========================================
   1. General & Base Styles
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #1c1815; /* خلفية داكنة دافئة شبيهة بالموكا */
    color: #f4ede2;            /* نص كريمي مريح للعين */
    direction: rtl;
}

a {
    text-decoration: none;
    color: inherit;
}

hr {
    opacity: 0.15;
    border-color: #433830;
}

/* ==========================================
   2. Header & Navigation
   ========================================== */
/* ==========================================
   تنسيق الهيدر المتوازن (الشعار يمين - القائمة وسط - الأزرار يسار)
   ========================================== */
.official-header {
    width: 100%;
    background-color: #171311;
    border-bottom: 1px solid #433830;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    width: 95%;
    margin: 0 auto;
    padding: 12px 1rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr; /* العمود الأيمن للشعار، الوسط للقائمة، الأيسر للأزرار */
    align-items: center;
}

/* 1. الشعار في أقصى اليمين */
.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: start; /* يثبت في اليمين (لأن الصفحة RTL) */
}

.site-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-text {
    font-family: 'Cairo', sans-serif;
    color: #f4ede2;
    font-size: 1.2rem;
    font-weight: 700;
}

/* 2. القائمة في المنتصف تماماً وبشكل دائم */
.navigation {
    justify-self: center; 
}

.navigation ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.navigation a {
    text-decoration: none;
    color: #b8afa4;
    font-family: 'Cairo', sans-serif;
    font-size: 19px;
    font-weight: 700;
    position: relative;
    padding: 4px 0;
    transition: color 0.25s ease;
}

.navigation a:hover,
.navigation a.active {
    color: #d4a373; /* لون عسلي دافئ */
}

/* 3. الأزرار (مثل زر وضع الليل) في أقصى اليسار */
.header-actions {
    justify-self: end; /* يثبت في اليسار */
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle-btn {
    background: #28221d;
    border: 1px solid #433830;
    color: #f4ede2;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: #332b25;
    border-color: #d4a373;
}

/* الأدوات الجانبية للهيدر */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================
   3. Hero Section
   ========================================== */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    margin: 2rem auto;
    padding: 0 1rem;
    max-width: 1400px;
    width: 95%;
    direction: rtl;
}

.herosup {
    flex: 1;
    text-align: right;
}

.hero-title {
    font-family: 'Cairo', sans-serif;
    font-size: 40px;
    font-weight: 700;
    color: #f4ede2;
    margin-bottom: 20px;
    text-align: right;
}

.intro {
    font-family: 'Cairo', sans-serif;
    font-size: 20px;
    color: #b8afa4;
    line-height: 1.8;
    margin-top: 15px;
    text-align: right;
    margin-bottom: 30px;
}

.highlight {
    font-family: 'Cairo', sans-serif;
    font-size: inherit;
    font-weight: inherit;
    color: #d4a373;
}

.hero-image-wrapper {
    flex: 0 0 500px;
    max-width: 100%;
}

.hero-image-right {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    border: 2px solid #433830;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    -webkit-mask-image: radial-gradient(circle, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
    mask-image: radial-gradient(circle, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
    opacity: 0.9;
}

/* ==========================================
   4. Features & Cards Section
   ========================================== */
.features-section {
    max-width: 1400px;
    width: 95%;
    margin: 4rem auto;
    padding: 0 1rem;
    text-align: center;
}

.section-title {
    font-family: 'Cairo', sans-serif;
    font-size: 34px;
    color: #f4ede2;
    margin-bottom: 8px;
}

.section-subtitle {
    font-family: 'Cairo', sans-serif;
    font-size: 18px;
    color: #b8afa4;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.feature-card {
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 12px;
    padding: 24px 20px;
    text-align: right;
    transition: background-color 0.25s ease, border-color 0.25s ease;
    cursor: pointer;
}

.feature-card:hover {
    background-color: #332b25;
    border-color: #d4a373;
}

.feature-card .icon {
    font-size: 28px;
    margin-bottom: 12px;
    display: inline-block;
    padding: 8px;
    background: #1c1815;
    border-radius: 8px;
}

.feature-card h3 {
    font-family: 'Cairo', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #f4ede2;
    margin-bottom: 8px;
}

.feature-card p {
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    color: #b8afa4;
    line-height: 1.6;
}

/* ==========================================
   5. Calculator Page Component
   ========================================== */
.calculator-container {
    max-width: 900px;
    margin: 3rem auto;
    padding: 2rem;
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 12px;
}

.calc-header {
    text-align: center;
    margin-bottom: 2rem;
}

.calc-title {
    font-family: 'Cairo', sans-serif;
    font-size: 32px;
    color: #d4a373;
    margin-bottom: 8px;
}

.calc-subtitle {
    font-family: 'Cairo', sans-serif;
    color: #b8afa4;
    font-size: 18px;
}

.cumulative-section {
    background-color: #1c1815;
    border: 1px dashed #433830;
    padding: 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.cumulative-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.cumulative-inputs .full-width {
    grid-column: span 2;
}

.input-group label {
    display: block;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    color: #f4ede2;
    margin-bottom: 6px;
}

.courses-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.courses-table th, 
.courses-table td {
    padding: 12px;
    text-align: right;
    border-bottom: 1px solid #433830;
}

.courses-table th {
    font-family: 'Cairo', sans-serif;
    color: #f4ede2;
    font-size: 18px;
}

.input-field, 
.select-field {
    width: 100%;
    padding: 10px;
    background-color: #1c1815;
    border: 1px solid #433830;
    border-radius: 6px;
    color: #f4ede2;
    font-size: 15px;
    outline: none;
    font-family: 'Cairo', sans-serif;
}

.input-field:focus, 
.select-field:focus {
    border-color: #d4a373;
}

/* نتائج حاسبة المعدل */
.result-box {
    display: none;
    background-color: #1c1815;
    border: 1px solid #d4a373;
    border-radius: 8px;
    padding: 20px;
}

.results-grid {
    display: flex;
    gap: 20px;
    justify-content: space-around;
    padding-bottom: 15px;
    border-bottom: 1px solid #433830;
}

.result-card {
    flex: 1;
    text-align: center;
    padding: 10px;
}

.result-card.highlight {
    border-right: 1px solid #433830;
}

.result-card h3 {
    font-family: 'Cairo', sans-serif;
    font-size: 20px;
    color: #b8afa4;
    margin-bottom: 8px;
}

.gpa-score {
    font-size: 36px;
    font-weight: bold;
    color: #d4a373;
}

.gpa-rating {
    font-family: 'Cairo', sans-serif;
    font-size: 17px;
    color: #b8afa4;
    margin-top: 5px;
}

.hours-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    justify-content: space-around;
}

.hours-card {
    background-color: #28221d;
    border: 1px solid #433830;
    padding: 10px 18px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Cairo', sans-serif;
}

.hours-card.highlight-hours {
    border-color: #d4a373;
}

.hours-label {
    color: #b8afa4;
    font-size: 16px;
}

.hours-value {
    color: #d4a373;
    font-weight: bold;
    font-size: 18px;
}

/* ==========================================
   6. Buttons & Interactive Controls
   ========================================== */
.btn-start {
    display: inline-block;
    font-family: 'Cairo', sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: #1c1815;
    background-color: #d4a373;
    padding: 10px 28px;
    border-radius: 8px;
    transition: background-color 0.25s ease, transform 0.2s ease;
}

.btn-start:hover {
    background-color: #e9c46a;
    transform: translateY(-2px);
}

.btn-portal {
    font-family: 'Cairo', sans-serif;
    background-color: #28221d;
    color: #f4ede2;
    border: 1px solid #433830;
    padding: 6px 18px;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 700;
    display: inline-block;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-portal:hover {
    background-color: #d4a373;
    border-color: #d4a373;
    color: #1c1815;
}

.theme-toggle-btn {
    background: #28221d;
    border: 1px solid #433830;
    color: #f4ede2;
    font-size: 0.95rem;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: #332b25;
    border-color: #d4a373;
}

.calc-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 2rem;
}

.btn-add, 
.btn-calc, 
.btn-remove {
    font-family: 'Cairo', sans-serif;
    font-size: 17px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add {
    background-color: #332b25;
    color: #f4ede2;
    border: 1px solid #433830;
}

.btn-add:hover {
    background-color: #433830;
}

.btn-calc {
    background-color: #d4a373;
    color: #1c1815;
    flex: 1;
}

.btn-calc:hover {
    background-color: #e9c46a;
}

.btn-remove {
    background-color: #5c2c2c;
    color: #fca5a5;
    padding: 6px 12px;
    font-size: 14px;
}

.btn-remove:hover {
    background-color: #7a3a3a;
}

/* ==========================================
   7. Responsive Design
   ========================================== */
@media (max-width: 900px) {
    .hero {
        flex-direction: column-reverse;
        text-align: center;
    }
    
    .herosup, .hero-title, .intro {
        text-align: center;
    }

    .hero-image-wrapper {
        flex: 0 0 auto;
        width: 100%;
        max-width: 400px;
    }
}

@media (max-width: 600px) {
    .cumulative-inputs {
        grid-template-columns: 1fr;
    }

    .results-grid, 
    .hours-summary-grid {
        flex-direction: column;
    }

    .cumulative-inputs .full-width {
        grid-column: span 1;
    }

    .result-card.highlight {
        border-right: none;
        border-top: 1px solid #433830;
        padding-top: 15px;
    }

    .header-container {
        flex-direction: column;
        gap: 15px;
    }
}

/* ==========================================
   8. Footer
   ========================================== */
.official-footer {
    width: 100%;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 3rem;
    background-color: #171311;
    border-top: 1px solid #433830;
}

.official-footer p {
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    color: #b8afa4;
    margin: 0;
}

