/* إعادة ضبط المسافات والهوامش */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* تعريف متغيرات الألوان والخطوط */
:root {
    --primary-color: #17313F;
    --secondary-color: #2A4E69;
    --accent-color: #E55934;
    --highlight-color: #4AA96C;
    --light-green: #C8ECDB;
    --background-color: #F5F9FC;
    --card-bg: #FFFFFF;
    --text-color: #384152;
    --text-secondary: #5D6877;
    --border-radius: 10px;
    --card-border-radius: 14px;
    --box-shadow: 0 8px 25px rgba(23, 49, 63, 0.07);
    --font-family-primary: 'Almarai', sans-serif;
    --font-family-secondary: 'Tajawal', sans-serif;
    --base-font-size: 0.98rem;
    --transition-speed: 0.3s;
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--base-font-size);
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background-image: linear-gradient(135deg, rgba(42, 78, 105, 0.03) 0%, rgba(42, 78, 105, 0.08) 100%);
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

/* الحاوية الرئيسية */
.container {
    width: 100%;
    max-width: 28rem;
    background: var(--card-bg);
    margin: 0 auto;
    border-radius: var(--card-border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.8rem;
    border: 1px solid rgba(207, 225, 239, 0.5);
    position: relative;
    overflow: hidden;
}

/* زخرفة الخلفية */
.container::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 130px;
    height: 130px;
    background: var(--light-green);
    opacity: 0.18;
    border-radius: 50%;
    transform: translate(35%, -35%);
    z-index: 0;
}

.container::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 160px;
    height: 160px;
    background: var(--accent-color);
    opacity: 0.04;
    border-radius: 50%;
    transform: translate(-35%, 35%);
    z-index: 0;
}

/* تكبير الحاوية للشاشات الأكبر */
@media (min-width: 768px) {
    .container {
        max-width: 46rem;
        padding: 2rem;
    }
}

/* العناصر داخل الحاوية */
.container > * {
    position: relative;
    z-index: 1;
}

h1 {
    font-family: var(--font-family-secondary);
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    position: relative;
    padding-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

h1::before {
    content: "";
    position: absolute;
    width: 50px;
    height: 3px;
    background-color: var(--highlight-color);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50px;
}

h1::after {
    content: "🌱";
    font-size: 1.2rem;
    margin-left: 0.2rem;
    line-height: 1;
}

/* صندوق الأسعار العام */
.price-box {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.7rem; /* هامش أسفل كل صندوق أسعار */
}

.price-card {
    flex: 1;
    background: #FFFFFF;
    border-radius: var(--border-radius);
    padding: 1rem 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    text-align: center;
    transition: all var(--transition-speed);
    border: 1px solid rgba(207, 225, 239, 0.4);
    position: relative;
    overflow: hidden;
}

.price-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px 2px 0 0;
    transition: transform var(--transition-speed);
    transform: scaleX(0);
    transform-origin: right;
}

.price-card:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}

.price-card.max::before { /* لبطاقة السعر الأعلى الرئيسية */
    background: var(--highlight-color);
}


.price-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}

.price-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.price-card.max .price-label::before { /* لبطاقة السعر الأعلى الرئيسية */
    content: "\f0d8";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--highlight-color);
}

.price-card.min .price-label::before { /* لبطاقة السعر الأدنى الرئيسية */
    content: "\f0d7";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--accent-color);
}

.price-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--accent-color);
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0.15rem;
}

.price-value::after {
    content: "جنيه";
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-right: 0.15rem;
}

.price-card.max .price-value { /* لبطاقة السعر الأعلى الرئيسية */
    color: var(--highlight-color);
}

/* قسم أسعار الخزين */
#storagePricesContainer {
    /* هذا الـ div سيكون display: block افتراضيًا ويحتوي على العنوان والـ price-box */
    margin-bottom: 1.2rem; /* هامش أسفل قسم الخزين بأكمله، قبل الرسم البياني */
}

