/**
 * Mobile Styles
 * Mobile-first enhancements, touch optimizations, and responsive overrides
 */

/* =========================================
   MOBILE TOUCH OPTIMIZATIONS
   ========================================= */

/* Ensure all interactive elements meet 48x48px touch target */
@media (max-width: 767px) {
    button,
    a,
    input[type="button"],
    input[type="submit"] {
        min-height: 48px;
        min-width: 48px;
        padding: var(--space-3) var(--space-4);
    }

    /* Increase spacing between interactive elements */
    .navbar-menu button + button,
    .mobile-menu-content button + button {
        margin-top: var(--space-2);
    }
}

/* Remove tap highlight on mobile */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Prevent text selection on interactive elements */
button,
a {
    -webkit-user-select: none;
    user-select: none;
}

/* Smooth scrolling on iOS */
body {
    -webkit-overflow-scrolling: touch;
}

/* =========================================
   MOBILE NAVIGATION
   ========================================= */

@media (max-width: 767px) {
    /* Sticky mobile header - SOLID background for visibility */
    .navbar-container {
        padding: var(--space-3) 0 !important;
        background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 100%) !important;
        border-bottom: 2px solid rgba(197, 160, 89, 0.4) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 60px rgba(197, 160, 89, 0.15) !important;
    }

    .navbar-container.scrolled {
        background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 100%) !important;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7), 0 0 80px rgba(197, 160, 89, 0.2) !important;
        border-bottom: 2px solid rgba(197, 160, 89, 0.5) !important;
    }

    .navbar-wrapper {
        padding: 0 var(--space-4);
    }

    /* Make logo smaller on mobile with better visibility */
    .logo-icon {
        width: 36px;
        height: 36px;
        border-width: 2px;
        box-shadow: 0 4px 12px rgba(197, 160, 89, 0.3);
    }

    .logo-letter {
        font-size: var(--text-base);
        text-shadow: 0 2px 8px rgba(197, 160, 89, 0.5);
    }

    .logo-primary {
        font-size: var(--text-sm);
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        font-weight: 700;
    }

    .logo-secondary {
        font-size: 0.5rem;
        text-shadow: 0 1px 4px rgba(197, 160, 89, 0.4);
    }
}

/* =========================================
   GORGEOUS HAMBURGER BUTTON
   ========================================= */

.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(197, 160, 89, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: calc(var(--z-modal) + 10);
    position: relative;
    overflow: hidden;
}

.hamburger-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(197, 160, 89, 0.2), rgba(252, 211, 77, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.hamburger-btn:hover::before,
.hamburger-btn:focus::before {
    opacity: 1;
}

.hamburger-btn:hover {
    border-color: rgba(197, 160, 89, 0.6);
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(197, 160, 89, 0.3);
}

.hamburger-btn:active {
    transform: scale(0.95);
}

@media (max-width: 767px) {
    .hamburger-btn {
        display: flex;
    }
}

/* Hamburger Lines Container */
.hamburger-box {
    position: relative;
    width: 22px;
    height: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Individual Hamburger Lines */
.hamburger-line {
    display: block;
    width: 100%;
    height: 2.5px;
    background: linear-gradient(90deg, #C5A059, #FCD34D);
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    transform-origin: center;
    box-shadow: 0 1px 3px rgba(197, 160, 89, 0.3);
}

.hamburger-line-top {
    width: 100%;
}

.hamburger-line-middle {
    width: 75%;
    margin-left: auto;
}

.hamburger-line-bottom {
    width: 50%;
    margin-left: auto;
}

/* Hamburger Animation - Open State */
.hamburger-btn.active .hamburger-line-top {
    transform: translateY(6.5px) rotate(45deg);
    width: 100%;
}

.hamburger-btn.active .hamburger-line-middle {
    opacity: 0;
    transform: scaleX(0);
    width: 100%;
}

.hamburger-btn.active .hamburger-line-bottom {
    transform: translateY(-6.5px) rotate(-45deg);
    width: 100%;
}

.hamburger-btn.active {
    background: rgba(197, 160, 89, 0.15);
    border-color: rgba(197, 160, 89, 0.5);
}

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

.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(160deg, #0a1628 0%, #0F172A 40%, #1E3A8A 100%);
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0.4s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0s;
}

/* Decorative Background Glows */
.mobile-menu-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.mobile-menu-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    transition: opacity 0.8s ease 0.2s, transform 1s ease 0.2s;
}

.mobile-menu-glow-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(197, 160, 89, 0.25) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    transform: scale(0.5);
}

.mobile-menu-glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(30, 58, 138, 0.4) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    transform: scale(0.5);
}

