/* ============================================
   MEMBERSHIP PAGE - MOBILE RESPONSIVE FIX
   إصلاح مشاكل الـ Responsive في صفحة العضوية
   ============================================ */

/* Fix overflow on mobile */
@media (max-width: 768px) {
    /* Container fixes */
    body {
        overflow-x: hidden;
    }
    
    .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
        overflow-x: hidden;
    }
    
    /* Page Header - make it responsive */
    .page-header {
        padding: 6rem 1rem 3rem !important;
        margin-top: 70px;
    }
    
    .page-header h1 {
        font-size: 2rem !important;
        line-height: 1.2;
        word-wrap: break-word;
    }
    
    .page-header p {
        font-size: 1rem !important;
        padding: 0 0.5rem;
    }
    
    .current-plan-badge {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
        margin-top: 1rem;
        text-align: center;
    }
    
    /* Membership Plans Section */
    .membership-plans {
        padding: 2rem 0 !important;
    }
    
    /* Plans Container - single column on mobile */
    .plans-container {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        margin-bottom: 2rem !important;
        padding: 0 !important;
    }
    
    /* Plan Cards - fix width and overflow */
    .plan-card-detailed {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.5rem !important;
        margin: 0 !important;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .plan-card-detailed.current-plan,
    .plan-card-detailed.featured-plan {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Plan Badge */
    .plan-badge,
    .current-plan-label {
        position: static !important;
        display: inline-block;
        margin-bottom: 1rem;
        transform: none !important;
        font-size: 0.75rem;
        padding: 0.375rem 1rem;
    }
    
    /* Plan Header */
    .plan-header {
        padding-top: 0 !important;
        margin-bottom: 1.5rem !important;
    }
    
    .plan-header h2 {
        font-size: 1.75rem !important;
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    .plan-header p {
        font-size: 0.875rem !important;
        line-height: 1.5;
    }
    
    /* Plan Pricing - make it responsive */
    .plan-pricing {
        padding: 1.5rem 0 !important;
        margin-bottom: 1.5rem !important;
    }
    
    .price-amount {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: center;
        gap: 0.25rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .price-amount .currency {
        font-size: 1.25rem !important;
    }
    
    .price-amount .price {
        font-size: 2.5rem !important;
        line-height: 1;
    }
    
    .price-amount .period {
        font-size: 1rem !important;
    }
    
    .billing-info {
        font-size: 0.8125rem !important;
        padding: 0 0.5rem;
    }
    
    .save-badge {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.75rem !important;
        margin-top: 0.5rem;
    }
    
    /* Plan Features - make list responsive */
    .plan-features-detailed {
        margin-bottom: 1.5rem;
    }
    
    .plan-features-detailed h3 {
        font-size: 1.125rem !important;
        margin-bottom: 1rem !important;
    }
    
    .plan-features-detailed ul {
        margin-bottom: 1rem !important;
        padding: 0;
    }
    
    .plan-features-detailed li {
        display: flex;
        gap: 0.75rem !important;
        margin-bottom: 1rem !important;
        align-items: flex-start;
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .plan-features-detailed li i {
        font-size: 1.125rem !important;
        margin-top: 0.125rem;
        flex-shrink: 0;
    }
    
    .plan-features-detailed li span {
        font-size: 0.875rem !important;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Plan CTA - buttons */
    .plan-cta {
        margin-top: 1.5rem;
    }
    
    .plan-cta .btn {
        width: 100% !important;
        padding: 1rem !important;
        font-size: 1rem !important;
        white-space: normal;
        line-height: 1.4;
    }
    
    .btn-block {
        width: 100% !important;
        display: block !important;
    }
    
    /* Benefits Section */
    .benefits {
        padding: 2rem 0 !important;
    }
    
    .benefits-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .benefit-item {
        padding: 1.5rem !important;
        text-align: center;
    }
    
    .benefit-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
        margin: 0 auto 1rem !important;
    }
    
    .benefit-item h3 {
        font-size: 1.125rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .benefit-item p {
        font-size: 0.875rem !important;
        line-height: 1.6;
    }
    
    /* FAQ Section */
    .faq {
        padding: 2rem 0 !important;
    }
    
    .faq-list {
        gap: 1rem !important;
    }
    
    .faq-item {
        padding: 0 !important;
        margin-bottom: 1rem !important;
    }
    
    .faq-question {
        padding: 1rem !important;
        font-size: 0.875rem !important;
    }
    
    .faq-question h3 {
        font-size: 1rem !important;
        line-height: 1.4;
        word-wrap: break-word;
        padding-right: 2rem;
    }
    
    [dir="rtl"] .faq-question h3 {
        padding-right: 0;
        padding-left: 2rem;
    }
    
    /* Fix FAQ answer visibility - hide completely when not active */
    .faq-answer {
        max-height: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease, visibility 0s 0.3s;
    }
    
    .faq-item.active .faq-answer {
        max-height: 1000px !important;
        padding: 1rem !important;
        opacity: 1;
        visibility: visible;
        transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease, visibility 0s 0s;
    }
    
    .faq-answer p {
        margin: 0 !important;
        font-size: 0.875rem !important;
        line-height: 1.6;
        color: var(--text-medium);
    }
    
    /* CTA Section */
    .cta {
        padding: 3rem 1rem !important;
        text-align: center;
    }
    
    .cta h2 {
        font-size: 1.75rem !important;
        margin-bottom: 1rem !important;
    }
    
    .cta p {
        font-size: 1rem !important;
        margin-bottom: 1.5rem !important;
        padding: 0 0.5rem;
    }
    
    .cta .btn {
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
        width: auto !important;
        max-width: 100%;
    }
    
    /* Section Headers */
    .section-header {
        margin-bottom: 2rem !important;
        padding: 0 0.5rem;
    }
    
    .section-header h2 {
        font-size: 1.75rem !important;
        line-height: 1.3;
        margin-bottom: 0.75rem !important;
    }
    
    .section-header p {
        font-size: 0.9375rem !important;
        line-height: 1.6;
    }
}

/* Extra small devices (phones in portrait, less than 375px) */
@media (max-width: 374px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .plan-card-detailed {
        padding: 1.25rem !important;
    }
    
    .page-header h1 {
        font-size: 1.75rem !important;
    }
    
    .price-amount .price {
        font-size: 2rem !important;
    }
    
    .plan-header h2 {
        font-size: 1.5rem !important;
    }
}

/* Prevent horizontal overflow globally */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

/* Fix any wide elements */
@media (max-width: 768px) {
    .row,
    .grid,
    .flex-container {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Ensure text doesn't cause overflow */
    h1, h2, h3, h4, h5, h6, p, span, a, li {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Fix for any fixed-width elements */
    [style*="width"] {
        max-width: 100% !important;
    }
}
