/* =================================================
   MOBILE RESPONSIVE FIXES FOR IPHONE 14 PRO MAX
   ================================================= */

/* iPhone 14 Pro Max: 430px x 932px (viewport: 390px x 844px @3x) */

/* ===== GLOBAL MOBILE STYLES ===== */
@media (max-width: 480px) {
    body {
        font-size: 14px;
        padding-bottom: 80px !important;
    }

    .container {
        padding: 0 16px;
    }
}

/* ===== HEADER MOBILE FIXES ===== */
@media (max-width: 768px) {

    /* Top Bar - Hide on mobile */
    .top-bar {
        display: none !important;
    }

    /* Site Header */
    .site-header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .header-main {
        padding: 8px 0;
    }

    .header-container {
        padding: 0 12px;
        gap: 8px;
    }

    /* Logo */
    .header-logo img {
        height: 32px;
    }

    .header-logo .logo-text {
        display: none;
    }

    /* Search box - hide on mobile */
    .search-box {
        display: none !important;
    }

    /* Secondary nav - hide on mobile */
    .header-secondary {
        display: none !important;
    }

    /* Mobile Menu Toggle - FORCE SHOW */
    .mobile-menu-toggle {
        display: flex !important;
        width: 40px;
        height: 40px;
        background: #f1f5f9 !important;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        order: -1;
    }

    .mobile-menu-toggle svg {
        width: 22px;
        height: 22px;
        color: #1e293b !important;
    }

    /* Header Actions */
    .header-actions {
        gap: 6px;
    }

    /* Hide text in buttons, keep icons only */
    .btn-auth span,
    .btn-cart span {
        display: none !important;
    }

    .btn-auth,
    .btn-cart {
        padding: 10px !important;
        min-width: 40px;
        height: 40px;
    }

    /* Theme toggle smaller */
    .btn-theme-toggle {
        width: 40px;
        height: 40px;
    }

    .btn-theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    /* User avatar button */
    .btn-user-avatar {
        padding: 4px;
    }

    .btn-user-avatar .user-info {
        display: none !important;
    }

    .btn-user-avatar .user-avatar-img {
        width: 32px;
        height: 32px;
    }

    /* Add padding to main for fixed header */
    main {
        padding-top: 60px !important;
    }

    /* Dark mode mobile menu */
    body.dark-mode .mobile-menu-toggle {
        background: #334155 !important;
    }

    body.dark-mode .mobile-menu-toggle svg {
        color: #f1f5f9 !important;
    }
}

