@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap');

:root {
    --bg-dark: #0f1115;
    --card-bg: #1a1d24;
    --green-accent: #2e7d32;
    --green-light: #4caf50;
    --red-accent: #c62828;
    --text-main: #f5f5f5;
    --text-muted: #aaaaaa;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Tajawal', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
}

a {
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background-color: #0a0b0e;
    border-bottom: 2px solid var(--green-accent);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-flex {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

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

.logo img {
    height: 70px;
    border-radius: 8px;
}

.logo h1 {
    position: absolute;
    right: 20px;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-main);
}

.contact-header {
    position: absolute;
    left: 20px;
}

.header-login-btn {
    background-color: transparent;
    border: 2px solid var(--green-light);
    color: var(--green-light);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
}

.header-login-btn:hover {
    background-color: var(--green-light);
    color: var(--bg-dark);
}

.page-title {
    text-align: center;
    margin: 40px 0 30px;
    font-size: 2rem;
}

.main-categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 50px;
}

.main-category-card {
    background-color: var(--card-bg);
    border: 2px solid #2a2e39;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.main-category-card:hover {
    transform: translateY(-10px);
    border-color: var(--green-light);
    box-shadow: 0 10px 25px rgba(76, 175, 80, 0.2);
}

.main-category-card .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: var(--green-light);
}

.main-category-card.vip .icon {
    color: #ff5252;
}

.main-category-card.devices .icon {
    color: var(--text-muted);
}

.main-category-card h3 {
    color: var(--text-main);
    font-size: 1.5rem;
}

.back-btn {
    display: inline-block;
    margin: 30px 0 10px;
    background-color: #2a2e39;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    transition: 0.3s;
}

.back-btn:hover {
    background-color: var(--green-accent);
}

.category-section {
    margin: 20px 0 60px;
}

.section-title {
    font-size: 1.6rem;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.accent-green {
    color: var(--green-light);
}

.accent-red {
    color: #ff5252;
}

/* === الشبكة الافتراضية === */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* === تطبيقات السمارت و IPTV - Grid متجاوب مع تمركز الصف الأخير === */
.smart-apps-grid,
.iptv-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    justify-content: center;
    /* تمركز الشبكة بالكامل */
    justify-items: center;
    /* تمركز كل بطاقة في خليتها */
    gap: 20px;
}

/* تثبيت عرض البطاقات لمنع التمدد */
.smart-apps-grid .product-card,
.iptv-grid .product-card {
    width: 100%;
    max-width: 260px;
}

/* تعديل اللوجو ليتناسب */
.smart-apps-grid .server-logo,
.iptv-grid .server-logo {
    width: 90px;
    height: 90px;
}

/* تقليل حجم البطاقات على الشاشات المتوسطة */
@media (max-width: 1100px) {

    .smart-apps-grid,
    .iptv-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* تابلت - 3 أعمدة */
@media (max-width: 900px) {

    .smart-apps-grid,
    .iptv-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .smart-apps-grid .server-logo,
    .iptv-grid .server-logo {
        width: 80px;
        height: 80px;
    }
}

/* هاتف كبير - عمودين */
@media (max-width: 600px) {

    .smart-apps-grid,
    .iptv-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .smart-apps-grid .product-card,
    .iptv-grid .product-card {
        max-width: 100%;
    }

    .smart-apps-grid .server-logo,
    .iptv-grid .server-logo {
        width: 70px;
        height: 70px;
    }
}

/* هاتف صغير - عمود واحد */
@media (max-width: 380px) {

    .smart-apps-grid,
    .iptv-grid {
        grid-template-columns: 1fr;
    }
}

.product-card {
    background-color: var(--card-bg);
    border: 1px solid #2a2e39;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.15);
    border-color: var(--green-accent);
}

.vip-card {
    border-top: 4px solid var(--red-accent);
}

.product-card h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.duration-select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    background-color: #0f1115;
    color: white;
    border: 1px solid #444;
    border-radius: 6px;
    outline: none;
    font-family: inherit;
}

.buy-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, var(--green-accent), var(--green-light));
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.buy-btn:hover {
    filter: brightness(1.1);
}

.opacity-low {
    opacity: 0.7;
}