.mobile-menu.open .mobile-menu-glow {
    opacity: 1;
    transform: scale(1);
}

/* Menu Content Container */
.mobile-menu-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: calc(70px + var(--space-8)) var(--space-6) var(--space-8);
    padding-bottom: max(var(--space-8), calc(env(safe-area-inset-bottom) + var(--space-8)));
}

/* Navigation Links Container */
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
}

/* Individual Navigation Links */
.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    width: 100%;
    padding: var(--space-4) var(--space-5);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Staggered animation */
    opacity: 0;
    transform: translateX(-30px);
}

.mobile-menu.open .mobile-nav-link {
    opacity: 1;
    transform: translateX(0);
    transition-delay: calc(var(--delay) * 0.08s + 0.15s);
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    background: rgba(197, 160, 89, 0.12);
    border-color: rgba(197, 160, 89, 0.3);
    transform: translateX(8px);
    box-shadow: 0 4px 20px rgba(197, 160, 89, 0.15);
}

.mobile-nav-link:active {
    transform: translateX(8px) scale(0.98);
    background: rgba(197, 160, 89, 0.2);
}

.mobile-nav-link.active {
    background: linear-gradient(135deg, rgba(197, 160, 89, 0.15), rgba(252, 211, 77, 0.1));
    border-color: rgba(197, 160, 89, 0.4);
    color: #FCD34D;
}

.mobile-nav-link.active .mobile-nav-icon {
    color: #FCD34D;
}

/* Navigation Icon */
.mobile-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(197, 160, 89, 0.1);
    border-radius: 12px;
    color: rgba(197, 160, 89, 0.8);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.mobile-nav-icon i,
.mobile-nav-icon svg {
    width: 20px;
    height: 20px;
}

.mobile-nav-link:hover .mobile-nav-icon {
    background: rgba(197, 160, 89, 0.2);
    color: #FCD34D;
    transform: scale(1.1);
}

/* Navigation Text */
.mobile-nav-text {
    flex: 1;
}

/* Navigation Arrow */
.mobile-nav-arrow {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    color: rgba(197, 160, 89, 0.6);
    font-size: var(--text-xl);
}

.mobile-nav-link:hover .mobile-nav-arrow {
    opacity: 1;
    transform: translateX(0);
    color: #FCD34D;
}

/* =========================================
   MOBILE DONATE BUTTON
   ========================================= */

.mobile-donate-wrapper {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    
    /* Staggered animation */
    opacity: 0;
    transform: translateY(20px);
}

.mobile-menu.open .mobile-donate-wrapper {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: calc(var(--delay) * 0.08s + 0.15s);
}

.mobile-donate-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(135deg, #C5A059 0%, #D4AF37 50%, #FCD34D 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 16px;
    color: #0F172A;
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(197, 160, 89, 0.4),
                0 0 60px rgba(252, 211, 77, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: donateShimmer 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

@keyframes donateShimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.mobile-donate-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.mobile-donate-link:hover::before {
    left: 100%;
}

.mobile-donate-link:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 40px rgba(197, 160, 89, 0.5),
                0 0 80px rgba(252, 211, 77, 0.25);
}

.mobile-donate-link:active {
    transform: translateY(-1px) scale(0.98);
}

.mobile-donate-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-donate-icon i,
.mobile-donate-icon svg {
    width: 22px;
    height: 22px;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.05);
    }
}

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

.mobile-menu-footer {
    margin-top: auto;
    padding-top: var(--space-8);
    text-align: center;
    
    /* Staggered animation */
    opacity: 0;
    transform: translateY(20px);
}

