/*
Theme Name: AIEdu Platform
Theme URI: 
Author: Lương Hữu Nam
Author URI: 
Description: A modern, glassmorphic App-Grid theme for WordPress.
Version: 3.4.7
Requires at least: 5.0
Tested up to: 6.3
Requires PHP: 7.2
Text Domain: appstyle
*/

/* ==========================================================
   CSS Reset & Base Variables
   ========================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base Fallbacks if variables not injected */
:root {
    --bg-color: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --bg-image: none;
    --accent-color: #6366f1;
    --text-color: #E2E8F0;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    background: var(--bg-image) no-repeat center center fixed, var(--bg-color);
    background-size: cover;
    color: var(--text-color);
    overflow: hidden; /* App Wrapper handles scroll */
    width: 100vw;
    height: 100vh;
    height: 100dvh;
}

/* Hide WP Admin Bar on frontend for app feel */
#wpadminbar {
    display: none !important;
}

/* ==========================================================
   90/10 Flexbox Global Wrapper
   ========================================================== */
#app-wrapper {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

#app-main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    display: flex;
    flex-direction: column;
}

#app-nav-bar {
    height: auto;
    min-height: var(--nav-min-height, 65px);
    padding: 8px 10px;
    flex-shrink: 0;
    width: 100%;
    background: rgba(15, 23, 42, var(--nav-opacity, 0.85));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 9999;
    display: flex;
    align-items: center;
}

/* Admin panel injects order: -1 on PC to move nav bar to top */

/* ==========================================================
   App Grid System (90% Area)
   ========================================================== */
.app-grid-container {
    padding: 20px;
    padding-top: 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    margin-bottom: 30px;
}

@media screen and (min-width: 600px) {
    .app-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 20px;
    }
}

@media screen and (min-width: 1024px) {
    .app-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 30px;
        padding: 40px;
    }
}

/* App Icon / Squircle */
.app-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
}

.app-icon-box {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.app-icon-item:hover .app-icon-box,
.app-icon-item:active .app-icon-box {
    transform: scale(0.95);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.15);
}

.app-icon-box img, .app-icon-box svg {
    width: 55%;
    height: 55%;
    object-fit: contain;
}

.app-icon-box i {
    font-size: 28px;
    background: linear-gradient(135deg, #a855f7 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.app-icon-label {
    font-size: 14px !important;
    color: var(--text-color);
    font-weight: 600 !important;
    text-align: center;
    width: 100%;
    text-overflow: clip !important;
    overflow: visible !important;
    white-space: normal !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    letter-spacing: 0.3px;
    line-height: 1.25;
    margin-top: 6px;
}

/* ==========================================================
   Navigation Bar (10% Area)
   ========================================================== */

/* Hide unwanted mobile menu injected by plugins */
.sub-bottom-nav, 
.module-nav-bar, 
#mobilenav, 
.wpmm-bottom-menu, 
.litespeed-bottom-nav,
.mobile-bottom-nav,
.footer-menu-mobile {
    display: none !important;
}

.bottom-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: flex-start;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.bottom-nav-menu::-webkit-scrollbar {
    display: none;
}

.bottom-nav-menu li {
    flex: 0 0 auto;
    min-width: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.app-nav-item {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--nav-gap, 6px);
    width: 100%;
    height: 100%;
    transition: all 0.2s ease-in-out;
    padding-bottom: var(--nav-padding-bottom, 12px);
}

.app-nav-item span {
    font-size: var(--nav-font-size, 13px) !important;
    font-weight: 500 !important;
    line-height: 1.2;
    color: #ffffff;
    white-space: nowrap;
}

.app-nav-item svg, .app-nav-item i, .app-nav-item img {
    font-size: var(--nav-icon-size, 28px);
    width: var(--nav-icon-size, 28px);
    height: var(--nav-icon-size, 28px);
    max-height: 30px;
    transition: transform 0.2s ease, stroke 0.2s ease, color 0.2s ease;
}

.app-nav-item:hover, .app-nav-item:active, .app-nav-item.active {
    color: var(--accent-color);
}

.app-nav-item:hover svg, .app-nav-item:active svg, .app-nav-item.active svg {
    transform: translateY(-2px) scale(1.1);
    stroke: var(--accent-color);
}
.app-nav-item:hover i, .app-nav-item:active i, .app-nav-item.active i {
    transform: translateY(-2px) scale(1.1);
    color: var(--accent-color);
}

/* Visibility Control for Desktop vs Mobile Nav */
.desktop-nav-menu {
    display: none;
}
.mobile-nav-menu {
    display: flex;
}

@media screen and (min-width: 1024px) {
    #app-nav-bar {
        min-height: 80px;
        padding: 12px 20px;
    }
    .desktop-nav-menu {
        display: flex;
    }
    .mobile-nav-menu {
        display: none;
    }
    
    /* On PC, center items or scroll horizontally if too many */
    .bottom-nav-menu {
        justify-content: center;
        gap: 15px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .bottom-nav-menu::-webkit-scrollbar { 
        display: none; 
    }
    .bottom-nav-menu li {
        min-width: 100px;
    }
}

/* ==========================================================
   Presentation Mode (Fullscreen Engine)
   ========================================================== */
body.presentation-mode {
    background-color: #000 !important;
    overflow: hidden !important;
}

body.presentation-mode #app-wrapper,
body.presentation-mode #app-main-content {
    max-width: 100vw !important;
    height: 100vh !important;
    width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background-color: #000 !important;
    transform: none !important;
}

