/* =========================================
   1. NUCLEAR GOOGLE TRANSLATE HIDING & RESET
   ========================================= */
html, body { 
    top: 0 !important; 
    position: static !important; 
    margin-top: 0 !important;
    min-height: 100vh;
}

/* Hide all Google Translate Elements */
.goog-te-banner-frame.skiptranslate, 
.goog-te-banner-frame, 
iframe.goog-te-banner-frame, 
#goog-gt-tt, 
.goog-te-balloon-frame, 
.goog-tooltip,
.VIpgJd-ZVi9od-ORHb-OEVmcd, 
.VIpgJd-ZVi9od-ORHb, 
.VIpgJd-ZVi9od-aXJM0c { 
    display: none !important; 
    visibility: hidden !important; 
    height: 0 !important; 
    width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -9999 !important;
}

body > .skiptranslate { display: none !important; }

/* Variables */
:root { 
    --primary: #008080; 
    --bg: #f4f7f6; 
    --card-bg: #ffffff; 
    --header-bg: #ffffff; 
    --text: #333333; 
    --text-sec: #666666; 
    --border: #e0e0e0; 
    --input-bg: #f5f5f5; 
    --link-bg: #f0f4f4; 
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-hover: 0 5px 15px rgba(0,0,0,0.1);
    --radius: 12px; 
    --nav-height: 65px; 
    --header-height: 70px; 
    --drawer-width: 280px; 
}

body.dark-mode { 
    --bg: #121212; 
    --card-bg: #1e1e1e; 
    --header-bg: #1e1e1e; 
    --text: #e0e0e0; 
    --text-sec: #aaaaaa; 
    --border: #333333; 
    --input-bg: #2c2c2c; 
    --link-bg: #333333; 
    --shadow: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-hover: 0 5px 15px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }

body { 
    font-family: 'Poppins', sans-serif; 
    background-color: var(--bg); 
    margin: 0; padding: 0; 
    color: var(--text); 
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden !important; 
}

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: color 0.2s; }
ul { list-style: none; padding: 0; margin: 0; }

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


/* =========================================
   2. DESKTOP HEADER
   ========================================= */
.desktop-header { 
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px; height: var(--header-height);
    background: var(--header-bg); border-bottom: 1px solid var(--border); 
    box-shadow: var(--shadow); position: sticky; top: 0; z-index: 1000;
} 

.desktop-header .app-logo { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.desktop-header .logo-icon-img { height: 36px; width: auto; display: block; }
.desktop-header .logo-text { font-size: 1.5rem; font-weight: 700; color: var(--primary); letter-spacing: -0.5px; line-height: 1; }

.search-wrapper { display: flex; align-items: center; gap: 15px; }
.language-switcher { display: flex; gap: 10px; }
.lang-btn { font-size: 0.85rem; color: var(--text-sec); font-weight: 500; cursor: pointer; padding: 5px 10px; border-radius: 6px; transition: all 0.2s; }
.lang-btn:hover, .lang-btn.active { background: rgba(0, 128, 128, 0.1); color: var(--primary); }
#desktopSearchInput { padding: 8px 15px; border: 1px solid var(--border); border-radius: 20px; background: var(--input-bg); color: var(--text); width: 250px; outline: none; }
#desktopSearchInput:focus { border-color: var(--primary); background: var(--card-bg); }


/* =========================================
   3. SIDE DRAWER (PROFESSIONAL)
   ========================================= */
.mobile-header { display: none; } 
.bottom-nav { display: none; }

#mobile-drawer { 
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; 
    width: var(--drawer-width); height: 100%; 
    background: var(--card-bg); 
    box-shadow: 4px 0 15px rgba(0,0,0,0.1); 
    z-index: 2001; 
    transform: translateX(-100%); 
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}
#mobile-drawer.open { transform: translateX(0); visibility: visible; }

.drawer-header { padding: 20px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: var(--bg); }
.drawer-title { font-size: 1.2rem; font-weight: 700; color: var(--primary); }

