/* =============================================
   FDTU KUTUBXONASI - RESPONSIVE STYLES
   ============================================= */

/* 
   UNIVERSAL DESIGN PRINCIPLE:
   - Same look and feel across all devices
   - Mobile-first approach
   - Touch-friendly on all screens
*/

/* ===== BASE: Mobile First (< 768px) ===== */

/* Container always has consistent padding */
.container {
    padding: 0 1rem;
    max-width: 100%;
}

/* Grids - Single column on mobile */
.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Header - Always visible and clean */
.header {
    height: 60px;
}

.header .container {
    padding: 0 1rem;
}

.logo {
    font-size: 1rem;
}

.logo svg {
    width: 32px;
    height: 32px;
}

/* Navigation - Hidden on mobile (replaced by bottom tab bar) */
.nav {
    display: none !important;
}

/* Hide hamburger toggle on mobile - not needed anymore */
.menu-toggle {
    display: none !important;
}

/* ===== BOTTOM TAB BAR (Mobile Only) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 6px 0 4px;
    text-decoration: none;
    color: #9ca3af;
    font-size: 10px;
    font-weight: 500;
    transition: color 0.2s;
    gap: 2px;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item .tab-icon {
    font-size: 20px;
    line-height: 1;
}

.bottom-nav-item.active {
    color: #1a56db;
}

.bottom-nav-item:active {
    opacity: 0.7;
}

/* Add bottom space so footer isn't hidden behind tab bar */
body {
    padding-bottom: 60px;
}

/* Hide mobile-auth-section (not needed with bottom tab bar) */
.mobile-auth-section {
    display: none;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Hero Section */
.hero {
    padding: 80px 0 1.5rem;
    text-align: center;
}

.hero-title {
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Search Bar - Stacked on mobile */
.search-bar {
    flex-direction: column;
    gap: 0.75rem;
}

.search-bar input {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
    padding: 1rem;
    text-align: center;
    border-radius: 0.75rem;
}

.search-bar button {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
    border-radius: 0.75rem;
}

/* Banner - More compact on mobile */
.banner-slider {
    aspect-ratio: 16/10;
    border-radius: 0.75rem;
}

.banner-dots {
    bottom: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.banner-dot {
    width: 6px;
    height: 6px;
}

/* Sections */
.section {
    padding: 2rem 0;
}

.section-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* Cards - Full width, clean look */
.card {
    border-radius: 0.75rem;
    overflow: hidden;
}

.card-image {
    aspect-ratio: 3/4;
}

.card-body {
    padding: 0.75rem;
}

.card-title {
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.card-meta {
    font-size: 0.75rem;
}

/* Buttons - Touch friendly minimum 48px */
.btn {
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    border-radius: 0.5rem;
}

.btn-sm {
    min-height: 40px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Category chips - Scrollable */
.category-chips {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-chips::-webkit-scrollbar {
    display: none;
}

.category-chip {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 2rem;
    white-space: nowrap;
}

/* User Menu */
.user-dropdown {
    position: fixed;
    top: 60px;
    left: 1rem;
    right: 1rem;
    max-width: none;
}

/* Footer */
.footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
}

/* Modal */
.modal {
    max-width: 95%;
    margin: 1rem;
    border-radius: 1rem;
}

/* Pagination */
.pagination {
    flex-wrap: wrap;
    gap: 0.25rem;
}

.pagination-btn {
    min-width: 44px;
    height: 44px;
    font-size: 0.875rem;
}

/* Toast */
.toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
}

.toast {
    width: 100%;
}

/* Nav Actions in Mobile Menu */
.nav-actions {
    display: none;
}

.nav .nav-actions.mobile-visible {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    gap: 0.5rem;
}


/* ===== TABLET: 768px - 1024px ===== */
@media (min-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    /* 2 columns on tablet */
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .search-bar {
        flex-direction: row;
        max-width: 600px;
        margin: 0 auto;
    }

    .search-bar input {
        text-align: left;
        flex: 1;
    }

    .search-bar button {
        width: auto;
        padding: 0 2rem;
    }

    .banner-slider {
        aspect-ratio: 21/9;
        border-radius: 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        text-align: left;
    }
}


/* ===== DESKTOP: 1024px+ ===== */
@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
        max-width: 1280px;
        margin: 0 auto;
    }

    .header {
        height: 70px;
    }

    .logo {
        font-size: 1.25rem;
    }

    .logo svg {
        width: 40px;
        height: 40px;
    }

    /* Show desktop nav */
    .nav {
        display: flex !important;
        position: static;
        flex-direction: row;
        padding: 0;
        gap: 2rem;
        transform: none;
        background: transparent;
    }

    .nav-link {
        padding: 0.4rem 1rem;
        font-size: 0.95rem;
        min-height: auto;
        background: transparent;
        margin-bottom: 0;
        border-radius: 2rem;
    }

    .nav-link:hover {
        background: rgba(26, 86, 219, 0.08);
        color: #1a56db;
    }

    .nav-link.active {
        background: #1a56db;
        color: #fff;
    }

    .nav-link.active:hover {
        background: #1e40af;
    }

    .menu-toggle {
        display: none !important;
    }

    .nav-actions {
        display: flex;
    }

    /* Hide bottom tab bar and mobile-auth on desktop */
    .bottom-nav {
        display: none !important;
    }

    .mobile-auth-section {
        display: none;
    }

    body {
        padding-bottom: 0;
    }

    /* Full grids on desktop */
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .hero {
        padding: 100px 0 3rem;
    }

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

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .section {
        padding: 4rem 0;
    }

    .section-title {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-title {
        font-size: 1rem;
    }

    /* User dropdown normal position */
    .user-dropdown {
        position: absolute;
        top: 100%;
        left: auto;
        right: 0;
        min-width: 200px;
    }

    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
}


/* ===== LARGE DESKTOP: 1440px+ ===== */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    /* 5 columns for books on large screens */
    .grid-4 {
        grid-template-columns: repeat(5, 1fr);
    }
}


/* ===== PRINT STYLES ===== */
@media print {

    .header,
    .footer,
    .nav,
    .btn,
    .modal-overlay,
    .toast-container,
    .menu-toggle {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}


/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}