/* =========================================
   SMALL SCREEN OPTIMIZATIONS (iPhone 13 and similar - 390px)
   ========================================= */

@media (max-width: 400px) {

    /* Navbar - Reduce all elements for better fit */
    .navbar-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
        gap: 6px !important;
    }

    .logo,
    .navbar-logo {
        height: 24px !important;
        max-width: 120px !important;
    }

    .brand-text {
        font-size: 0.85rem !important;
    }

    /* Auth buttons - Much smaller */
    #authButtons .btn-outline-new,
    #authButtons .btn-primary-new {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.75rem !important;
        gap: 0.25rem !important;
    }

    #authButtons {
        gap: 6px !important;
    }

    /* User menu button */
    #userMenuBtn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
    }

    /* Hamburger menu - Smaller and more visible */
    .mobile-menu-toggle {
        padding: 4px 6px !important;
        flex-shrink: 0 !important;
    }

    .mobile-menu-toggle span {
        width: 18px !important;
        height: 2px !important;
        margin: 3px 0 !important;
    }

    /* Hero section - Reduce button sizes */
    .btn-primary-new,
    .btn-outline-new {
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
    }

    .hero-buttons-new {
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }

    .hero-buttons-new .btn-primary-new,
    .hero-buttons-new .btn-outline-new {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Hero title */
    .hero-title-new {
        font-size: 1.8rem !important;
        line-height: 1.2 !important;
    }

    .hero-subtitle-new {
        font-size: 0.95rem !important;
    }

    /* Stats in hero */
    .hero-stats-new {
        gap: 1rem !important;
    }

    .stat-number-new {
        font-size: 1.5rem !important;
    }

    .stat-label-new {
        font-size: 0.75rem !important;
    }

    /* Calendar preview */
    .calendar-preview {
        max-width: 100% !important;
        padding: 0.5rem !important;
    }

    /* General font size reduction */
    html {
        font-size: 11px !important;
    }

    /* Nav right elements */
    .nav-right {
        gap: 6px !important;
    }

    /* Notification icon */
    #notificationBtn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
    }

    /* Reduce padding on containers */
    .container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Modal adjustments */
    .modal-content {
        margin: 10px !important;
        padding: 15px !important;
    }

    /* Filter buttons */
    .btn-filter {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    /* Coach cards - Even more compact */
    #topCoaches .coach-card,
    #coachesGrid .coach-card {
        min-height: 140px !important;
    }

    #topCoaches .coach-avatar-img,
    #coachesGrid .coach-avatar-img {
        width: 40px !important;
        height: 40px !important;
    }

    #topCoaches .coach-name-new,
    #coachesGrid .coach-name-new {
        font-size: 0.75rem !important;
    }

    #topCoaches .elo-value,
    #coachesGrid .elo-value {
        font-size: 0.75rem !important;
    }

    #topCoaches .price-value,
    #coachesGrid .price-value {
        font-size: 0.7rem !important;
    }

    #topCoaches .btn-reserve-coach,
    #coachesGrid .btn-reserve-coach {
        padding: 3px 0 !important;
        font-size: 0.6rem !important;
    }

    /* Rank badges */
    #topCoaches .coach-rank-badge,
    #coachesGrid .coach-rank-badge {
        width: 25px !important;
        height: 25px !important;
        left: -4px !important;
        top: -4px !important;
    }

    #topCoaches .coach-rank-badge i,
    #coachesGrid .coach-rank-badge i {
        font-size: 0.55rem !important;
    }

    #topCoaches .coach-rank-badge span,
    #coachesGrid .coach-rank-badge span {
        font-size: 0.45rem !important;
    }

    /* NEW badge */
    #topCoaches .new-coach-badge,
    #coachesGrid .new-coach-badge {
        padding: 2px 6px !important;
        font-size: 0.55rem !important;
    }

    /* Footer adjustments */
    .footer-col {
        padding: 6px !important;
        font-size: 0.6rem !important;
    }

    .footer-col h3 {
        font-size: 0.7rem !important;
    }

    /* Chatbot */
    .chatbot-container {
        width: 90vw !important;
        right: 5vw !important;
        bottom: 70px !important;
    }

    #chatbotToggle {
        width: 45px !important;
        height: 45px !important;
        bottom: 15px !important;
        right: 15px !important;
    }
}

/* =========================================
   ULTRA-SMALL SCREEN (iPhone SE, 354px and below)
   ========================================= */

