/** 
 * GLOBALLY RESPONCIVE SYSTEM 
 * Combines all site @media queries for streamlined maintainability 
 */

/* ==========================================================
   TABLET LANDSCAPE & SMALL DESKTOPS (Max-width: 1100px)
   ========================================================== */
@media (max-width: 1100px) {
    /* MAP.PHP & ABOUT.PHP Fixes */
    nav { 
        flex-direction: column; 
        padding: 15px; 
        gap: 15px; 
        height: auto; 
    }
    .nav-links { 
        flex-wrap: wrap; 
        justify-content: center; 
        gap: 15px; 
    }
    
    /* map layout */
    .layout-grid { grid-template-columns: 1fr; height: auto; }
    .legend-container { width: 100%; height: auto; max-height: 350px; }
    .map-wrapper { height: 50vh; }
    
    /* about layout */
    .content-block { grid-template-columns: 1fr; gap: 40px; }
    .content-block.reverse { grid-template-columns: 1fr; }
    .photo-frame { width: 100%; height: 250px; }
    .figures-layer { flex-direction: column; align-items: center; }
    .figure-wrapper { width: 100%; height: 30vh; }
    
    /* global footer */
    .footer-container { flex-direction: column; text-align: center; justify-content: center; } 
    .footer-left { flex-direction: column; } 
    .footer-socials { justify-content: center; width: 100%; margin-top: 15px; }
    
    /* global player */
    .ost-player.corner-mode { bottom: 80px; left: 50%; right: auto; transform: translateX(-50%) scale(1); }
}

/* ==========================================================
   TABLET PORTRAIT (Max-width: 900px)
   ========================================================== */
@media (max-width: 900px) {
    /* CAROUSEL (from index & profile) */
    .carousel-item { width: 260px; height: 100px; }
    .carousel-img { width: 100px; min-width: 100px; }
    .carousel-item.c-prev { transform: translate(calc(-50% - 270px), -50%) scale(0.85); }
    .carousel-item.c-next { transform: translate(calc(-50% + 270px), -50%) scale(0.85); }
}

/* ==========================================================
   MOBILE PHONES (Max-width: 768px)
   ========================================================== */
@media (max-width: 768px) {
    /* UNIVERSAL/GLOBAL FIXES */
    html, body {
        overflow-x: hidden; 
        overflow-y: auto !important;
    }
    
    /* FLEXIBLE WRAPPING INSTEAD OF RIGID COLUMNS */
    .mobile-stack {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 15px !important;
    }
    
    .mobile-grid-1 {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 15px !important;
    }
    
    .mobile-grid-1 > * {
        flex: 1 1 100% !important;
        min-width: 250px !important;
    }
    
    /* HAMBURGER MENU / OFF-CANVAS SLIDING GLASS */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 22px;
        cursor: pointer;
        z-index: 100000;
        margin-left: auto;
    }
    .mobile-menu-toggle span {
        display: block;
        height: 3px;
        width: 100%;
        background-color: #fff;
        border-radius: 3px;
        transition: all 0.3s ease;
    }
    
    /* Transforming the top Nav-links container into a glass sliding panel */
    nav { 
        padding: 10px 20px; 
        flex-direction: row; 
        align-items: center; 
        justify-content: space-between;
        z-index: 100001;
    }
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%; /* Hidden offscreen by default */
        width: 70%;
        height: 100vh;
        background: rgba(10, 5, 5, 0.95);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 80px;
        gap: 20px;
        transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
        border-left: 1px solid rgba(255, 77, 77, 0.2);
        box-shadow: -10px 0 30px rgba(0,0,0,0.8);
        z-index: 99999;
    }
    .nav-links.active {
        right: 0;
    }
    .nav-links a:not(.logout-btn):not(.login-btn):not(.btn-act) {
        font-size: 1.2rem;
        width: 100%;
        text-align: center;
        padding: 15px 0;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .nav-links .notify-container { margin: 0; margin-bottom: 10px; }
    
    /* FIX: Keep dropdown inside screen width */
    .notify-dropdown {
        width: 90vw !important;
        right: 0 !important;
        left: unset !important;
    }
    
    /* Toggle Icon Animation (when active) */
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(9.5px) rotate(45deg);
        background-color: #ff4d4d;
    }
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-9.5px) rotate(-45deg);
        background-color: #ff4d4d;
    }
    
    /* Dim overlay when menu is open */
    .mobile-nav-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.8);
        z-index: 100000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.4s;
    }
    .mobile-nav-overlay.active { opacity: 1; visibility: visible; }

    /* UCP Sidebar (Global) */
    .ucp-sidebar { width: 100%; right: -100%; border-radius: 0; padding: 20px; }
    
    /* --- PROFILE COMPRESSION --- */
    .profile-header { min-height: 250px; }
    .profile-info-bar { flex-direction: column; align-items: center; text-align: center; padding: 60px 15px 20px 15px; }
    .profile-avatar { top: -50px; left: 50%; transform: translateX(-50%); width: 100px; height: 100px; }
    .profile-name { font-size: 1.5rem; }
    
    .profile-content { flex-direction: column; padding: 0 10px; gap: 15px;}
    .left-col { width: 100%; }
    .characters-grid { grid-template-columns: 1fr; gap: 10px; }
    
    .ban-mini-banner { margin-left: 0; width: 100%; justify-content: center; flex-direction: column; text-align: center; gap: 5px; }
    .theater-glow { transform: scale(0.6); transform-origin: top center; }
    
    .box { padding: 15px 12px; border-radius: 15px;} 

    /* FOOTER */
    .glass-footer { margin-top: 40px; padding: 30px 15px; }

    /* ADMIN PANEL ADAPTATION */
    .admin-wrapper {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 10px;
        overflow-y: auto;
    }
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 15px;
        gap: 10px;
        border-radius: 12px;
    }
    .sidebar h2 { width: 100%; margin-bottom: 20px; }
    .nav-btn {
        margin-bottom: 0;
        padding: 10px;
        flex: 1;
        min-width: 120px;
        justify-content: center;
        font-size: 0.85rem;
    }
    .main-content {
        overflow: visible;
        border-radius: 12px;
    }
    .view-section {
        padding: 20px 15px;
    }
    .content-header {
        padding: 20px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .accounts-list, .char-grid {
        grid-template-columns: 1fr;
    }
    .filters-bar {
        flex-direction: column;
    }
    .filters-bar input, .filters-bar select, .btn-search {
        flex: none;
        width: 100%;
    }
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    /* Log items overlapping fix */
    .log-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        position: relative !important;
    }
    .log-item * {
        min-width: 0 !important;
    }
    .log-item .log-details {
        width: 100% !important;
        margin-top: 10px;
    }
    .log-user-name, .log-user-id {
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
    }
    
    .log-user, .log-time, .log-badge { flex: none !important; width: 100% !important; white-space: normal !important; }
    .acc-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ==========================================================
   EXTREMELY THIN MOBILE SCREENS (Max-width: 480px)
   ========================================================== */
@media (max-width: 480px) {
    .footer-container { padding: 0 10px; }
    .auth-form-container { height: 420px; }
    .login-form input { padding: 10px; font-size: 0.9rem; margin-bottom: 15px;}
    .ucp-title { font-size: 1.5rem; margin-bottom: 20px;}
}