/* ===== SIDEBAR MOBILE - HIDDEN BY DEFAULT ===== */
@media (max-width: 768px) {
    .sidebar-overlay {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        display: none !important;
        opacity: 0;
        visibility: hidden;
    }

    .sidebar-overlay.active {
        display: block !important;
        opacity: 1;
        visibility: visible;
        z-index: 10000 !important;
    }

    .mobile-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -320px !important;
        width: 280px !important;
        height: 100vh !important;
        background: #ffffff !important;
        z-index: 10001 !important;
        transition: left 0.3s ease;
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    .mobile-sidebar.active {
        left: 0 !important;
    }

    .sidebar-header {
        padding: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #e5e7eb;
        background: #ffffff;
    }

    .sidebar-logo {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sidebar-logo img {
        height: 32px;
    }

    .sidebar-logo span {
        color: #1f2937;
        font-size: 16px;
        font-weight: 700;
    }

    .sidebar-close {
        width: 36px;
        height: 36px;
        background: #f3f4f6;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-close:hover {
        background: #e5e7eb;
    }

    .sidebar-close svg {
        width: 20px;
        height: 20px;
        color: #374151;
    }

    .sidebar-nav {
        padding: 16px 0;
    }

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 20px;
        color: #4b5563;
        text-decoration: none;
        font-size: 15px;
        font-weight: 500;
        transition: all 0.2s;
    }

    .sidebar-nav a:hover,
    .sidebar-nav a:active {
        background: #f3f4f6;
        color: #1f2937;
    }

    .sidebar-nav a svg {
        width: 20px;
        height: 20px;
        color: #6b7280;
    }

    .sidebar-nav a:hover svg {
        color: #2563eb;
    }

    /* User link in sidebar */
    .sidebar-user-link {
        margin: 8px 12px 16px;
        padding: 12px !important;
        background: rgba(16, 185, 129, 0.1) !important;
        border-radius: 12px;
    }

    .sidebar-user-link .user-name {
        color: #1e293b;
    }

    .sidebar-user-link .user-email {
        color: #64748b;
    }

    /* Dark Mode Sidebar */
    body.dark-mode .mobile-sidebar {
        background: linear-gradient(180deg, #1e3a5f 0%, #1a365d 100%) !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    }

    body.dark-mode .sidebar-header {
        background: transparent;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }

    body.dark-mode .sidebar-logo span {
        color: #ffffff;
    }

    body.dark-mode .sidebar-close {
        background: rgba(255, 255, 255, 0.1);
    }

    body.dark-mode .sidebar-close:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    body.dark-mode .sidebar-close svg {
        color: #ffffff;
    }

    body.dark-mode .sidebar-nav a {
        color: rgba(255, 255, 255, 0.9);
    }

    body.dark-mode .sidebar-nav a:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    body.dark-mode .sidebar-nav a svg {
        color: rgba(255, 255, 255, 0.8);
    }

    body.dark-mode .sidebar-nav a:hover svg {
        color: #ffffff;
    }

    body.dark-mode .sidebar-user-link {
        background: rgba(16, 185, 129, 0.2) !important;
    }

    body.dark-mode .sidebar-user-link .user-name {
        color: #ffffff;
    }

    body.dark-mode .sidebar-user-link .user-email {
        color: rgba(255, 255, 255, 0.7);
    }
}

/* ===== FOOTER MOBILE FIXES ===== */
@media (max-width: 768px) {
    footer {
        padding: 40px 0 20px 0;
        margin-bottom: 70px !important;
    }

    .footer-top {
        flex-direction: column;
        gap: 32px;
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-brand .logo {
        justify-content: center;
    }

    .footer-brand p {
        font-size: 14px;
    }

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

    .footer-col {
        text-align: center;
    }

    .footer-col h4 {
        margin-bottom: 12px;
        font-size: 16px;
    }

    .footer-col ul li {
        margin-bottom: 8px;
    }

    .footer-col a {
        font-size: 14px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        font-size: 12px;
        padding-top: 24px;
    }
}

/* ===== MOBILE BOTTOM NAV ===== */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: grid !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        padding: 8px 0;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        z-index: 9999;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        grid-template-columns: repeat(5, 1fr);
    }

    body.dark-mode .mobile-bottom-nav {
        background: #1e293b;
        border-top-color: #334155;
    }
}

/* ===== CONTENT SECTIONS MOBILE ===== */
@media (max-width: 768px) {
    .section {
        padding: 40px 0;
    }

    .section-header {
        margin-bottom: 32px;
    }

    .section-title {
        font-size: 24px;
    }

    .section-desc {
        font-size: 14px;
    }

    /* Hero Section */
    .hero {
        padding: 40px 0;
    }

    .hero-inner {
        flex-direction: column;
        gap: 32px;
    }

    .hero-title {
        font-size: 28px;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 15px;
    }

    .hero-cta {
        flex-direction: column;
        gap: 12px;
    }

    .hero-cta .btn {
        width: 100%;
    }

    /* Form Card */
    .form-card {
        padding: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Products Grid */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Stats Section */
    .stats-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* ===== FLOATING BUTTONS MOBILE ===== */
@media (max-width: 768px) {
    .floating-contact-buttons {
        bottom: 90px;
        right: 16px;
        gap: 10px;
    }

    .floating-contact-btn {
        width: 48px;
        height: 48px;
        min-width: 48px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }

    .floating-btn-label {
        display: none !important;
    }

    .floating-contact-btn:hover {
        padding: 0;
        min-width: 48px;
    }

    .floating-contact-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* ===== iPHONE 14 PRO MAX SPECIFIC ===== */
@media (max-width: 430px) {
    .hero-title {
        font-size: 26px;
    }

    .section-title {
        font-size: 22px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* ===== SAFE AREA INSETS FOR NOTCH ===== */
@supports (padding: max(0px)) {
    .mobile-bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
    }
}

/* ===== FORCE SIDEBAR NAV VISIBILITY ===== */
@media (max-width: 768px) {
    .sidebar-nav {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .sidebar-nav a {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        font-size: 15px !important;
        padding: 14px 20px !important;
    }

    .sidebar-nav a svg {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 22px !important;
        height: 22px !important;
    }
}