@media (max-width: 360px) {

    /* Force smallest possible base font */
    html {
        font-size: 10px !important;
    }

    /* Navbar - Ultra compact */
    .navbar-container {
        padding: 4px 6px !important;
        gap: 4px !important;
        min-height: 50px !important;
    }

    /* Logo - Minimum size */
    .logo,
    .navbar-logo {
        height: 20px !important;
        max-width: 80px !important;
    }

    .brand-text {
        font-size: 0.75rem !important;
    }

    /* Hide auth buttons text, keep icons only */
    #authButtons .btn-outline-new span,
    #authButtons .btn-primary-new span {
        display: none !important;
    }

    #authButtons .btn-outline-new,
    #authButtons .btn-primary-new {
        padding: 0.35rem 0.5rem !important;
        min-width: 32px !important;
        font-size: 0.7rem !important;
    }

    #authButtons {
        gap: 4px !important;
    }

    /* User menu - Smallest */
    #userMenuBtn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.75rem !important;
    }

    /* Hamburger - Ultra visible */
    .mobile-menu-toggle {
        padding: 3px 4px !important;
        margin-left: 4px !important;
    }

    .mobile-menu-toggle span {
        width: 16px !important;
        height: 1.5px !important;
        margin: 2.5px 0 !important;
    }

    /* Nav right - Ensure it never wraps */
    .nav-right {
        gap: 4px !important;
        flex-shrink: 0 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
    }

    /* Hero section - Full vertical stack, minimal padding */
    .hero-content-new {
        padding: 1rem 0.5rem !important;
    }

    .hero-buttons-new {
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .hero-buttons-new .btn-primary-new,
    .hero-buttons-new .btn-outline-new {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.6rem 0.8rem !important;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
    }

    /* Hero title - Smaller */
    .hero-title-new {
        font-size: 1.5rem !important;
        line-height: 1.1 !important;
    }

    .hero-subtitle-new {
        font-size: 0.85rem !important;
        line-height: 1.3 !important;
    }

    /* Stats - Stack vertically on ultra-small */
    .hero-stats-new {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: flex-start !important;
    }

    .stat-item-new {
        width: 100% !important;
    }

    .stat-number-new {
        font-size: 1.3rem !important;
    }

    .stat-label-new {
        font-size: 0.7rem !important;
    }

    /* Reduce all containers */
    .container,
    .section,
    .section-new {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    /* Notification icon */
    #notificationBtn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.75rem !important;
    }

    /* Coach cards - Ultra compact */
    #topCoaches .coach-card,
    #coachesGrid .coach-card {
        min-height: 120px !important;
        padding: 0 !important;
    }

    #topCoaches .coach-avatar-img,
    #coachesGrid .coach-avatar-img {
        width: 35px !important;
        height: 35px !important;
    }

    #topCoaches .coach-name-new,
    #coachesGrid .coach-name-new {
        font-size: 0.7rem !important;
    }

    #topCoaches .elo-value,
    #coachesGrid .elo-value {
        font-size: 0.7rem !important;
    }

    #topCoaches .price-value,
    #coachesGrid .price-value {
        font-size: 0.65rem !important;
    }

    #topCoaches .btn-reserve-coach,
    #coachesGrid .btn-reserve-coach {
        padding: 2px 0 !important;
        font-size: 0.55rem !important;
    }

    /* Rank badges - Smaller */
    #topCoaches .coach-rank-badge,
    #coachesGrid .coach-rank-badge {
        width: 22px !important;
        height: 22px !important;
    }

    #topCoaches .coach-rank-badge i,
    #coachesGrid .coach-rank-badge i {
        font-size: 0.5rem !important;
    }

    #topCoaches .coach-rank-badge span,
    #coachesGrid .coach-rank-badge span {
        font-size: 0.4rem !important;
    }

    /* NEW badge */
    #topCoaches .new-coach-badge,
    #coachesGrid .new-coach-badge {
        padding: 1px 4px !important;
        font-size: 0.5rem !important;
    }

    /* Chatbot */
    .chatbot-container {
        width: 95vw !important;
        right: 2.5vw !important;
        bottom: 60px !important;
        max-height: 70vh !important;
    }

    #chatbotToggle {
        width: 40px !important;
        height: 40px !important;
        bottom: 12px !important;
        right: 12px !important;
    }

    /* Modal full screen */
    .modal-content {
        width: 100vw !important;
        height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        max-height: 100vh !important;
    }

    /* Footer - Ultra compact */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .footer-col {
        padding: 4px !important;
        font-size: 0.55rem !important;
    }

    .footer-col h3 {
        font-size: 0.65rem !important;
        margin-bottom: 4px !important;
    }

    .footer-links li,
    .footer-links a {
        font-size: 0.5rem !important;
    }
}