/* ============================================
   ENHANCED MOBILE RESPONSIVENESS
   Optimized for all mobile devices without quality loss
   ============================================ */

/* ===== IMPROVED MOBILE BREAKPOINTS ===== */

/* Large Tablets & Small Laptops (1024px - 1199px) */
@media (max-width: 1199px) {
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* Tablets (768px - 1023px) */
@media (max-width: 1023px) {
    /* Navigation */
    .nav-links {
        display: none;
    }
    
    nav {
        padding: 1rem 4%;
        gap: 1rem;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    /* Hero Section */
    .restaurant-hero-enhanced {
        height: 350px;
    }
    
    .hero-overlay-enhanced {
        padding: 2rem 4%;
    }
    
    .restaurant-main-info h1 {
        font-size: 2.5rem;
    }
    
    .restaurant-tag {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        margin: 0.25rem;
    }
    
    /* Info Bar */
    .info-bar {
        padding: 1.5rem 4%;
    }
    
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
    }
    
    .info-item {
        padding: 1rem;
    }
    
    .info-icon {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
    
    /* Content Sections */
    .about-section,
    .menu-section,
    .reviews-section {
        padding: 2rem 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    /* Menu Items */
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
    }
    
    .menu-item {
        padding: 1rem;
    }
    
    .item-image {
        height: 160px;
        font-size: 2.5rem;
    }
    
    /* Reviews */
    .reviews-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.2rem;
    }
    
    /* Restaurant Cards */
    .restaurant-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .list-view .restaurant-card {
        flex-direction: column;
    }
    
    .list-view .restaurant-image {
        width: 100%;
        height: 200px;
    }
}

/* Small Tablets & Large Phones (640px - 767px) */
@media (max-width: 767px) {
    /* Navigation */
    nav {
        padding: 0.9rem 3%;
        flex-wrap: wrap;
    }
    
    .nav-buttons {
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Hero */
    .restaurant-hero-enhanced {
        height: 320px;
    }
    
    .hero-overlay-enhanced {
        padding: 1.5rem 3%;
    }
    
    .restaurant-main-info h1 {
        font-size: 2rem;
        margin-bottom: 0.8rem;
    }
    
    .restaurant-tag {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        margin: 0.2rem;
    }
    
    .cuisine-type {
        font-size: 1rem;
        margin: 0.8rem 0;
    }
    
    .status-badge {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Info Bar - Stack in single column */
    .info-bar {
        padding: 1.2rem 3%;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .info-item {
        padding: 0.8rem;
        flex-direction: row;
        text-align: left;
    }
    
    .info-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .info-value {
        font-size: 1.1rem;
    }
    
    .info-label {
        font-size: 0.85rem;
    }
    
    /* Controls */
    .controls-section {
        padding: 1rem 3%;
    }
    
    .controls-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-filter {
        width: 100%;
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .search-input,
    .filter-dropdown {
        width: 100%;
        padding: 0.8rem 1.2rem;
    }
    
    /* Main Content */
    .main-content {
        padding: 2rem 3%;
    }
    
    .about-section,
    .menu-section,
    .reviews-section {
        padding: 1.5rem 1.2rem;
        margin-bottom: 1.2rem;
    }
    
    .about-section h2,
    .menu-section h2,
    .reviews-section h2 {
        font-size: 1.8rem;
        margin-bottom: 1.2rem;
    }
    
    /* Category Header */
    .category-header {
        padding: 1.2rem;
        gap: 0.8rem;
        flex-direction: row;
        align-items: center;
    }
    
    .category-emoji {
        font-size: 2.5rem;
    }
    
    .category-header h3 {
        font-size: 1.4rem;
    }
    
    /* Menu Items - Single Column */
    .menu-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .menu-item {
        padding: 1rem;
    }
    
    .item-image {
        height: 180px;
        font-size: 2.8rem;
    }
    
    .item-info {
        padding: 1rem;
    }
    
    .item-header {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.8rem;
    }
    
    .item-header h4 {
        font-size: 1.1rem;
    }
    
    .item-price {
        font-size: 1.1rem;
    }
    
    .item-description {
        font-size: 0.9rem;
        line-height: 1.6;
        margin: 0.8rem 0;
    }
    
    .add-to-cart-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-height: 42px;
    }
    
    /* Reviews - Single Column */
    .reviews-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .review-card {
        padding: 1.2rem;
    }
    
    .reviewer-avatar {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    /* Restaurant Cards */
    .restaurant-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    
    .restaurant-image {
        height: 200px;
        font-size: 3.5rem;
    }
    
    .restaurant-info {
        padding: 1.2rem;
    }
    
    /* Cart */
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .cart-button {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    /* Search Bar */
    .search-bar {
        flex-direction: column;
        margin: 1.5rem auto;
    }
    
    .search-bar input {
        padding: 1.1rem 1.5rem;
        font-size: 1rem;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    
    .search-bar button {
        padding: 1.1rem;
        font-size: 1rem;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    }
    
    /* Footer */
    footer {
        padding: 2rem 3%;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
}

/* Mobile Phones (480px - 639px) */
@media (max-width: 639px) {
    /* Hero */
    .restaurant-hero-enhanced {
        height: 300px;
    }
    
    .hero-overlay-enhanced {
        padding: 1.2rem 3%;
    }
    
    .restaurant-main-info h1 {
        font-size: 1.8rem;
    }
    
    .restaurant-tag {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
    }
    
    /* Optimize tag wrapping */
    .restaurant-main-info > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    
    /* Info Items */
    .info-item {
        padding: 0.7rem;
        gap: 0.8rem;
    }
    
    .info-icon {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .info-value {
        font-size: 1rem;
    }
    
    .info-label {
        font-size: 0.8rem;
    }
    
    /* Menu Items */
    .item-image {
        height: 160px;
        font-size: 2.5rem;
    }
    
    .item-info {
        padding: 0.9rem;
    }
    
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
    
    .item-price {
        align-self: flex-start;
        font-size: 1.05rem;
    }
    
    .delivery-fee {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .delivery-fee span {
        flex: 0 0 auto;
    }
    
    /* Category Grid */
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .category-card {
        padding: 1.5rem 0.8rem;
    }
    
    .category-icon {
        font-size: 2.5rem;
    }
    
    /* Review Cards */
    .review-card {
        padding: 1rem;
    }
    
    .review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
    
    .review-date {
        align-self: flex-end;
        margin-top: -2rem;
    }
    
    /* Cart Sidebar */
    .cart-items {
        padding: 1rem;
    }
    
    .cart-footer {
        padding: 1rem;
    }
}

/* Small Mobile Phones (up to 479px) */
@media (max-width: 479px) {
    /* Navigation */
    nav {
        padding: 0.8rem 3%;
        gap: 0.5rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    /* Hero */
    .restaurant-hero-enhanced {
        height: 280px;
    }
    
    .hero-overlay-enhanced {
        padding: 1rem 3%;
    }
    
    .restaurant-main-info h1 {
        font-size: 1.6rem;
        line-height: 1.3;
    }
    
    .restaurant-tag {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
        margin: 0.15rem;
    }
    
    .cuisine-type {
        font-size: 0.9rem;
    }
    
    .status-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    /* Info Bar */
    .info-bar {
        padding: 1rem 3%;
    }
    
    .info-item {
        padding: 0.6rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .info-icon {
        width: 42px;
        height: 42px;
        font-size: 1rem;
        margin: 0 auto;
    }
    
    .info-content {
        align-items: center;
    }
    
    .info-value {
        font-size: 0.95rem;
    }
    
    .info-label {
        font-size: 0.75rem;
    }
    
    /* Main Content */
    .main-content {
        padding: 1.5rem 3%;
    }
    
    .about-section,
    .menu-section,
    .reviews-section {
        padding: 1.2rem 1rem;
        margin-bottom: 1rem;
    }
    
    .about-section h2,
    .menu-section h2,
    .reviews-section h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .about-section p {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    /* Category Header */
    .category-header {
        padding: 1rem;
        gap: 0.7rem;
    }
    
    .category-emoji {
        font-size: 2rem;
    }
    
    .category-header h3 {
        font-size: 1.2rem;
    }
    
    .category-header small {
        font-size: 0.8rem;
    }
    
    /* Menu Items */
    .menu-grid {
        gap: 0.9rem;
    }
    
    .menu-item {
        padding: 0.8rem;
    }
    
    .item-image {
        height: 140px;
        font-size: 2.2rem;
    }
    
    .item-info {
        padding: 0.8rem;
    }
    
    .item-header h4 {
        font-size: 1rem;
    }
    
    .item-price {
        font-size: 1rem;
    }
    
    .item-description {
        font-size: 0.85rem;
        line-height: 1.5;
        margin: 0.6rem 0;
    }
    
    .item-rating {
        font-size: 0.8rem;
    }
    
    .delivery-fee {
        font-size: 0.8rem;
    }
    
    .add-to-cart-btn {
        padding: 0.7rem 0.9rem;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    /* Badges */
    .promo-badge,
    .spicy-badge,
    .veg-badge,
    .new-badge {
        top: 8px;
        left: 8px;
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
    
    /* Reviews */
    .reviews-grid {
        gap: 0.9rem;
    }
    
    .review-card {
        padding: 0.9rem;
    }
    
    .reviewer-avatar {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
    
    .reviewer-info h4 {
        font-size: 1rem;
    }
    
    .review-rating {
        font-size: 0.85rem;
    }
    
    .review-text {
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    /* Cart */
    .cart-button {
        bottom: 1rem;
        right: 1rem;
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
    
    .cart-badge {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    .cart-header h2 {
        font-size: 1.3rem;
    }
    
    /* Feature Cards */
    .feature-card {
        padding: 1.5rem 1rem;
    }
    
    .feature-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .feature-card h3 {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
    }
    
    .feature-card p {
        font-size: 0.9rem;
    }
    
    /* Restaurant Cards */
    .restaurant-image {
        height: 180px;
        font-size: 3rem;
    }
    
    .restaurant-info {
        padding: 1rem;
    }
    
    .restaurant-info h3 {
        font-size: 1.2rem;
    }
    
    .restaurant-info p {
        font-size: 0.9rem;
    }
    
    .restaurant-meta {
        font-size: 0.85rem;
    }
    
    /* Footer */
    footer {
        padding: 1.5rem 3%;
    }
    
    .footer-content h3 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .footer-links {
        gap: 0.8rem;
    }
    
    .footer-links a {
        font-size: 0.95rem;
    }
    
    .footer-content p {
        font-size: 0.85rem;
        margin-top: 1.2rem;
    }
}

/* Extra Small Devices (up to 380px) */
@media (max-width: 380px) {
    .restaurant-hero-enhanced {
        height: 260px;
    }
    
    .restaurant-main-info h1 {
        font-size: 1.4rem;
    }
    
    .item-image {
        height: 130px;
        font-size: 2rem;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .info-icon {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }
}

/* ===== LANDSCAPE MODE OPTIMIZATIONS ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .restaurant-hero-enhanced {
        height: 250px;
    }
    
    .hero-overlay-enhanced {
        padding: 1rem 3%;
    }
    
    .info-bar {
        padding: 0.8rem 3%;
    }
    
    .info-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.8rem;
    }
    
    .info-item {
        padding: 0.6rem;
    }
    
    .info-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ===== TOUCH OPTIMIZATION ===== */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn,
    .add-to-cart-btn,
    .view-btn,
    .page-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Optimize hover effects for touch */
    .menu-item:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    .restaurant-card:active {
        transform: translateY(-5px);
    }
    
    /* Prevent hover states on touch devices */
    .menu-item:hover,
    .restaurant-card:hover,
    .review-card:hover {
        transform: none;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
@media (max-width: 767px) {
    /* Ensure readable font sizes */
    body {
        font-size: 16px;
    }
    
    /* Improve tap targets */
    a, button, input, select {
        min-height: 44px;
    }
    
    /* Better spacing for readability */
    p {
        line-height: 1.7;
    }
}

/* ===== PREVENT HORIZONTAL SCROLL ===== */
@media (max-width: 767px) {
    body {
        overflow-x: hidden;
    }
    
    .restaurant-hero-enhanced,
    .info-bar,
    .main-content,
    .menu-section {
        max-width: 100vw;
        overflow-x: hidden;
    }
}