.mobile-menu.open .mobile-menu-footer {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: calc(var(--delay) * 0.08s + 0.15s);
}

.mobile-menu-tagline {
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-serif);
    font-size: var(--text-sm);
    font-style: italic;
    margin-bottom: var(--space-4);
}

.mobile-social-links {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
}

.mobile-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.mobile-social-link i,
.mobile-social-link svg {
    width: 18px;
    height: 18px;
}

.mobile-social-link:hover {
    background: rgba(197, 160, 89, 0.15);
    border-color: rgba(197, 160, 89, 0.4);
    color: #FCD34D;
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(197, 160, 89, 0.2);
}

/* =========================================
   MOBILE MENU TOUCH ENHANCEMENTS
   ========================================= */

/* Touch feedback for nav links */
.mobile-nav-link::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(197, 160, 89, 0.1);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.mobile-nav-link:active::after {
    opacity: 1;
}

/* Pull indicator for swipe to close */
.mobile-menu::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease 0.4s;
}

.mobile-menu.open::before {
    opacity: 1;
}

/* Ensure hamburger is above menu */
.hamburger-btn {
    z-index: calc(var(--z-modal) + 10);
}

/* Smooth appearance when transitioning from closed to open */
.mobile-menu .mobile-nav-link,
.mobile-menu .mobile-donate-wrapper,
.mobile-menu .mobile-menu-footer {
    will-change: transform, opacity;
}

/* Reset animation when menu closes */
.mobile-menu:not(.open) .mobile-nav-link,
.mobile-menu:not(.open) .mobile-donate-wrapper,
.mobile-menu:not(.open) .mobile-menu-footer {
    opacity: 0;
    transform: translateX(-30px);
    transition: none;
}

/* Add backdrop blur for modern browsers on menu content */
@supports (backdrop-filter: blur(20px)) {
    .mobile-menu {
        background: linear-gradient(160deg, rgba(10, 22, 40, 0.97) 0%, rgba(15, 23, 42, 0.97) 40%, rgba(30, 58, 138, 0.97) 100%);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
    }
}

/* =========================================
   MOBILE TYPOGRAPHY
   ========================================= */

@media (max-width: 767px) {
    /* Scale down headings for mobile */
    h1 { font-size: var(--text-4xl); }
    h2 { font-size: var(--text-3xl); }
    h3 { font-size: var(--text-2xl); }
    h4 { font-size: var(--text-xl); }
    h5 { font-size: var(--text-lg); }
    h6 { font-size: var(--text-base); }

    /* Increase line height for better readability */
    p {
        line-height: 1.7;
    }

    /* Larger base font size for better readability */
    body {
        font-size: 1.0625rem; /* 17px - iOS default */
    }
}

/* =========================================
   MOBILE SPACING
   ========================================= */