/* Professional Close Button */
#drawer-close-btn {
    font-size: 1.2rem; color: var(--text-sec);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}
#drawer-close-btn:hover { background-color: rgba(231, 76, 60, 0.1); color: #e74c3c; transform: rotate(90deg); }
body.dark-mode #drawer-close-btn:hover { background-color: rgba(231, 76, 60, 0.2); color: #ff6b6b; }


.drawer-content { flex-grow: 1; overflow-y: auto; padding: 10px 10px; }
.drawer-item, .drawer-item-expandable { display: flex; align-items: center; padding: 12px 15px; margin-bottom: 5px; color: var(--text); font-weight: 500; font-size: 0.95rem; border-radius: 8px; cursor: pointer; transition: background 0.2s; }
.drawer-item:hover, .drawer-item-expandable:hover { background: rgba(0,128,128,0.08); color: var(--primary); }
.drawer-item i, .drawer-item-expandable i { width: 24px; text-align: center; margin-right: 15px; color: var(--text-sec); font-size: 1.1rem; }
.drawer-item:hover i { color: var(--primary); }

.drawer-submenu { display: none; padding-left: 54px; border-left: 2px solid var(--border); margin-left: 22px; margin-bottom: 10px; }
.drawer-submenu.show { display: block !important; }
.drawer-submenu a { display: block; padding: 8px 0; color: var(--text-sec); font-size: 0.9rem; }
.drawer-submenu a:hover { color: var(--primary); font-weight: 600; }

.drawer-arrow { margin-left: auto; font-size: 0.8rem; transition: transform 0.3s; }
.drawer-item-expandable.open .drawer-arrow { transform: rotate(180deg); }
.drawer-section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-sec); margin: 20px 0 10px 15px; font-weight: 700; }
.drawer-footer { padding: 20px; border-top: 1px solid var(--border); background: var(--bg); font-size: 0.8rem; color: var(--text-sec); text-align: center; }
#drawer-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; backdrop-filter: blur(2px); }


/* =========================================
   4. CARDS & SECTIONS
   ========================================= */
.news-box { background: var(--card-bg); border-left: 5px solid var(--primary); padding: 20px; margin-bottom: 25px; border-radius: var(--radius); box-shadow: var(--shadow); }
.stats-card { background: var(--card-bg); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; border: 2px solid var(--primary); margin-bottom: 30px; }
.stats-card .count { font-size: 2.5rem; font-weight: bold; color: var(--primary); }
.section-title { background: var(--primary); color: white; padding: 12px 15px; border-radius: var(--radius); margin-top: 30px; margin-bottom: 20px; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

/* Quiz Cards */
.quiz-card { 
    background: var(--card-bg); 
    border-radius: var(--radius); 
    box-shadow: var(--shadow); 
    padding: 20px; 
    margin-bottom: 15px; 
    border: 1px solid var(--border); 
    transition: transform 0.2s, box-shadow 0.2s; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; /* Changed to flex-start to prevent gaps */
    cursor: pointer; /* RESTORED: Card is clickable again */
    position: relative; 
}

@media (hover: hover) { .quiz-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); } }

.quiz-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; width: 100%; }
.quiz-info-wrapper { flex-grow: 1; display: block; text-decoration: none; color: inherit; }
.quiz-title { font-weight: 600; font-size: 1.1rem; margin-bottom: 8px; color: var(--text); line-height: 1.4; }
.quiz-meta { font-size: 0.9rem; color: var(--text-sec); margin-bottom: 0; }

.quiz-icon { 
    transition: transform 0.3s ease; 
    margin-top: 5px; 
    color: var(--text-sec); 
} 
.quiz-card.open .quiz-icon { transform: rotate(180deg); }

.quiz-share-btn { background: transparent; border: 1px solid var(--border); color: var(--primary); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; flex-shrink: 0; margin-left: 5px; }
.quiz-share-btn:hover { background: var(--link-bg); transform: scale(1.1); border-color: var(--primary); }

