/* =========================================
   GLOBAL FIX: SCROLL LOCK
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden; /* STRICT: Left-Right Scroll Band */
    margin: 0;
    padding: 0;
}

:root {
    --bg-gradient: linear-gradient(to right, #e0f7fa, #ffe0b2);
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-branding { padding: 15px 0; }
.site-branding a { font-size: 2rem; font-weight: 900; text-decoration: none; color: #ff00cc; }
.title { font-size: 2.5rem; color:#00b894; margin: 10px 0; } /* Updated for Free Theme */
.home-nav { display: flex; justify-content: center; margin-bottom: 20px; }
.home-btn { padding: 10px 20px; border-radius: 40px; background: #2196f3; color: white; text-decoration: none; font-weight: bold; }

.page-wrapper { flex: 1; width: 100%; max-width: 1200px; margin: auto; padding: 0 20px; }
.search-box-container { position: relative; max-width: 600px; margin: 0 auto 30px auto; width: 100%; }
#worksheetSearch { width: 100%; padding: 15px 20px 15px 50px; font-size: 1.1rem; border-radius: 40px; border: 3px solid white; outline: none; }
.search-icon { position: absolute; left: 20px; top: 15px; font-size: 20px; }

.category-nav { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.filter-btn { padding: 10px 20px; border-radius: 30px; border: none; background: white; font-weight: bold; cursor: pointer; transition: 0.3s; }
.filter-btn.active { background: var(--btn-color); color: white; }

.worksheets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; max-width: 1100px; margin: 0 auto; }

.worksheet-card {
    background: white;
    border-radius: 20px;
    padding: 40px 20px 20px;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s;
    cursor: pointer;
    width: 100%;
}

.worksheet-card:hover { transform: translateY(-5px); }

.lang-badge {
    position: absolute; top: 15px; left: 15px;
    background: #00b894; color: white; padding: 5px 12px;
    border-radius: 20px; font-size: 12px; font-weight: bold;
}

.price-badge {
    position: absolute; top: -15px; right: 15px;
    background: #00b894; color: white; padding: 8px 15px;
    border-radius: 20px; font-size: 18px; font-weight: bold;
    border: 3px solid white;
}

.card-icon { font-size: 45px; margin-bottom: 15px; }
.worksheet-card h2 { font-size: 18px; font-weight: 700; color: #2d3436; margin: 10px 0; }
.card-subtitle { font-size: 13px; color: #636e72; margin-bottom: 20px; flex-grow: 1; }

.buy-btn {
    width: 100%; display: block; background: #e0f7fa; color: #00b894;
    text-decoration: none; padding: 12px; border-radius: 12px;
    font-weight: bold; font-size: 16px; transition: 0.3s;
    pointer-events: none;
}
.buy-btn:hover { background: #00b894; color: white; }

@keyframes highlight-glow {
    0% { box-shadow: 0 0 0 6px #ffeaa7; transform: scale(1.02); }
    100% { box-shadow: 0 10px 20px rgba(0,0,0,0.08); transform: scale(1); }
}
.highlight-card { animation: highlight-glow 2s ease-out; }

.hidden { display: none !important; }
.footer { background: #2c3e50; padding: 20px; color: white; margin-top: 40px; width: 100%; }

/* =========================================
   MODAL & LIGHTBOX STYLES (MOBILE PERFECTED)
   ========================================= */
.modal-overlay, .zoom-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75); z-index: 1000;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(5px);
    padding: 15px;
}

.modal-content {
    background: white; 
    width: 100%; 
    max-width: 900px;
    border-radius: 20px; 
    position: relative; 
    padding: 25px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    max-height: 90vh; 
    overflow-y: auto; 
    overflow-x: hidden; 
    margin: 0 auto;
}

.close-btn {
    position: absolute; top: 12px; right: 12px;
    background: #f1f2f6; border: none; font-size: 20px;
    cursor: pointer; color: #2f3640; z-index: 20;
    width: 35px; height: 35px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.close-btn:hover { color: white; background: #e84118; }

.modal-body { display: flex; flex-direction: row; gap: 25px; width: 100%; }

.modal-carousel-wrapper { flex: 1; width: 50%; position: relative; }
.modal-info { flex: 1; width: 50%; display: flex; flex-direction: column; text-align: left; }

#modalTitle { font-size: 22px; margin-top: 0; margin-bottom: 10px; color: #2d3436; word-wrap: break-word; }
.modal-price { color: #00b894; font-size: 28px; margin: 0 0 15px 0; font-weight: bold; }
.modal-description { color: #2d3436; line-height: 1.6; font-size: 15px; margin-bottom: 25px; word-wrap: break-word; }
#modalBuyBtn { pointer-events: auto; text-align: center; display: block; width: 100%; }

.modal-carousel {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    gap: 10px; border-radius: 15px; scrollbar-width: none;
    height: 350px; scroll-behavior: smooth; width: 100%;
}
.modal-carousel::-webkit-scrollbar { display: none; }
.modal-carousel img {
    scroll-snap-align: center; flex: 0 0 100%; height: 100%;
    object-fit: contain; background: #f8f9fa; border: 1px solid #ddd;
    border-radius: 15px; cursor: zoom-in;
}

.carousel-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9); border: 1px solid #eee; 
    width: 36px; height: 36px; border-radius: 50%; font-size: 18px; 
    cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.15); 
    z-index: 5; transition: 0.2s; color: #2d3436;
    display: flex; justify-content: center; align-items: center;
}
.carousel-arrow:hover { background: #55efc4; color: white; border-color: #55efc4; }
.left-arrow { left: 8px; } 
.right-arrow { right: 8px; }

.zoom-overlay img { max-width: 95%; max-height: 90%; object-fit: contain; border-radius: 10px; }
#closeZoom { top: 20px; right: 20px; background: rgba(0,0,0,0.5); color: white; font-size: 28px; }

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    .modal-overlay { padding: 10px; }
    
    .modal-content { 
        padding: 20px 15px; 
        width: 100%;
    }
    
    .modal-body { 
        flex-direction: column;
        gap: 15px; 
    }
    
    .modal-carousel-wrapper, .modal-info {
        width: 100%;
    }
    
    .modal-carousel { height: 260px; }
    #modalTitle { font-size: 20px; text-align: center; }
    .modal-price { font-size: 24px; text-align: center; }
    .modal-description { text-align: center; }
    #modalBadge { align-self: center; margin-bottom: 15px; }
    
    .carousel-arrow { width: 32px; height: 32px; font-size: 16px; }
    .left-arrow { left: 5px; } 
    .right-arrow { right: 5px; }
}

/* =========================================
   APP PROMO BANNER (CUSTOM COLORS)
   ========================================= */
.app-promo-banner {
    background: linear-gradient(135deg, #7ab1e7, #72e7eb);
    max-width: 750px; 
    margin: 15px auto 35px auto;
    padding: 15px 25px; 
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 25px rgba(81, 160, 39, 0.3);
    border: 3px solid white;
    color: white;
    text-align: left;
    position: relative;
    z-index: 30;
    box-sizing: border-box;
}

.promo-icon {
    font-size: 2.8rem;
    margin-right: 15px;
    animation: bounce 2s infinite ease-in-out;
}

.promo-content {
    flex: 1;
}

.promo-content h2 {
    margin: 0 0 5px 0;
    font-size: 1.3rem;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
}

.promo-content p {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
}

.highlight-app-name {
    background: linear-gradient(45deg, #060603, #ff00cc, #4c00ff, #d13d47);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900; 
    font-size: 1.05rem;
    animation: gradientMove 3s ease infinite;
    display: inline-block;
    padding: 0 2px;
    filter: drop-shadow(0px 0px 4px rgba(239, 220, 49, 0.89)); 
}

.play-store-btn {
    background: #ffffff;
    color: #000000;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 0.95rem;
    text-decoration: none;
    margin-left: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.2s, background 0.2s;
    white-space: nowrap; 
    display: flex;
    align-items: center;
    gap: 8px;
}

.play-store-btn:hover {
    background: #f1f2f6;
    transform: scale(1.05);
}

.play-store-btn svg {
    flex-shrink: 0;
}

/* Button Text Bouncing Animation */
.play-store-btn span {
    line-height: 1.3;
    display: inline-block;
    animation: textBounce 2.5s infinite ease-in-out;
}

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

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

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-promo-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px;
        max-width: 90%;
    }
    
    .promo-icon {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .play-store-btn {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
        box-sizing: border-box;
        justify-content: center;
    }
}