@media (max-width: 767px) {
    /* Reduce padding on mobile */
    .container {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    /* Reduce section padding */
    section {
        padding-top: var(--space-12);
        padding-bottom: var(--space-12);
    }

    /* Tighter grid gaps */
    .grid {
        gap: var(--space-6);
    }
}

/* =========================================
   MOBILE CARDS & COMPONENTS
   ========================================= */

@media (max-width: 767px) {
    /* Cards take full width on mobile */
    .book-card {
        padding: var(--space-6);
    }

    .card {
        border-radius: var(--radius-lg);
    }

    /* Simplify card hover effects on mobile */
    .card:active {
        transform: scale(0.98);
    }

    .card:hover {
        transform: none;
    }

    /* Better book cover sizing */
    .book-cover {
        height: 240px;
        margin-bottom: var(--space-4);
    }

    .book-cover-inner {
        width: 160px;
        height: 215px;
    }

    .book-detail-shell {
        grid-template-columns: 1fr;
        padding: var(--space-6);
        gap: var(--space-6);
    }

    .book-detail-cover-card {
        padding: var(--space-4);
    }

    .book-detail-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .book-detail-cover img {
        max-width: 260px;
    }

    /* Enhanced Product Page Mobile Styles */
    .product-hero {
        padding: var(--space-4) var(--space-3);
    }

    .product-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
        padding: 0 var(--space-3);
    }

    .product-breadcrumb {
        font-size: var(--text-xs);
        margin-bottom: var(--space-4);
    }

    .book-3d-container {
        min-height: 320px;
    }

    .book-display {
        width: 200px;
        height: 280px;
    }

    .product-badge {
        font-size: 0.625rem;
        padding: var(--space-1) var(--space-2);
    }

    .product-title {
        font-size: var(--text-2xl);
        line-height: 1.2;
    }

    .product-subtitle {
        font-size: var(--text-base);
    }

    .product-price-section {
        flex-direction: column;
        gap: var(--space-2);
        align-items: flex-start;
        padding: var(--space-4);
    }

    .product-price {
        font-size: var(--text-3xl);
    }

    .product-blurb {
        font-size: var(--text-base);
        padding-left: var(--space-3);
    }

    .product-tabs-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .product-tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .product-tab-btn {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-xs);
        white-space: nowrap;
    }

    .product-details-list {
        grid-template-columns: 1fr;
    }

    /* Premium Action Section - Mobile */
    .product-action-section {
        position: relative;
        top: 0;
        padding: var(--space-4);
        margin-top: var(--space-4);
        gap: var(--space-3);
        border-radius: var(--radius-xl);
    }

    /* Price Row - Mobile */
    .action-price-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding-bottom: var(--space-3);
    }

    .action-price-value {
        font-size: 2rem;
    }

    .action-stock {
        font-size: 0.7rem;
        padding: var(--space-1) var(--space-2);
    }

    /* Cart Row - Mobile: Keep horizontal but tighter */
    .action-cart-row {
        flex-direction: row;
        gap: var(--space-2);
    }

    /* Quantity Selector - Mobile */
    .quantity-selector-premium {
        padding: 3px;
        flex-shrink: 0;
    }

    .qty-btn {
        width: 38px;
        height: 38px;
    }

    .qty-btn svg {
        width: 14px;
        height: 14px;
    }

    .qty-display {
        min-width: 36px;
    }

    .qty-value {
        width: 36px;
        height: 38px;
        font-size: var(--text-base);
    }

    /* Add to Cart Button - Mobile */
    .add-cart-btn-premium {
        flex: 1;
        min-height: 44px;
        padding: 0 var(--space-3) 0 var(--space-4);
    }

    .cart-btn-content span {
        font-size: 0.7rem;
        letter-spacing: 0.05em;
    }

    .cart-btn-content svg {
        width: 16px;
        height: 16px;
    }

    .cart-btn-price {
        padding: var(--space-1) var(--space-2);
    }

    .cart-btn-price-value {
        font-size: var(--text-sm);
    }

    /* Quick Actions - Mobile: Keep text visible but smaller */
    .quick-actions-row {
        gap: var(--space-1);
    }

    .quick-action {
        padding: var(--space-2);
        font-size: 0.65rem;
        gap: 4px;
    }

    .quick-action svg {
        width: 14px;
        height: 14px;
    }

    /* Trust Strip - Mobile: Horizontal scroll if needed */
    .trust-strip {
        flex-wrap: nowrap;
        gap: var(--space-2);
        padding: var(--space-2) var(--space-3);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .trust-strip::-webkit-scrollbar {
        display: none;
    }

    .trust-divider {
        display: block;
        flex-shrink: 0;
    }

    .trust-item {
        font-size: 0.65rem;
        flex-shrink: 0;
    }

    .trust-item svg {
        width: 12px;
        height: 12px;
    }

    .recommendations-section {
        padding: var(--space-10) var(--space-4);
    }

    .recommendations-header h2 {
        font-size: var(--text-2xl);
    }

    .recommendations-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .recommendation-card-image {
        height: 160px;
    }

    /* Image zoom modal mobile */
    .image-zoom-content {
        max-width: 95%;
        max-height: 95%;
    }

    .image-zoom-close {
        top: -10px;
        right: -10px;
        width: 40px;
        height: 40px;
    }

    /* Share modal mobile */
    .share-modal-content {
        width: 95%;
        max-width: none;
        padding: var(--space-6);
    }

    .share-options {
        gap: var(--space-3);
    }

    .share-option {
        width: 48px;
        height: 48px;
    }
}