.quiz-links-wrapper { 
    max-height: 0; 
    overflow: hidden; 
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: 0 solid transparent;
    /* Smooth Transition for height and spacing */
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out, margin 0.3s ease, padding 0.3s ease; 
} 

.quiz-card.open .quiz-links-wrapper { 
    max-height: 500px; 
    opacity: 1;
    padding-top: 10px; 
    margin-top: 10px; 
    border-top: 1px solid var(--border); 
}

.quiz-links { display: flex; flex-wrap: wrap; gap: 8px; }
.look-1-card { border-left: 5px solid var(--primary); }

.plan-content { word-wrap: break-word; word-break: break-word; white-space: normal !important; }

/* PROFESSIONAL LINKS IN STUDY PLANS */
.plan-content a {
    color: var(--primary);
    background-color: rgba(0, 128, 128, 0.08); /* Light tint of primary */
    padding: 0 4px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(0, 128, 128, 0.3);
    transition: all 0.2s ease;
}

.plan-content a:hover {
    background-color: rgba(0, 128, 128, 0.2);
    text-decoration: none;
    border-bottom-color: var(--primary);
}

/* =========================================
   5. TABS & FILTERS
   ========================================= */
.category-tabs { display: flex; overflow-x: auto; gap: 10px; padding: 10px 0; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar { display: none; }
.tab-pill { white-space: nowrap; padding: 8px 18px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; color: var(--text-sec); font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.3s ease; flex-shrink: 0; }
.tab-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 10px rgba(0, 128, 128, 0.3); }
.forum-filter-bar { display: flex; gap: 8px; padding: 5px 0 15px 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.forum-filter-bar::-webkit-scrollbar { display: none; }
.filter-btn { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-sec); cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: all 0.2s; flex-shrink: 0; }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.cat-badge { font-size: 0.65rem; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; font-weight: bold; margin-bottom: 5px; display: inline-block; background: #e0e0e0; color: #333; }

/* =========================================
   6. ATTACHMENTS & ACTIONS
   ========================================= */
.post-actions { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; margin-top: 15px; border-top: 1px dashed var(--border); }
.action-btn { background: transparent; border: none; font-size: 0.9rem; color: var(--text-sec); cursor: pointer; display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 5px; transition: background 0.2s; }
.action-btn:hover { background: var(--link-bg); }
.action-btn.liked { color: #e74c3c; } 
.attachment-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.att-img { width: 100%; max-width: 150px; height: 100px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }
.att-pdf { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--link-bg); border: 1px solid var(--border); padding: 10px 15px; border-radius: 8px; color: var(--text) !important; text-decoration: none !important; width: 100%; max-width: 350px; transition: 0.2s; }
.att-pdf:hover { border-color: var(--primary); background: rgba(0,128,128,0.05); }
.att-pdf-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex-grow: 1; }
.att-pdf-info i { color: #e74c3c; font-size: 1.2rem; }
.att-filename { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.att-download-btn { padding: 6px 12px; font-size: 0.8rem; background: var(--primary); color: white !important; border: none; border-radius: 4px; cursor: pointer; text-transform: uppercase; }

/* =========================================
   7. AUDIO PLAYER & POLLS
   ========================================= */
.audio-player-card { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 25px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; margin-top: 8px; width: 100%; box-sizing: border-box; position: relative; z-index: 10; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.dark-mode .audio-player-card { background: #2c2c2c; border-color: #444; }
.audio-play-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; font-size: 14px; transition: transform 0.2s; }
.audio-play-btn:active { transform: scale(0.9); }
.audio-timeline-container { flex-grow: 1; position: relative; cursor: pointer; height: 20px; display: flex; align-items: center; }
.audio-timeline-bg { width: 100%; height: 5px; background: #e0e0e0; border-radius: 3px; overflow: hidden; }
.dark-mode .audio-timeline-bg { background: #555; }
.audio-progress { width: 0%; height: 100%; background: var(--primary); transition: width 0.1s linear; }
.audio-time { font-size: 0.75rem; color: var(--text-sec); min-width: 35px; text-align: right; }
.audio-speed-btn { font-size: 0.7rem; font-weight: bold; color: var(--primary); background: rgba(0, 128, 128, 0.1); border: none; padding: 4px 6px; border-radius: 4px; cursor: pointer; min-width: 28px; text-align: center; margin-left: 5px; }
.dark-mode .audio-speed-btn { background: rgba(255, 255, 255, 0.1); color: #fff; }

.poll-container { margin: 15px 0; padding: 15px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.poll-question { font-weight: 700; margin-bottom: 12px; color: var(--text); font-size: 1rem; line-height: 1.4; }
.poll-btn { width: 100%; display: block; padding: 12px 15px; margin-bottom: 8px; border: 1px solid var(--border); background: var(--card-bg); color: var(--text); border-radius: 8px; font-weight: 500; text-align: left; cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden; }
.poll-btn:hover { border-color: var(--primary); background: rgba(0,128,128,0.05); color: var(--primary); }
.poll-result-wrapper { margin-bottom: 8px; position: relative; }
.poll-result-bg { background: var(--input-bg); border-radius: 8px; height: 40px; overflow: hidden; position: relative; border: 1px solid transparent; }
.poll-result-fill { height: 100%; position: absolute; left: 0; top: 0; background: rgba(0,128,128,0.15); transition: width 0.6s ease; }
.poll-voted .poll-result-bg { border: 1px solid var(--primary); }
.poll-voted .poll-result-fill { background: rgba(0,128,128,0.25); }
.poll-result-content { position: absolute; width: 100%; height: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0 15px; font-weight: 500; }
.poll-check { color: var(--primary); margin-left: 8px; font-size: 1rem; }
.poll-meta { font-size: 0.8rem; color: var(--text-sec); margin-top: 10px; text-align: right; }

/* --- 8. SETTINGS --- */
.settings-group { background: var(--card-bg); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 25px; box-shadow: var(--shadow); }
.setting-header { padding: 12px 20px; background: var(--bg); border-bottom: 1px solid var(--border); font-weight: 600; color: var(--text-sec); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.settings-list { display: flex; flex-direction: column; }
.setting-item { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 1rem; color: var(--text); transition: background 0.2s; background: var(--card-bg); }
.setting-item:last-child { border-bottom: none; }
.setting-item:hover { background: var(--link-bg); }
.setting-item.active-lang { background: rgba(0, 128, 128, 0.05); color: var(--primary); font-weight: 600; }
.check-icon { display: none; color: var(--primary); font-size: 1.1rem; margin-left: auto; }
.setting-item.active-lang .check-icon { display: block; }

/* --- 9. MODALS & PAGINATION (UPDATED FOR ZOOM) --- */
#img-modal { 
    display: none; 
    position: fixed; 
    z-index: 10000; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); 
    backdrop-filter: blur(5px); 
    overflow: hidden; /* Prevents scroll bars during zoom */
    align-items: center; 
    justify-content: center;
}

#img-modal-content { 
    display: block; 
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain;
    border-radius: 5px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    
    /* Touch Interaction Properties */
    cursor: grab;
    touch-action: none; /* Disables browser handling of gestures */
    transform-origin: center center;
    transition: transform 0.1s linear; /* Smoothness for zoom */
    will-change: transform;
}

#img-modal-close { 
    position: absolute; 
    top: 20px; right: 20px; 
    color: #fff; 
    font-size: 35px; 
    font-weight: bold; 
    cursor: pointer; 
    z-index: 10001; 
    background: rgba(0,0,0,0.3);
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

.pagination { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.btn-page { background: var(--card-bg); color: var(--text); padding: 8px 16px; border: 1px solid var(--border); border-radius: 20px; text-decoration: none; font-weight: 500; transition: all 0.2s; }
.btn-page:hover { background: var(--primary); color: white; border-color: var(--primary); }

.site-footer { background-color: #2c3e50; color: #ecf0f1; padding: 60px 0 20px; margin-top: 50px; font-size: 0.95rem; border-top: 4px solid var(--primary); }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer-col h4 { color: #ffffff; font-size: 1.1rem; margin-bottom: 20px; position: relative; padding-bottom: 10px; border-bottom: 2px solid var(--primary); display: inline-block; letter-spacing: 0.5px; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: #bdc3c7; transition: color 0.2s, padding-left 0.2s; }
.footer-col ul li a:hover { color: #ffffff; padding-left: 5px; }
.footer-bottom { text-align: center; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 40px; padding-top: 20px; color: #95a5a6; font-size: 0.85rem; }

/* --- 10. MEDIA QUERIES (MOBILE) --- */
@media (max-width: 768px) {
    .site-footer { display: none; }
    body { padding-top: var(--header-height); padding-bottom: var(--nav-height); }
    .container { padding: 15px; width: 100%; max-width: 100%; }
    .desktop-header { display: none !important; }
    
    /* MOBILE HEADER (FIXED ALIGNMENT) */
    .mobile-header { 
        display: flex; position: fixed; top: 0; left: 0; width: 100%; 
        height: var(--header-height); background: var(--header-bg); 
        align-items: center; justify-content: space-between; 
        padding: 0 15px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); z-index: 999; 
        overflow: hidden; 
    }
    
    /* LOGO (Centered, No Box) */
    .mobile-header > .app-logo {
        position: absolute; left: 50%; transform: translateX(-50%);
        z-index: 1000; height: var(--header-height); 
        display: flex; align-items: center; justify-content: center;
        gap: 8px; font-size: 1.1rem; font-weight: 700; 
        color: var(--primary); white-space: nowrap; max-width: 50%; 
        background: transparent; border: none; padding: 0;
    }
    .mobile-header .app-logo .logo-icon-img { height: 24px; width: auto; display: block; }
    .mobile-header .app-logo .logo-text { line-height: 1; padding-top: 2px; }

    /* ICONS */
    .header-menu-icon { font-size: 1.5rem; color: var(--primary); z-index: 1001; position: relative; flex-shrink: 0; }
    .header-right-actions { display: flex; gap: 18px; z-index: 1001; position: relative; flex-shrink: 0; align-items: center; }
    .search-wrapper { display: none !important; }

    /* BOTTOM NAV */
    .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height); background: var(--header-bg); justify-content: space-around; align-items: center; box-shadow: 0 -5px 20px rgba(0,0,0,0.05); z-index: 999; border-top: 1px solid var(--border); }
    .nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-sec); font-size: 0.75rem; width: 100%; height: 100%; position: relative; overflow: hidden; }
    .nav-item.active { color: var(--primary); font-weight: 600; }
    .nav-item i { font-size: 1.2rem; margin-bottom: 3px; }
    
    .mobile-search-bar { display: block !important; position: relative; margin-bottom: 15px; } 
    .mobile-search-bar input { width: 100%; padding: 12px 15px 12px 50px; border: none; background: var(--input-bg); border-radius: 12px; box-shadow: 0 4px 12px var(--shadow-subtle); } 
    .mobile-search-bar i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-sec); }
    .look-1-card { border-left: 5px solid var(--primary); }
}

/* Mini Links */
.mini-link { background: var(--link-bg); color: var(--text) !important; padding: 6px 12px; font-size: 0.85rem; border-radius: 6px; border: 1px solid var(--border); display: inline-block; font-weight: 500; transition: all 0.2s; position: relative; overflow: hidden; cursor: pointer; z-index: 5; }
.mini-link:active { background-color: var(--primary); color: white !important; transform: scale(0.95); }