.disabled-card {
    border-style: dashed;
}

.coming-soon {
    color: var(--red-accent);
    font-weight: bold;
    margin-bottom: 15px;
}

.disabled-btn {
    background: #444;
    cursor: not-allowed;
}

footer {
    background-color: #0a0b0e;
    border-top: 2px solid #333;
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 30px;
}

.payment-methods ul {
    list-style: none;
    margin-top: 15px;
}

.payment-methods li {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.payment-methods b {
    color: var(--text-main);
}

.copyright {
    text-align: right;
    align-self: flex-end;
    color: var(--text-muted);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 15% auto;
    padding: 30px;
    border: 1px solid var(--green-accent);
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 0 30px rgba(46, 125, 50, 0.4);
}

.close-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: white;
}

.order-summary {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: #0f1115;
    border: 1px solid #444;
    color: white;
    border-radius: 6px;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 2px;
}

.input-group input:focus {
    border-color: var(--green-light);
    outline: none;
}

.note-text {
    display: block;
    color: #ffb74d;
    margin-top: 8px;
    font-size: 0.85rem;
}

.error-msg {
    color: #ff5252;
    margin-top: 10px;
    font-size: 0.9rem;
    display: none;
}

.confirm-btn {
    width: 100%;
    padding: 15px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.confirm-btn:hover {
    background: #1ebe5d;
}

.iptv-logo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 20px !important;
}

.server-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 5px;
    border-radius: 12px;
    background: #0f1115;
    padding: 5px;
}

.plan-duration {
    font-size: 1.5rem !important;
    color: var(--green-light);
    margin-bottom: 5px !important;
}

.plan-price {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: #fff;
}

.trial-section {
    text-align: center;
    margin: 40px 0;
    padding: 30px;
    background: rgba(255, 165, 0, 0.05);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 12px;
}

.trial-section h3 {
    color: #ffa500;
    margin-bottom: 15px;
}

.trial-btn {
    background: linear-gradient(45deg, #f57c00, #ffb300);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.trial-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 5px 15px rgba(255, 165, 0, 0.3);
}

.apps-section {
    background-color: var(--card-bg);
    border: 1px solid #2a2e39;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
}

.apps-section h3 {
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    color: var(--text-main);
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    text-align: center;
}

.app-card {
    background: #0f1115;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #333;
}

.app-card h4 {
    margin-bottom: 15px;
    color: var(--text-muted);
}

.app-link-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #333;
    color: white;
    border-radius: 4px;
    font-weight: bold;
    transition: 0.3s;
}

.app-link-btn:hover {
    background: var(--green-accent);
}

.dl-code-box {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--green-light);
    letter-spacing: 3px;
    background: #2a2e39;
    padding: 10px;
    border-radius: 6px;
    display: inline-block;
}

/* توسيط الباقة الثالثة فقط في صفحات التفاصيل */
#plans-container .plan-card:nth-child(3) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 10px);
}

@media (max-width: 600px) {
    #plans-container .plan-card:nth-child(3) {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header-flex {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .footer-content {
        flex-direction: column;
    }

    .logo h1 {
        position: static;
        margin-bottom: 10px;
    }

    .contact-header {
        position: static;
    }
}

/* =========================================================
   تعديل حجم كروت الاشتراكات لصفحة تطبيقات السمارت فقط
========================================================= */
.smart-plans-grid {
    display: flex !important;
    justify-content: center;
    gap: 20px;
}

.smart-plans-grid .product-card {
    width: 100% !important;
    max-width: 260px !important;
    /* هذا الحجم يجعلها مربعة ومطابقة للـ VIP */
    margin: 0 !important;
}

/* توسيط الخانة الأخيرة في قائمة السيرفرات إذا كانت منفردة في السطر */
#iptv-container .product-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
}

/* توسيط الخانة الأخيرة إذا كانت منفردة في السطر (للسيرفرات وتطبيقات السمارت) */
#iptv-container .product-card:last-child:nth-child(odd),
#smart-container .product-card:last-child:nth-child(odd),
#vip-container .product-card:last-child:nth-child(odd),
#devices-container .product-card:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
    justify-self: center !important;
}