/* =========================================
   MOBILE FOOTER
   ========================================= */

@media (max-width: 767px) {
    .footer {
        padding: var(--space-12) 0 var(--space-8);
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-8);
        margin-bottom: var(--space-8);
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: var(--space-3);
    }

    .social-links {
        justify-content: center;
    }
}

/* =========================================
   MOBILE HERO SECTION
   ========================================= */

@media (max-width: 767px) {
    /* Adjust hero height for mobile */
    header.hero {
        min-height: 100vh;
        min-height: 100svh; /* Use small viewport height on mobile */
    }

    /* Hero typography */
    .hero h1 {
        font-size: clamp(2.5rem, 10vw, 4rem);
        line-height: 1.1;
    }

    .hero h2 {
        font-size: var(--text-xl);
    }

    .hero p {
        font-size: var(--text-base);
    }

    /* Stack hero buttons vertically */
    .hero-buttons {
        flex-direction: column;
        width: 100%;
        gap: var(--space-3);
    }

    .hero-buttons button {
        width: 100%;
    }
}

/* =========================================
   MOBILE GESTURES & INTERACTIONS
   ========================================= */

/* Swipe indicator for mobile */
.swipe-indicator {
    display: block;
    text-align: center;
    padding: var(--space-4);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

@media (min-width: 768px) {
    .swipe-indicator {
        display: none;
    }
}

/* Pull-to-refresh indicator */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    padding: var(--space-4);
    background: var(--color-gold-primary);
    color: var(--color-navy-dark);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 700;
    z-index: var(--z-fixed);
    transition: transform var(--transition-base);
}

.ptr-indicator.visible {
    transform: translateX(-50%) translateY(0);
}

/* Touch feedback overlay */
.touch-feedback {
    position: relative;
}

.touch-feedback::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.05);
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.touch-feedback:active::after {
    opacity: 1;
}

/* =========================================
   MOBILE SCROLL ENHANCEMENTS
   ========================================= */

@media (max-width: 767px) {
    /* Snap scrolling for sections */
    .scroll-snap-container {
        scroll-snap-type: y mandatory;
        overflow-y: scroll;
        height: 100vh;
    }

    .scroll-snap-section {
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }

    /* Hide scrollbar on mobile for cleaner look */
    .hide-scrollbar {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .hide-scrollbar::-webkit-scrollbar {
        display: none;
    }
}

/* =========================================
   MOBILE FORMS
   ========================================= */

@media (max-width: 767px) {
    /* Larger form inputs for mobile */
    input,
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: var(--space-3) var(--space-4);
        min-height: 48px;
    }

    /* Newsletter form stack vertically */
    .newsletter-form {
        flex-direction: column;
    }

    .newsletter-input {
        border-radius: var(--radius-base);
        margin-bottom: var(--space-2);
    }

    .newsletter-btn {
        width: 100%;
        border-radius: var(--radius-base);
        min-height: 48px;
    }
}

/* =========================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ========================================= */

@media (max-width: 767px) {
    /* Reduce animation complexity on mobile */
    .book-card:hover {
        transform: none;
    }

    /* Disable parallax on mobile for performance */
    .parallax {
        transform: none !important;
    }

    /* Simpler shadows on mobile */
    .shadow-complex {
        box-shadow: var(--shadow-md);
    }

    /* Disable gold gradient animation on mobile - keep text static */
    .text-gold-gradient {
        animation: none !important;
        background-position: center !important;
    }
}

/* =========================================
   LANDSCAPE MODE (MOBILE)
   ========================================= */

@media (max-width: 767px) and (orientation: landscape) {
    /* Reduce vertical padding in landscape */
    section {
        padding-top: var(--space-8);
        padding-bottom: var(--space-8);
    }

    /* Adjust hero for landscape */
    header.hero {
        min-height: auto;
        padding: var(--space-16) 0;
    }

    .hero h1 {
        font-size: var(--text-3xl);
    }
}