body.presentation-mode #app-main-content {
    z-index: 99999 !important;
}

body.presentation-mode #app-nav-bar,
body.presentation-mode .top-nav-bar,
body.presentation-mode .app-top-bar,
body.presentation-mode header {
    display: none !important;
}

.presentation-slide {
    display: none;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    background-color: #fff;
    color: #000;
    box-sizing: border-box;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    font-size: 2rem; 
    overflow-y: auto;
}

.presentation-slide.active {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

.presentation-slide h2 {
    font-size: 4rem;
    margin-bottom: 1rem;
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================================
   Search Widget & Dropdown
   ========================================================== */
.app-search-wrapper {
    position: relative;
    width: 90%;
    max-width: 500px;
    margin-top: 30px;
    margin-bottom: 30px;
}

.app-search-input-group {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    padding: 6px 6px 6px 20px;
    display: flex;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.search-icon-left {
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    margin-right: 10px;
}

.app-search-input-group input {
    border: none;
    background: transparent;
    flex: 1;
    outline: none;
    font-size: 14px;
    color: var(--text-color);
}

.app-search-input-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#app-search-btn {
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

#app-search-btn:hover {
    filter: brightness(1.1);
}

/* Dropdown Overlay */
.search-results-overlay {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.search-dropdown-item {
    display: block;
    padding: 12px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s ease;
    border-radius: 8px;
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.search-item-title {
    color: var(--accent-color);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.search-item-excerpt {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    line-height: 1.4;
}

.search-no-results {
    padding: 15px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

/* ==========================================================
   Home Page Footer (Personal/Contact Info)
   ========================================================== */
.app-home-footer {
    width: auto !important;
    margin-top: auto !important;
    margin-bottom: 12px !important;
    padding: 8px 16px !important;
    align-self: center !important;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    line-height: 1.5;
}

.footer-info-container {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: inline-block;
    min-width: 300px;
}

.footer-name {
    color: #E2E8F0;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.footer-details {
    color: rgba(255, 255, 255, 0.7);
}

.footer-details span {
    display: inline-block;
    margin: 0 4px;
}

/* ==========================================================
   Spacing Fixes (Top Menu & Reset)
   ========================================================== */
html, body {
    margin: 0 !important;
    padding: 0 !important;
}

#app-nav-bar, .top-nav-bar, .app-top-bar, header {
    margin-top: 0 !important;
    top: 0 !important;
    padding-top: 6px !important;
    width: 100% !important;
}