.storage-section-title {
    font-family: var(--font-family-secondary);
    color: var(--primary-color);
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 0.8rem;     /* مسافة فوق عنوان الخزين */
    margin-bottom: 0.6rem;  /* مسافة بين عنوان الخزين وصندوق بطاقات الخزين */
    position: relative;
    text-align: center;
    padding-bottom: 0.6rem;
    display: flex; /* لضمان محاذاة الأيقونة مع النص بشكل جيد */
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.storage-section-title::before { /* الخط السفلي لعنوان الخزين */
    content: "";
    position: absolute;
    width: 45px;
    height: 3px;
    background-color: var(--secondary-color);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50px;
}

.storage-section-title::after { /* أيقونة الصندوق بجانب عنوان الخزين */
    content: "📦";
    font-size: 1.1rem;
    margin-left: 0.4rem;
    line-height: 1;
}

/* تخصيص ألوان بطاقات أسعار الخزين */
.price-card.storage-max {
    background-image: linear-gradient(to bottom, rgba(160, 212, 104, 0.04), rgba(255, 255, 255, 0.08) 30%, #FFFFFF 70%);
}
.price-card.storage-max::before { /* الخط العلوي لبطاقة السعر الأعلى (خزين) */
    background: #A0D468;
}
.price-card.storage-max .price-value {
    color: #8CC152;
}
.price-card.storage-max .price-label::before {
    content: "\f0d8";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #8CC152;
}

.price-card.storage-min {
    background-image: linear-gradient(to bottom, rgba(255, 206, 84, 0.04), rgba(255, 255, 255, 0.08) 30%, #FFFFFF 70%);
}
.price-card.storage-min::before { /* الخط العلوي لبطاقة السعر الأدنى (خزين) */
    background: #FFCE54;
}
.price-card.storage-min .price-value {
    color: #F6BB42;
}
.price-card.storage-min .price-label::before {
    content: "\f0d7";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #F6BB42;
}


/* قسم الرسم البياني */
.chart-section {
    margin-top: 1.2rem; /* مسافة فوق قسم الرسم البياني */
    background: #FFFFFF;
    border-radius: var(--border-radius);
    padding: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(207, 225, 239, 0.4);
}

.chart-title {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.chart-title::before {
    content: "\f201";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--primary-color);
    font-size: 0.85rem;
}

/* --- استعادة تنسيقات أزرار الرسم البياني --- */
.chart-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem; /* كان 0.5rem */
    margin-bottom: 0.8rem; /* كان 1rem */
}

.chart-buttons button {
    background-color: #F5F9FC;
    color: var(--text-secondary);
    border: 1px solid rgba(207, 225, 239, 0.8);
    padding: 0.4rem 0.8rem; /* كان 0.5rem 1rem */
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.8rem; /* كان 0.85rem */
    font-weight: 500;
    transition: all var(--transition-speed);
    flex: 1;
    min-width: 55px; /* كان 60px */
    font-family: var(--font-family-primary);
}

.chart-buttons button:hover,
.chart-buttons button.active {
    background-color: var(--highlight-color);
    color: #FFFFFF;
    border-color: var(--highlight-color);
    box-shadow: 0 4px 8px rgba(74, 169, 108, 0.18); /* كان 0 5px 10px rgba(74, 169, 108, 0.2) */
}
/* --- نهاية استعادة تنسيقات أزرار الرسم البياني --- */

.chart-container {
    position: relative;
    width: 100%;
    height: 230px;
    margin: 0 auto;
    box-sizing: border-box;
}

.info-box {
    margin-top: 1.2rem;
    padding: 1rem;
    background: #FFFFFF;
    border-radius: var(--border-radius);
    line-height: 1.55;
    font-size: 0.8rem;
    color: var(--text-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(207, 225, 239, 0.4);
    position: relative;
}

.info-box::before {
    content: "\f05a";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--secondary-color);
    margin-left: 0.4rem;
    font-size: 0.85rem;
}

footer {
    margin-top: 1.2rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

footer #date {
    background: rgba(200, 236, 219, 0.25);
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    display: inline-block;
    margin: 0 auto;
    font-weight: 500;
    color: var(--primary-color);
}

footer #date::before {
    content: "\f017";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: 0.25rem;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-speed);
    padding: 0.25rem 0.7rem;
    border-radius: 2rem;
    display: inline-block;
}

footer a:hover {
    color: var(--highlight-color);
    background: rgba(74, 169, 108, 0.08);
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    body {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    .container {
        padding: 1.5rem;
        margin: 0.8rem auto;
    }

    h1 {
        font-size: 1.35rem;
        margin-bottom: 0.7rem;
        padding-bottom: 0.7rem;
    }
     h1::after { 
        font-size: 1.0rem;
        margin-left: 0.15rem;
    }
    
    #storagePricesContainer {
        margin-bottom: 1rem;
    }
    .storage-section-title {
        font-size: 1.25rem; /* كان 1.2rem */
        margin-top: 0.6rem;
        margin-bottom: 0.5rem; /* تمت زيادة هذا قليلاً ليكون هناك مسافة واضحة */
        padding-bottom: 0.5rem;
    }
    .storage-section-title::after {
        margin-left: 0.3rem;
    }


    .price-value {
        font-size: 1.35rem;
    }

    .price-box { 
        margin-bottom: 0.6rem; /* هذا ينطبق على كلا الصندوقين */
        gap: 0.6rem;
    }
    .price-card {
        padding: 0.8rem 0.6rem;
    }
    .price-label {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    /* --- استعادة تنسيقات أزرار الرسم البياني للشاشات الصغيرة --- */
    .chart-buttons {
        gap: 0.3rem; /* كان 0.4rem */
        margin-bottom: 0.6rem; /* كان 0.8rem */
    }

    .chart-buttons button {
        font-size: 0.75rem; /* كان 0.8rem */
        padding: 0.35rem 0.65rem; /* كان 0.4rem 0.8rem */
        min-width: 50px; /* كان 55px */
    }
    /* --- نهاية استعادة تنسيقات أزرار الرسم البياني للشاشات الصغيرة --- */

    .chart-container {
        height: 210px;
    }

    .info-box {
        font-size: 0.78rem;
        padding: 0.8rem;
        margin-top: 1rem;
    }
    footer {
        margin-top: 1rem;
        gap: 0.5rem;
    }
}