/* =========================================
   SAFE AREAS (iOS NOTCH)
   ========================================= */

@supports (padding: max(0px)) {
    .navbar-wrapper {
        padding-left: max(var(--space-6), env(safe-area-inset-left));
        padding-right: max(var(--space-6), env(safe-area-inset-right));
    }

    .footer-wrapper {
        padding-left: max(var(--space-6), env(safe-area-inset-left));
        padding-right: max(var(--space-6), env(safe-area-inset-right));
        padding-bottom: max(var(--space-10), env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* =========================================
   MOBILE RECORDINGS & VIDEOS
   ========================================= */

@media (max-width: 767px) {
    /* Audio player mobile optimizations */
    .audio-track {
        padding: var(--space-3);
    }

    .audio-track-controls {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    /* Video aspect ratio */
    .video-container {
        aspect-ratio: 16 / 9;
        width: 100%;
    }

    /* Hide secondary info on mobile */
    .track-secondary-info {
        display: none;
    }
}

/* =========================================
   MOBILE BOTTOM NAVIGATION
   ========================================= */

@media (max-width: 767px) {
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 58, 138, 0.98) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: var(--space-2) 0;
        padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3), 0 0 40px rgba(197, 160, 89, 0.1);
        border-top: 1px solid rgba(197, 160, 89, 0.2);
        z-index: var(--z-sticky);
        transform: translateY(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .bottom-nav.hidden {
        transform: translateY(100%);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        padding: var(--space-2) var(--space-1);
        color: rgba(255, 255, 255, 0.6);
        font-size: var(--text-xs);
        text-decoration: none;
        transition: all var(--transition-base);
        min-height: 56px;
        position: relative;
        border-radius: var(--radius-base);
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-item:active {
        transform: scale(0.95);
        background: rgba(197, 160, 89, 0.1);
    }

    .bottom-nav-item.active {
        color: var(--color-gold-primary);
    }

    .bottom-nav-item.active .bottom-nav-icon {
        transform: scale(1.1);
    }

    .bottom-nav-icon {
        width: 22px;
        height: 22px;
        margin-bottom: var(--space-1);
        transition: transform var(--transition-base);
    }

    .bottom-nav-label {
        font-size: 0.625rem;
        font-weight: 600;
        letter-spacing: 0.05em;
        transition: color var(--transition-base);
    }

    .bottom-nav-donate {
        color: var(--color-gold-primary);
    }

    .bottom-nav-donate.active {
        color: var(--color-gold-light);
    }
    
    /* Record button - special styling */
    .bottom-nav-item[data-nav-link="record"] {
        color: #ef4444;
        position: relative;
    }
    
    .bottom-nav-item[data-nav-link="record"]::before {
        content: '';
        position: absolute;
        top: 4px;
        right: 50%;
        transform: translateX(50%);
        width: 6px;
        height: 6px;
        background: #ef4444;
        border-radius: 50%;
        opacity: 0;
        animation: recordPulse 1.5s ease-in-out infinite;
    }
    
    .bottom-nav-item[data-nav-link="record"].active {
        color: #f87171;
    }
    
    .bottom-nav-item[data-nav-link="record"].active::before {
        opacity: 1;
    }
    
    @keyframes recordPulse {
        0%, 100% { opacity: 0.4; transform: translateX(50%) scale(1); }
        50% { opacity: 1; transform: translateX(50%) scale(1.3); }
    }

    .bottom-nav-cart {
        position: relative;
    }

    .bottom-nav-badge {
        position: absolute;
        top: 4px;
        right: 8px;
        background: var(--color-gold-primary);
        color: var(--color-navy-dark);
        font-size: 0.625rem;
        font-weight: 800;
        min-width: 18px;
        height: 18px;
        border-radius: 9px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        box-shadow: 0 2px 8px rgba(197, 160, 89, 0.5);
        transform: scale(0);
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .bottom-nav-badge:not(.hidden) {
        transform: scale(1);
    }

    /* Add padding to body to prevent content from being hidden behind bottom nav */
    body {
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}

/* =========================================
   TABLET OPTIMIZATIONS
   ========================================= */

@media (min-width: 768px) and (max-width: 1023px) {
    /* Two-column grid for tablets */
    .grid-cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Adjust container padding for tablets */
    .container {
        padding-left: var(--space-8);
        padding-right: var(--space-8);
    }

    /* Tablet typography */
    h1 { font-size: var(--text-5xl); }

    /* Premium Action Section - Tablet */
    .product-action-section {
        position: relative;
        top: 0;
        padding: var(--space-5);
    }

    .action-price-value {
        font-size: 2.5rem;
    }

    .action-cart-row {
        flex-direction: row;
        gap: var(--space-3);
    }

    .quantity-selector-premium {
        width: auto;
    }

    .qty-btn {
        width: 42px;
        height: 42px;
    }

    .qty-value {
        font-size: var(--text-lg);
    }

    .add-cart-btn-premium {
        min-height: 50px;
    }

    .cart-btn-content span {
        font-size: var(--text-sm);
    }

    .quick-action span {
        display: inline;
    }

    .quick-action {
        font-size: var(--text-sm);
        padding: var(--space-3);
    }

    .trust-strip {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow: visible;
    }

    .trust-divider {
        display: block;
    }

    .trust-item {
        font-size: 0.75rem;
    }
}

/* =========================================
   HIGH DPI DISPLAYS
   ========================================= */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Crisper borders on retina displays */
    .border-thin {
        border-width: 0.5px;
    }
}

/* =========================================
   ADDITIONAL MOBILE OPTIMIZATIONS
   ========================================= */

/* Prevent horizontal scrolling on mobile */
@media (max-width: 767px) {
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Ensure containers don't overflow */
    * {
        max-width: 100%;
    }

    /* Fix potential overflow issues with pre/code */
    pre, code {
        max-width: 100%;
        overflow-x: auto;
        word-wrap: break-word;
    }

    /* Better image handling on mobile */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Optimize video embeds for mobile */
    iframe,
    video {
        max-width: 100%;
        height: auto;
    }

    /* Full-width buttons on mobile for better UX */
    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Reduce animation duration on mobile for better performance */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }

    /* Better table handling on mobile */
    table {
        width: 100%;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Stack flex containers on mobile by default */
    .flex-row-mobile-stack {
        flex-direction: column !important;
    }

    /* Larger clickable areas for links */
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Better spacing for text content on mobile */
    p + p {
        margin-top: var(--space-4);
    }

    /* Optimize search inputs for mobile */
    input[type="search"] {
        -webkit-appearance: none;
        appearance: none;
        border-radius: var(--radius-full);
    }

    /* Remove webkit search cancel button */
    input[type="search"]::-webkit-search-cancel-button {
        -webkit-appearance: none;
    }

    /* Better modal handling on mobile */
    .modal,
    .audio-modal {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    /* Optimize audio player for mobile */
    .audio-modal-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .audio-modal-content {
        max-width: 100vw;
        margin: 0;
        border-radius: 0;
    }

    /* Better cart handling on mobile */
    .floating-cart-sidebar {
        width: 100vw !important;
        max-width: 100vw;
        right: 0 !important;
    }

    /* Optimize donation builder for mobile */
    .donation-builder {
        padding: var(--space-4);
    }

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

    .donation-panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .donation-trust,
    .donation-highlights {
        grid-template-columns: 1fr;
    }

    .donation-actions {
        flex-direction: column;
    }

    .donation-actions .btn {
        width: 100%;
    }

    /* Better event cards on mobile */
    .event-card {
        padding: var(--space-4);
    }

    /* Optimize learning resources grid */
    .learning-grid {
        grid-template-columns: 1fr !important;
    }
}

/* =========================================
   MOBILE-SPECIFIC ACCESSIBILITY
   ========================================= */

@media (max-width: 767px) {
    /* Larger focus indicators on mobile */
    *:focus-visible {
        outline: 3px solid var(--color-gold-primary);
        outline-offset: 3px;
    }

    /* Better skip link on mobile */
    .skip-to-main:focus {
        top: var(--space-4);
        left: var(--space-4);
        padding: var(--space-3) var(--space-6);
        font-size: var(--text-lg);
    }
}

/* =========================================
   PREVENT ZOOM ON DOUBLE TAP (iOS)
   ========================================= */

@media (max-width: 767px) {
    a,
    button,
    input,
    select,
    textarea {
        touch-action: manipulation;
    }
}

/* =========================================
   OPTIMIZE FOR SMALL SCREENS (< 375px)
   ========================================= */

@media (max-width: 374px) {
    /* Extra small phones */
    body {
        font-size: 0.9375rem; /* 15px */
    }

    h1 {
        font-size: var(--text-3xl);
    }

    h2 {
        font-size: var(--text-2xl);
    }

    /* Reduce padding on very small screens */
    section {
        padding-left: var(--space-3);
        padding-right: var(--space-3);
    }

    /* Smaller buttons on very small screens */
    .btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
    }

    /* Donation amount grid to single column on very small screens */
    .donation-amount-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile menu adjustments for extra small screens */
    .mobile-menu-content {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .mobile-nav-link {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-base);
    }

    .mobile-nav-icon {
        width: 38px;
        height: 38px;
    }

    .mobile-donate-link {
        padding: var(--space-4) var(--space-5);
        font-size: var(--text-base);
    }

    .hamburger-btn {
        width: 44px;
        height: 44px;
    }

    .hamburger-box {
        width: 20px;
        height: 14px;
    }
}

/* =========================================
   MOBILE MENU LANDSCAPE OPTIMIZATIONS
   ========================================= */

@media (max-width: 767px) and (orientation: landscape) {
    .mobile-menu-content {
        padding-top: calc(60px + var(--space-4));
        padding-bottom: var(--space-4);
    }

    .mobile-nav-links {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }

    .mobile-nav-link {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
    }

    .mobile-nav-icon {
        width: 32px;
        height: 32px;
    }

    .mobile-nav-icon i,
    .mobile-nav-icon svg {
        width: 16px;
        height: 16px;
    }

    .mobile-nav-arrow {
        display: none;
    }

    .mobile-donate-wrapper {
        margin-top: var(--space-3);
        padding-top: var(--space-2);
    }

    .mobile-donate-link {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-sm);
    }

    .mobile-menu-footer {
        padding-top: var(--space-3);
    }

    .mobile-menu-tagline {
        display: none;
    }

    .mobile-social-links {
        gap: var(--space-2);
    }

    .mobile-social-link {
        width: 36px;
        height: 36px;
    }
}

/* =========================================
   LAZY LOADING STYLES
   ========================================= */

.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.lazy-image.loaded {
    opacity: 1;
    animation: none;
    background: none;
}

.lazy-image.error {
    opacity: 0.5;
    background: #f0f0f0;
}

/* =========================================
   PWA INSTALL BUTTON STYLES
   ========================================= */

.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--gradient-gold);
    color: var(--color-navy-dark);
    border: none;
    border-radius: var(--radius-base);
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-gold);
}

.pwa-install-btn-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-gold);
    color: var(--color-navy-dark);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
}

.pwa-install-btn-small:hover {
    transform: scale(1.1);
}

.pwa-install-badge {
    position: absolute;
    top: -20px;
    right: 10px;
}

.pwa-update-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: var(--color-navy-dark);
    color: white;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    z-index: var(--z-modal);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(197, 160, 89, 0.3);
}

.pwa-update-notification.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.pwa-update-btn {
    padding: var(--space-2) var(--space-4);
    background: var(--color-gold-primary);
    color: var(--color-navy-dark);
    border: none;
    border-radius: var(--radius-base);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
}

.pwa-update-btn:hover {
    background: var(--color-gold-light);
    transform: scale(1.05);
}

@media (max-width: 767px) {
    .pwa-update-notification {
        left: var(--space-4);
        right: var(--space-4);
        transform: translateY(100%);
    }

    .pwa-update-notification.show {
        transform: translateY(0);
    }
}
