/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   MOBILE MENU
   ======================================== */

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 0;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    z-index: 999;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: var(--spacing-xl);
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.mobile-menu-brand svg {
    color: var(--accent-color);
}

.mobile-menu-brand span {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-text);
}

.mobile-menu-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    color: var(--secondary-text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-nav-item svg {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
    background: var(--secondary-bg);
    color: var(--primary-text);
}

.mobile-nav-item:hover svg,
.mobile-nav-item:active svg {
    opacity: 1;
}

.mobile-nav-item.active {
    background: var(--accent-color);
    color: #000;
}

.mobile-nav-item.active svg {
    opacity: 1;
    color: #000;
}

@media (max-width: 768px) {
    /* PREVENT HORIZONTAL SCROLL - AGGRESSIVE */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
        position: relative;
    }

    /* Prevent all elements from overflowing */
    * {
        max-width: 100%;
    }

    /* FIXED TOP NAV - for mobile (ALWAYS VISIBLE) */
    .top-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 999 !important;
        width: 100% !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure top-nav is visible in ALL views (including path-detail-view) */
    .path-detail-view .top-nav,
    body.viewing-map .top-nav {
        display: flex !important;
        visibility: visible !important;
    }

    /* Add padding to body so content doesn't hide under nav */
    body {
        padding-top: var(--nav-height) !important;
    }

    .main-container {
        padding-top: 0 !important;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .main-nav {
        display: none;
    }

    /* Hide desktop brand/logo on mobile (menu button is the logo) */
    .brand {
        display: none;
    }

    .hero-header {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .hero-logo {
        width: 64px;
        height: 64px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-description {
        font-size: 1rem;
    }

    /* Hide stats on mobile - takes up space */
    .stats {
        display: none;
    }

    .stat-value {
        font-size: 2rem;
    }

    .main-container {
        padding: var(--spacing-xl) var(--spacing-lg);
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Biblioteka responsive */
    .page-header {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
        min-width: 0;
    }

    .page-title {
        font-size: 2rem;
    }

    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    .agents-group-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        max-width: 100%;
    }

    /* Prevent all grids from causing horizontal scroll */
    .books-grid,
    .voting-grid,
    .agents-grid {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .top-nav {
        padding: 0 var(--spacing-md);
    }

    .brand-text {
        display: none;
    }

    .user-badge .badge-label {
        display: none;
    }

    /* Keep stats as 2x2 grid on mobile (removed 1 column override) */
}

/* ========================================

/* UTILITIES */

   UTILITIES
   ======================================== */

.notification {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

