/* الأهم: يضمن أن أي PADDING أو BORDER لن يزيد من عرض العنصر الفعلي */
* {
    box-sizing: border-box; 
}

/* General body and typography */
body {
    font-family: 'Rubik', sans-serif;
    background-color: #0d1117;
    color: #e6e6e6;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* New: Smooth Scrolling for Single Page Navigation */
html {
    scroll-behavior: smooth;
}

/* ------------------------------------------------------------------- */
/* HEADER STYLING (DESKTOP) - الأساسي */
/* ---------------- HEADER STYLING ---------------- */
.main-header {
    background-color: #161b22;
    padding: 12px 25px;

    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #2d3640;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    width: 100%;
}

/* المحتوى الرئيسي للهيدر */
.header-content {
    display: flex;
    justify-content: space-between; /* اللوجو يسار - القائمة يمين */
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap; /* عشان لو الشاشة صغيرة العناصر تنزل تحت بعض مؤقتًا */
}

/* --------- اللوجو واسم الموقع --------- */
.brand-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0; /* يمنع ضغط اللوجو والاسم */
}

.logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.text-info h1 {
    margin: 0;
    font-size: 1.6rem;
    color: #00bfff;
    text-shadow: 0 0 10px rgba(0, 191, 255, 0.8);
}

.text-info .slogan {
    margin: 0;
    font-size: 0.9rem;
    color: #aaa;
}

/* --------- قائمة الأقسام (اليمين) --------- */
.main-nav {
    display: flex;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
}

.main-nav a {
    color: #e6e6e6;
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: bold;
    transition: color 0.3s, border-bottom 0.3s;
}

.main-nav a:hover {
    color: #00ff7f;
    border-bottom: 2px solid #00bfff;
}

/* ---------------- RESPONSIVE (MOBILE) ---------------- */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }

    .brand-info {
        justify-content: center;
        width: 100%;
    }

    .logo {
        width: 40px;
        height: 40px;
    }

    .text-info h1 {
        font-size: 1.3rem;
    }

    .text-info .slogan {
        font-size: 0.8rem;
    }

    .main-nav {
        justify-content: center;
        width: 100%;
        border-top: 1px solid #2d3640;
        padding-top: 8px;
        gap: 15px;
        flex-wrap: wrap;
    }

    .main-nav a {
        font-size: 0.9rem;
        margin: 0;
        border: none;
    }
}

/* ------------------------------------------------------------------- */
/* MOBILE RESPONSIVENESS - الحل النهائي والحاسم */

@media (max-width: 768px) {
    
    .main-header {
        padding: 8px 0; 
        width: 100%;
        overflow-x: hidden; /* يمنع التمرير الأفقي تماماً */
    }

    .header-content {
        /* الهيدر سيصبح عمودياً لمرة واحدة فقط لتجنب الضغط */
        flex-direction: column; 
        padding: 0 10px; 
        gap: 10px;
        align-items: stretch; /* نجعل العناصر تأخذ العرض الكامل */
    }

    /* 1. قسم الشعار واسم الموقع (الآن في السطر العلوي) */
    .brand-info {
        justify-content: center; /* توسيط الشعار والاسم */
        margin-bottom: 5px; /* مسافة بسيطة */
        text-align: center;
        width: 100%;
    }

    .logo {
        width: 40px; 
        height: 40px;
        margin-left: 10px; 
    }

    .text-info h1 {
        font-size: 1.2rem; 
    }

    .text-info .slogan {
       
    }

    /* 2. قائمة التنقل (الآن في السطر السفلي) */
    .main-nav {
        /* الروابط تصبح أفقية وموسَّطة ومضغوطة جداً */
        display: flex;
        flex-direction: row; 
        justify-content: space-around; /* توزيع الروابط بالتساوي */
        width: 100%;
        padding: 5px 0;
        border-top: 1px solid #2d3640; /* خط فاصل أنيق بين الاسم والروابط */
    }

    .main-nav a {
        margin-left: 0; /* إلغاء جميع الهوامش */
        padding: 5px 0;
        font-size: 0.8rem; /* تصغير الخط النهائي */
        white-space: nowrap; 
    }

    .main-nav a:hover {
        border-bottom: none;
        color: #00ff7f;
    }
}
/* ------------------------------------------------------------------- */
/* باقي الأكواد أسفل هذا الجزء (Products, Modal, Footer) */

