/* ===================================
   CRITICAL: OVERFLOW FIX v2.2.8
   =================================== */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: hidden;
}

/* Main content wrapper */
section {
    max-width: 100vw;
    overflow-x: hidden;
}

.content-card,
.disease-content,
.disease-summary-card,
.smart-link-box {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

/* Allow gallery to scroll inside content-card */
.content-card {
    overflow: visible;
}

/* Fix long text overflow */
p, li, span, div, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Fix image overflow */
img {
    max-width: 100%;
    height: auto;
}

/* Fix video container */
.video-container {
    max-width: 100%;
    overflow: hidden;
}

.video-container iframe {
    max-width: 100%;
}

/* Fix gallery - ALLOW horizontal scroll */
.gallery-carousel {
    max-width: 100%;
}

.symptom-gallery {
    max-width: 100%;
    overflow: visible;
}

/* gallery-track needs to scroll */
.gallery-track {
    overflow-x: auto !important;
    overflow-y: hidden;
}

/* Fix FAQ overflow */
.faq-list,
.faq-item-display {
    max-width: 100%;
    overflow: hidden;
}

.faq-question span {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.faq-answer {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Main grid fix */
.main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 30px;
    max-width: 100%;
    overflow-x: hidden;
}

/* Sidebar fix - prevent overflow */
.main-grid aside {
    max-width: 100%;
    min-width: 0;
}

/* Disease main section */
.disease-main-section {
    max-width: 100vw;
    overflow-x: hidden;
}

.disease-summary-card {
    max-width: 100%;
    overflow: hidden;
}

/* Desktop sidebar fix */
@media (min-width: 1025px) {
    .main-grid {
        grid-template-columns: minmax(0, 1fr) 320px !important;
    }
}

/* Tablet - 2 column but smaller sidebar */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-grid {
        grid-template-columns: minmax(0, 1fr) 280px !important;
        gap: 25px !important;
    }
    
    .disease-summary-card {
        padding: 20px !important;
    }
}

/* ===================================
   ENHANCED HERO SECTION STYLES
   =================================== */
.disease-hero {
    position: relative;
}

.disease-hero a {
    transition: all 0.3s ease;
}

.disease-hero a:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3) !important;
}

.disease-hero .hero-icon-wrapper {
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
    50% { box-shadow: 0 8px 40px rgba(255,255,255,0.3); }
}

.disease-hero .hero-right > div:first-child {
    transition: transform 0.4s ease;
}

.disease-hero .hero-right:hover > div:first-child {
    transform: scale(1.02);
}

