@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; /* خلفية داكنة دافئة شبيهة بالموكا */
    direction: rtl;
    color: #f4ede2;            /* نص كريمي مريح للعين */
}

a {
    text-decoration: none;
}

/* ==========================================
   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;
}

/* ==========================================
   3. Calculator Main Section (تصميم المخطط)
   ========================================== */
.calculator-container {
    max-width: 1000px;
    width: 95%;
    margin: 3rem auto;
    padding: 2.5rem;
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 12px;
}

.calc-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.calc-title {
    font-family: 'Cairo', sans-serif;
    font-size: 34px;
    color: #f4ede2;
    margin-bottom: 8px;
}

.calc-subtitle {
    font-family: 'Cairo', sans-serif;
    font-size: 18px;
    color: #b8afa4;
}

.cumulative-section {
    background-color: #1c1815;
    border: 1px solid #433830;
    border-radius: 12px;
    padding: 1.8rem;
    margin-bottom: 2rem;
}

.cumulative-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-family: 'Cairo', sans-serif;
    font-size: 17px;
    color: #f4ede2;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 8px;
    color: #f4ede2;
    font-family: 'Cairo', sans-serif;
    font-size: 17px;
    outline: none;
    transition: all 0.25s ease;
}

.input-field:focus {
    border-color: #d4a373;
    box-shadow: 0 0 0 2px rgba(212, 163, 115, 0.2);
}

.calc-actions {
    text-align: center;
    margin-bottom: 1rem;
}

.btn-calc {
    font-family: 'Cairo', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #1c1815;
    background-color: #d4a373;
    padding: 12px 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-calc:hover {
    background-color: #e9c46a;
    transform: translateY(-2px);
}

/* ==========================================
   4. Results Box & Visual Features
   ========================================== */
.result-box {
    display: none;
    background-color: #1c1815;
    border: 1px solid #433830;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2.5rem;
    animation: fadeIn 0.3s ease-in-out;
}

.results-grid {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.result-card {
    text-align: center;
    padding: 1.5rem;
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 10px;
    width: 100%;
    max-width: 500px;
}

.result-card h3 {
    font-family: 'Cairo', sans-serif;
    font-size: 20px;
    color: #b8afa4;
    margin-bottom: 8px;
}

.gpa-score {
    font-size: 52px;
    font-weight: bold;
    color: #d4a373;
    line-height: 1;
    margin-bottom: 8px;
}

.gpa-rating {
    font-family: 'Cairo', sans-serif;
    font-size: 18px;
    color: #f4ede2;
}

/* مؤشر واقعية الهدف */
.gauge-section {
    background-color: #28221d;
    padding: 1.2rem;
    border-radius: 10px;
    border: 1px solid #433830;
    margin-bottom: 1.5rem;
}

.gauge-header {
    display: flex;
    justify-content: space-between;
    font-family: 'Cairo', sans-serif;
    font-size: 17px;
    margin-bottom: 10px;
    color: #f4ede2;
}

.gauge-bar-bg {
    width: 100%;
    height: 12px;
    background-color: #1c1815;
    border-radius: 6px;
    overflow: hidden;
}

.gauge-bar-fill {
    height: 100%;
    width: 0%;
    background-color: #d4a373;
    transition: width 0.5s ease-in-out, background-color 0.5s ease-in-out;
}

/* شبكة التفاصيل الناتجة */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 1.5rem;
}

.detail-card {
    background-color: #28221d;
    border: 1px solid #433830;
    border-radius: 10px;
    padding: 1.2rem;
    text-align: center;
}

.detail-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.detail-card h4 {
    font-family: 'Cairo', sans-serif;
    font-size: 16px;
    color: #b8afa4;
    margin-bottom: 4px;
}

.detail-card p {
    font-family: 'Cairo', sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #f4ede2;
}

.target-advice {
    font-family: 'Cairo', sans-serif;
    font-size: 18px;
    color: #f4ede2;
    line-height: 1.7;
    background-color: #28221d;
    padding: 1.2rem;
    border-radius: 8px;
    border-right: 4px solid #d4a373;
}

/* ==========================================
   5. 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;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}