/* Products section (Unchanged) */
.products-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card {
    background-color: #161b22;
    border: 1px solid #2d3640;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(0, 191, 255, 0.7), 
                0 0 40px rgba(0, 255, 127, 0.4);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #2d3640;
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-title {
    font-size: 1.5rem;
    color: #00ff7f;
    text-shadow: 0 0 5px rgba(0, 255, 127, 0.5);
    margin: 0 0 0.5rem;
}

.product-description {
    text-align: right;
    font-size: 0.9rem;
    color: #ccc;
    flex-grow: 1;
    margin-bottom: 1rem;
}

.product-description ul {
    padding-right: 1.5rem; 
    padding-left: 0;
    margin: 0;
}

.product-price {
    font-size: 2rem;
    font-weight: bold;
    color: #00bfff;
    text-shadow: 0 0 8px rgba(0, 191, 255, 0.7);
    margin: 0.5rem 0 1.5rem;
}

.buy-button {
    background-color: #00bfff;
    color: #0d1117;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 191, 255, 0.6);
    transition: background-color 0.3s, transform 0.1s, box-shadow 0.3s;
}

.buy-button:hover {
    background-color: #00ff7f;
    color: #0d1117;
    box-shadow: 0 0 15px rgba(0, 255, 127, 0.8);
}

.buy-button:active {
    transform: scale(0.98);
}

/* Modal styling (Unchanged) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.modal.is-visible {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background-color: #161b22;
    color: #e6e6e6;
    padding: 1.5rem;
    border-radius: 15px;
    position: relative;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.8), 0 0 50px rgba(0, 191, 255, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease-out;
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #2d3640;
    padding-bottom: 1rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #00bfff;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #777;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #e6e6e6;
}

.modal-input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background-color: #0d1117;
    color: #e6e6e6;
    border: 1px solid #00bfff;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
}

.modal-input.is-error {
    border-color: #ff0000;
}

.modal-buttons .submit-btn {
    background-color: #00bfff;
    color: #0d1117;
    border: none;
    box-shadow: 0 0 8px rgba(0, 191, 255, 0.7);
}

.modal-buttons .submit-btn:hover {
    background-color: #00ff7f;
    box-shadow: 0 0 10px rgba(0, 255, 127, 0.8);
}

.modal-buttons .cancel-btn {
    background-color: #2d3640;
    color: #e6e6e6;
    border: 1px solid #444;
}

.modal-buttons .cancel-btn:hover {
    background-color: #444;
}

.telegram-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: #00bfff;
    color: #0d1117;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 191, 255, 0.6);
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    z-index: 999;
}

.telegram-button:hover {
    background-color: #00ff7f;
    box-shadow: 0 4px 15px rgba(0, 255, 127, 0.8);
    transform: scale(1.05);
}

.error-message {
    color: #ff5555;
    font-size: 0.85rem;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    display: none;
}

/* Toast message styling (Unchanged) */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #00ff7f;
    color: #0d1117;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 255, 127, 0.8);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
}

.toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-20px);
}

/* ------------------------------------------------------------------- */
/* Footer Styling (Unchanged) */

.main-footer {
    background-color: #161b22;
    color: #e6e6e6;
    padding: 30px 20px;
    border-top: 1px solid #2d3640;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.5);
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.copyright {
    text-align: right;
    font-size: 0.9rem;
}

.copyright p {
    margin: 0 0 5px 0;
}

.slogan-text {
    color: #999;
    font-size: 0.8rem;
}

.neon-blue {
    color: #00bfff;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 191, 255, 0.5); 
}

.social-links {
    display: flex;
    gap: 20px;
}

.footer-link {
    color: #00ff7f;
    text-decoration: none;
    font-size: 1rem;
    padding: 5px 10px;
    border: 1px solid transparent;
    transition: color 0.3s, border 0.3s;
    text-shadow: 0 0 5px rgba(0, 255, 127, 0.5);
}

.footer-link:hover {
    color: #e6e6e6;
    border-color: #00bfff;
    border-radius: 5px;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .copyright {
        text-align: center;
    }
}