/* Floating Stats Card Animation */
.disease-hero .hero-right > div > div:nth-child(2) {
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Bottom Info Bar Hover */
.disease-hero [style*="border-top: 1px solid"] > div {
    transition: all 0.3s ease;
    padding: 10px;
    border-radius: 12px;
}

.disease-hero [style*="border-top: 1px solid"] > div:hover {
    background: rgba(255,255,255,0.1);
}

/* ===================================
   DISEASE CONTENT STYLES (wp_editor)
   =================================== */
.disease-content {
    color: #2C3E50;
    line-height: 1.8;
}

.disease-content p {
    margin: 0 0 15px 0;
}

.disease-content p:last-child {
    margin-bottom: 0;
}

.disease-content ul,
.disease-content ol {
    margin: 10px 0;
    padding-left: 25px;
}

.disease-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.disease-content strong {
    color: #1a252f;
    font-weight: 600;
}

.disease-content a {
    color: #27AE60;
    text-decoration: underline;
}

.disease-content a:hover {
    color: #1e8449;
}

/* ===================================
   NEW: DISEASE SUMMARY CARD
   =================================== */
.disease-summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid <?php echo esc_attr($severity_color); ?>;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.summary-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-label {
    color: #7F8C8D;
    font-weight: 500;
    min-width: 120px;
    font-size: 0.95rem;
}

.summary-value {
    color: #2C3E50;
    font-weight: 600;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.severity-badge {
    background: <?php echo esc_attr($severity_color); ?>;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 700;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.plant-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.plant-tag {
    background: #FEF5E7;
    color: #D68910;
    padding: 6px 14px;
    border-radius: 18px;
    font-size: 0.85em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #F9E79F;
}

.plant-tag-link {
    cursor: pointer;
}

.plant-tag-link:hover {
    background: #FAD7A0 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(214, 137, 16, 0.2);
    border-color: #D68910;
}

/* ===================================
   NEW: STICKY CTA (Mobile Only)
   =================================== */
.sticky-cta {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #27AE60, #229954);
    padding: 12px 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 999;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.sticky-cta-btn {
    background: white;
    color: #27AE60;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.sticky-cta-btn:active {
    transform: scale(0.98);
}

/* ===================================
   IMPROVED: SYMPTOM IMAGE GALLERY
   =================================== */
.symptom-with-image {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    align-items: start;
    padding: 20px;
    background: #FFF5F5;
    border-left: 4px solid #E74C3C;
    border-radius: 8px;
    margin-bottom: 15px;
}

.symptom-image {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.symptom-text {
    color: #2C3E50;
    line-height: 1.7;
}

/* ===================================
   MOBILE RESPONSIVE CSS
   =================================== */

/* Tablet (≤ 768px) */
@media (max-width: 768px) {
    /* CRITICAL: Prevent horizontal scroll on mobile */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    /* Critical overflow fix for mobile */
    body {
        overflow-x: hidden;
    }
    
    .container {
        padding: 0 15px !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    /* Main grid - single column on mobile */
    .main-grid {
        display: block !important;
        grid-template-columns: 1fr !important;
    }
    
    /* Sidebar on mobile */
    .main-grid aside {
        margin-top: 30px;
    }
    
    /* Fix all content cards */
    .content-card {
        max-width: 100% !important;
        overflow: hidden !important;
        padding: 15px !important;
    }
    
    /* Fix gallery grid on mobile - FULL WIDTH */
    .symptom-gallery {
        margin: 25px 0 0 0 !important;
        padding: 25px 0 0 0 !important;
        width: 100% !important;
    }
    
    .gallery-grid {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Affected plants - 2 columns on mobile */
    .affected-plants-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .affected-plants-grid .plant-card {
        font-size: 0.9rem;
    }
    
    .affected-plants-grid .plant-card > div:first-child {
        height: 100px !important;
    }
    
    .affected-plants-grid .plant-card > div:last-child {
        padding: 10px !important;
    }
    
    /* Products grid - 2 columns on mobile */
    .products-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .products-grid .product-card-mini {
        font-size: 0.85rem;
    }
    
    .products-grid .product-card-mini .product-thumb {
        height: 100px !important;
    }
    
    .products-grid .product-card-mini .product-name {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
    }
    
    .products-grid .product-card-mini .product-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .products-grid .product-card-mini .product-actions a {
        font-size: 0.75rem !important;
        padding: 6px 8px !important;
    }

    /* Fix video container */
    .video-container {
        margin-left: -20px;
        margin-right: -20px;
        width: calc(100% + 40px);
    }
    
    #video-guide {
        margin-left: -30px !important;
        margin-right: -30px !important;
        padding: 20px !important;
        border-radius: 0 !important;
    }
    
    /* Fix FAQ on mobile */
    #faq .container {
        padding: 0 15px !important;
    }
    
    .faq-question {
        padding: 15px !important;
        font-size: 0.95rem !important;
    }
    
    .faq-question > span:first-child {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    
    .faq-answer > div {
        padding: 0 15px 15px 15px !important;
    }
    
    /* NEW Hero Section Responsive */
    .disease-hero .hero-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        padding: 40px 0 30px !important;
    }
    
    .disease-hero .hero-right {
        order: -1;
        max-width: 280px;
        margin: 0 auto;
    }
    
    .disease-hero .hero-title {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
    }
    
    .disease-hero .hero-icon-wrapper {
        width: 65px !important;
        height: 65px !important;
    }
    
    .disease-hero .hero-icon-wrapper span {
        font-size: 35px !important;
    }
    
    /* Hero Section - Legacy (keep for compatibility) */
    section[style*="padding: 80px 0 60px"] {
        padding: 40px 0 30px !important;
    }
    
    .hero-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .hero-icon {
        font-size: 45px !important;
    }
    
    .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    .hero-badges {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    
    .hero-badge {
        font-size: 13px !important;
        padding: 5px 14px !important;
    }
    
    .hero-excerpt {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
    
    .hero-image {
        height: 220px !important;
        border-radius: 14px !important;
    }
    
    /* Main Grid */
    .main-grid {
        grid-template-columns: 1fr !important;
        gap: 25px !important;
    }
    
    /* Summary Card */
    .disease-summary-card {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .summary-label {
        min-width: 100px;
        font-size: 0.9rem;
    }
    
    /* Content Cards */
    .content-card {
        padding: 22px !important;
        margin-bottom: 22px !important;
        border-radius: 12px !important;
    }
    
    .content-card h2 {
        font-size: 1.5rem !important;
        margin-bottom: 18px !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        line-height: 1.3 !important;
    }
    
    .content-card h3 {
        font-size: 1.2rem !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Symptom Images */
    .symptom-with-image {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .symptom-image {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
    
    /* Show Sticky CTA */
    .sticky-cta {
        display: block;
    }
    
    /* Add padding to body to prevent content being hidden by sticky CTA */
    body {
        padding-bottom: 70px;
    }
}

/* Small Mobile (≤ 480px) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.5rem !important;
    }
    
    .hero-icon {
        font-size: 35px !important;
    }
    
    .content-card {
        padding: 18px !important;
    }
    
    .content-card h2 {
        font-size: 1.3rem !important;
    }
    
    .summary-label {
        min-width: 85px;
        font-size: 0.85rem;
    }
    
    .plant-tag {
        font-size: 0.8em;
        padding: 5px 12px;
    }
}

/* Extra Small Mobile (≤ 360px) */
@media (max-width: 360px) {
    .hero-title {
        font-size: 1.35rem !important;
    }
    
    .content-card h2 {
        font-size: 1.2rem !important;
    }
    
    .sticky-cta {
        padding: 10px 15px;
    }
    
    .sticky-cta-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}

/* Landscape Mode Optimization */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
    section[style*="padding"] {
        padding-top: 20px !important;
        padding-bottom: 20px !important;
    }
    
    .hero-image {
        height: 150px !important;
    }
    
    .sticky-cta {
        padding: 8px 15px;
    }
}
                        /* Simple Grid Gallery */
                        .symptom-gallery {
                            max-width: 100%;
                        }
                        
                        .gallery-grid {
                            display: grid;
                            grid-template-columns: repeat(4, 1fr);
                            gap: 10px;
                            max-width: 100%;
                        }
                        
                        .gallery-item {
                            display: block;
                            border-radius: 8px;
                            overflow: hidden;
                            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
                            transition: transform 0.3s, box-shadow 0.3s;
                            aspect-ratio: 1;
                        }
                        
                        .gallery-item:hover {
                            transform: scale(1.03);
                            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
                        }
                        
                        .gallery-item img {
                            width: 100%;
                            height: 100%;
                            object-fit: cover;
                        }
                        
                        /* Tablet */
                        @media (max-width: 1024px) {
                            .gallery-grid {
                                grid-template-columns: repeat(4, 1fr);
                                gap: 8px;
                            }
                        }
                        
                        /* Mobile - 3 columns */
                        @media (max-width: 768px) {
                            .gallery-grid {
                                grid-template-columns: repeat(3, 1fr);
                                gap: 8px;
                            }
                            
                            .gallery-item {
                                border-radius: 6px;
                            }
                        }
.faq-question:hover {
    background: #E3F2FD !important;
}
.faq-item-display:hover {
    box-shadow: 0 5px 25px rgba(21, 101, 192, 0.15);
}
@media (max-width: 768px) {
    .faq-question {
        padding: 15px 18px !important;
        font-size: 1rem !important;
    }
    .faq-question span:first-child {
        gap: 10px !important;
    }
    .faq-question span span:first-child {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
    .faq-answer > div {
        padding: 0 18px 20px 56px !important;
    }
}
