/* Mobile CSS Reset */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Base Mobile Styles */
@media screen and (max-width: 768px) {
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Mobile Header */
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #fff;
        display: flex;
        align-items: center;
        padding: 0 1rem;
        z-index: 1000;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    /* Menu Button Container */
    .mobile-header > div:first-child {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Menu Button */
    .mobile-menu-btn {
        width: 44px;
        height: 44px;
        padding: 10px;
        border: none;
        background: none;
        color: var(--color-primary);
        font-size: 24px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Logo Container */
    .mobile-header > div:last-child {
        flex: 1;
        text-align: center;
    }

    /* Logo */
    .mobile-logo {
        display: inline-flex;
        align-items: center;
        text-decoration: none;
        color: inherit;
    }

    .mobile-logo img {
        height: 40px;
        width: auto;
    }

    /* Navigation Overlay */
    .mobile-nav-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-nav-overlay.active {
        opacity: 1;
    }

    /* Navigation Menu */
    .mobile-nav {
        position: fixed;
        top: 60px;
        left: -100%;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        background: #fff;
        z-index: 999;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 1rem;
    }

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

    /* Hide desktop navigation */
    .base-navbar {
        display: none !important;
    }

    /* Mobile Navigation Sections */
    .mobile-nav-section {
        margin-bottom: 1.5rem;
        border-bottom: 1px solid var(--color-gray-200);
        padding-bottom: 1rem;
    }

    .mobile-nav-section:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .mobile-nav-title {
        font-weight: 600;
        color: var(--color-text-dark);
        margin-bottom: 0.75rem;
        font-size: 1.1rem;
    }

    /* Navigation Links */
    .mobile-nav-link {
        display: -webkit-flex;
        display: flex;
        -webkit-align-items: center;
        align-items: center;
        padding: 0.75rem;
        color: var(--color-text-dark);
        text-decoration: none;
        font-weight: 500;
        border-radius: 8px;
        margin-bottom: 0.5rem;
        -webkit-transition: all 0.2s ease;
        transition: all 0.2s ease;
    }

    .mobile-nav-link i {
        margin-right: 0.75rem;
        color: var(--color-primary);
        font-size: 1.2rem;
        width: 1.5rem;
        text-align: center;
    }

    .mobile-nav-link:hover,
    .mobile-nav-link:active {
        background-color: var(--color-gray-50);
        color: var(--color-primary);
    }

    /* CTA Button */
    .mobile-cta-button {
        display: -webkit-flex;
        display: flex;
        -webkit-align-items: center;
        align-items: center;
        -webkit-justify-content: center;
        justify-content: center;
        width: 100%;
        padding: 0.75rem;
        background-color: var(--color-primary);
        color: white !important;
        text-decoration: none;
        border-radius: 8px;
        font-weight: 500;
        margin-top: 1rem;
        -webkit-transition: background-color 0.3s ease;
        transition: background-color 0.3s ease;
    }

    .mobile-cta-button:hover {
        background-color: var(--color-primary-dark);
    }

    /* Main Content Area */
    .mobile-main-content {
        padding-top: 60px;
        min-height: calc(100vh - 120px);
        -webkit-overflow-scrolling: touch;
    }

    /* Adjust base premium popup for mobile */
    .base-premium-popup-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }

    .base-premium-popup-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .base-premium-popup-buttons button {
        width: 100%;
    }

    /* Adjust recipe cards for mobile */
    .recipe-card {
        width: 100%;
    }

    .recipe-row {
        grid-auto-columns: 85%;
    }

    /* Adjust form elements for mobile */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.75rem;
    }

    button {
        padding: 0.75rem 1rem;
        width: 100%;
    }

    /* Adjust headings and text for mobile */
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    /* Adjust container padding */
    .container {
        padding: 0 1rem;
    }

    /* Adjust hero section for mobile */
    .hero {
        padding: 1rem 0;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

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

    /* Adjust footer for mobile */
    .base-footer p {
        font-size: 0.9rem;
    }

    /* Touch-friendly adjustments */
    .mobile-nav-link {
        min-height: 44px; /* Minimum touch target size */
        display: flex;
        align-items: center;
    }

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }

    /* Adjust grid layouts for mobile */
    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Adjust spacing for mobile */
    .section {
        margin: 2rem 0;
    }

    /* Adjust tables for mobile */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Adjust images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Base Layout */
    .base-layout {
        width: 100%;
        min-height: 100vh;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }

    /* Mobile Footer */
    .mobile-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--color-white);
        padding: 1rem;
        text-align: center;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        z-index: 997;
    }

    .mobile-footer p {
        margin: 0.5rem 0;
        color: var(--color-text-dark);
    }

    .mobile-footer a {
        color: var(--color-primary);
        text-decoration: none;
        margin: 0 0.5rem;
    }

    .mobile-footer a:hover {
        text-decoration: underline;
    }

    /* Form Elements */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        width: 100%;
        padding: 0.8rem;
        font-size: 16px;
    }

    /* Buttons */
    button,
    .button {
        min-height: 44px;
        padding: 0.8rem 1.2rem;
    }

    /* Grid Layouts */
    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Tables */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Images */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Typography */
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    /* Container */
    .container {
        padding: 0 1rem;
    }

    /* Hero Section */
    .hero {
        padding: 1rem 0;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

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

/* Hide mobile elements on desktop */
@media screen and (min-width: 769px) {
    .mobile-header,
    .mobile-nav,
    .mobile-nav-overlay {
        display: none !important;
    }
}

/* Tablet-specific styles (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .base-navbar-content {
        padding: 0 1rem !important;
    }

    .base-logo {
        transform: scale(0.85) !important;
        transform-origin: left center !important;
    }

    .base-logo img {
        height: 50px !important;
        margin-right: 5px !important;
    }

    .logo-text {
        font-size: 1.4rem !important;
    }

    .base-nav-links {
        margin: 0 0 0 0.5rem !important;
    }

    .base-main-nav {
        gap: 0.25rem !important;
    }

    .base-main-nav a {
        font-size: 0.9rem !important;
        padding: 0.1rem 0.3rem !important;
    }

    .base-user-nav {
        gap: 0.25rem !important;
    }

    .base-user-nav a {
        font-size: 0.9rem !important;
        padding: 0.1rem 0.3rem !important;
    }

    .base-dropdown-toggle {
        font-size: 0.9rem !important;
        padding: 0.1rem 0.3rem !important;
    }

    .base-try-free-button {
        font-size: 0.9rem !important;
        padding: 0.3rem 0.6rem !important;
    }

    .menu-group {
        gap: 0.25rem !important;
    }
}

/* Tablet and Desktop styles (> 768px) */
@media (min-width: 769px) {
    /* Show desktop elements */
    .base-navbar {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        height: 70px !important;
        background-color: var(--color-white) !important;
        box-shadow: 0 2px 4px var(--color-shadow) !important;
    }

    .base-navbar-content {
        display: flex !important;
        flex-direction: row !important;
        padding: 0 2rem !important;
        height: 100% !important;
        width: 100% !important;
        max-width: 1400px !important;
        margin: 0 auto !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .base-logo {
        display: flex !important;
        align-items: center !important;
        text-decoration: none !important;
        color: inherit !important;
    }

    .base-logo img {
        height: 90px !important;
        margin-right: 10px !important;
    }

    .base-nav-links {
        display: flex !important;
        flex-direction: row !important;
        width: auto !important;
        margin: 0 0 0 2rem !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex: 1 !important;
    }

    .base-main-nav {
        display: flex !important;
        flex-direction: row !important;
        width: auto !important;
        text-align: left !important;
        gap: 0.40rem !important;
        align-items: center !important;
        margin: 0 !important;
    }

    .base-user-nav {
        display: flex !important;
        flex-direction: row !important;
        width: auto !important;
        text-align: left !important;
        gap: 0.5rem !important;
        align-items: center !important;
        flex: 0 0 auto !important;
    }

    .menu-group {
        display: flex !important;
        gap: 0.50rem !important;
        margin-left: auto !important;
    }

    .base-try-free-button {
        margin-top: 0 !important;
    }

    .base-dropdown {
        width: auto !important;
        position: relative !important;
    }

    .base-dropdown-menu {
        position: absolute !important;
        box-shadow: 0 2px 10px var(--color-shadow) !important;
        width: auto !important;
        margin-top: 0 !important;
        display: none !important;
    }

    .base-dropdown:hover .base-dropdown-menu {
        display: block !important;
    }

    /* Ensure main content has proper spacing */
    body {
        padding-top: 70px !important;
    }

    .base-main-content {
        margin-top: 0 !important;
    }

    /* Footer styles */
    .base-footer {
        display: block !important;
        margin-top: auto !important;
    }
}

/* Ensure base navbar is visible on tablet and desktop */
@media (min-width: 769px) {
    body {
        padding-top: 70px !important;
    }

    .base-navbar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        display: flex !important;
    }

    .base-navbar-content {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .base-nav-links {
        display: flex !important;
        align-items: center !important;
    }

    .base-main-nav {
        display: flex !important;
        align-items: center !important;
    }

    .base-user-nav {
        display: flex !important;
        align-items: center !important;
    }
}