/* Mobile-First Responsive Styles for Ketering.mk */

/* Base mobile styles (applied to all screen sizes) */
* {
    box-sizing: border-box;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Mobile: Base styles (0-767px) */
@media (max-width: 767px) {
    /* Typography adjustments */
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    /* Container adjustments */
    .container {
        padding: 0 15px !important;
    }
    
    /* Header adjustments */
    header {
        padding: 0.75rem 0 !important;
    }
    
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start !important;
    }
    
    .logo {
        font-size: 1.25rem !important;
    }
    
    nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    
    nav a {
        font-size: 0.9rem !important;
        margin-left: 0 !important;
        margin-right: 1rem !important;
    }
    
    /* Search section */
    .search-section {
        padding: 2rem 0 !important;
    }
    
    .search-section h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .search-section p {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .search-form {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .search-input {
        width: 100% !important;
        min-width: 100% !important;
        padding: 0.875rem 1rem !important;
        font-size: 1rem !important;
    }
    
    .search-btn {
        width: 100% !important;
        padding: 0.875rem !important;
        font-size: 1rem !important;
    }
    
    /* Filters section */
    .filters-section {
        padding: 1.5rem 0 !important;
    }
    
    .filters {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .filter-group {
        width: 100% !important;
    }
    
    .filter-select,
    .filter-input {
        width: 100% !important;
        padding: 0.75rem !important;
        font-size: 1rem !important;
    }
    
    /* Results section */
    .results-section {
        padding: 1.5rem 0 !important;
    }
    
    .results-header {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: stretch !important;
    }
    
    .sort-select {
        width: 100% !important;
        padding: 0.75rem !important;
        font-size: 1rem !important;
    }
    
    /* Grid layouts */
    .caterer-grid,
    .menu-grid,
    .order-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Cards */
    .caterer-card,
    .menu-card,
    .order-card {
        margin-bottom: 1rem;
    }
    
    .caterer-image,
    .menu-image {
        height: 180px !important;
    }
    
    .caterer-content,
    .menu-content {
        padding: 1rem !important;
    }
    
    /* Tables - make them scrollable */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    table {
        min-width: 600px;
        font-size: 0.85rem !important;
    }
    
    table th,
    table td {
        padding: 0.5rem !important;
        white-space: nowrap;
    }
    
    /* Dashboard stats */
    .stats-grid,
    .dashboard-stats {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .stat-card {
        padding: 1rem !important;
    }
    
    .stat-value {
        font-size: 1.75rem !important;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1rem !important;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        width: 100% !important;
        padding: 0.75rem !important;
        font-size: 1rem !important;
    }
    
    .form-actions {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .form-actions button,
    .form-actions .btn {
        width: 100% !important;
        padding: 0.875rem !important;
    }
    
    /* Buttons */
    .btn,
    button {
        padding: 0.75rem 1rem !important;
        font-size: 1rem !important;
    }
    
    .btn-group {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .btn-group button,
    .btn-group .btn {
        width: 100% !important;
    }
    
    /* Action buttons in tables/cards */
    .action-btn,
    .order-actions button {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
    }
    
    .order-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    
    /* Modals */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 5% auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem !important;
    }
    
    /* Order info grids */
    .order-info-grid,
    .info-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    /* Cart items */
    .cart-items,
    .order-items {
        padding: 1rem !important;
    }
    
    .cart-item,
    .order-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        padding: 1rem !important;
    }
    
    .item-image {
        width: 100% !important;
        height: 150px !important;
    }
    
    /* Checkout page */
    .checkout-container {
        flex-direction: column !important;
    }
    
    .checkout-main,
    .checkout-sidebar {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Navigation tabs */
    .nav-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
    }
    
    .nav-tab {
        padding: 0.625rem 1rem !important;
        font-size: 0.9rem !important;
        white-space: nowrap;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        justify-content: center !important;
    }
    
    .page-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
        min-width: 40px;
    }
    
    /* Messages/Chat */
    .message-list {
        max-height: 400px !important;
    }
    
    .message-item {
        padding: 0.75rem !important;
    }
    
    /* Profile sections */
    .profile-section {
        padding: 1rem !important;
    }
    
    .profile-header {
        flex-direction: column !important;
        text-align: center !important;
    }
    
    .profile-avatar {
        width: 80px !important;
        height: 80px !important;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }
    
    /* Spacing adjustments */
    section {
        padding: 1.5rem 0 !important;
    }
    
    /* Text overflow handling */
    .caterer-description,
    .menu-description,
    .order-description {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* Customer Orders Page */
    .order-card {
        padding: 1rem !important;
    }
    
    .order-header {
        flex-direction: column !important;
        gap: 0.75rem !important;
        align-items: flex-start !important;
    }
    
    .order-details {
        grid-template-columns: 1fr !important;
    }
    
    .order-actions {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .order-actions .btn,
    .order-actions button {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
    }
    
    /* Tabs */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-bottom: 2px solid #eee !important;
    }
    
    .tab-btn {
        padding: 0.75rem 1.25rem !important;
        font-size: 0.95rem !important;
        white-space: nowrap;
    }
    
    /* Messages/Conversations */
    .conversation-card {
        padding: 1rem !important;
    }
    
    .messages-list {
        gap: 0.75rem !important;
    }
    
    /* Order Status Page */
    .status-card {
        padding: 1.5rem 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .status-icon {
        width: 60px !important;
        height: 60px !important;
        font-size: 2rem !important;
    }
    
    .order-number {
        font-size: 1.25rem !important;
    }
    
    .info-section {
        margin-bottom: 1.5rem !important;
    }
    
    .info-title {
        font-size: 1rem !important;
    }
    
    /* Caterer Profile Page */
    .profile-header {
        flex-direction: column !important;
        text-align: center !important;
        padding: 1rem !important;
    }
    
    .profile-image {
        width: 100px !important;
        height: 100px !important;
        margin: 0 auto 1rem !important;
    }
    
    .profile-info {
        text-align: center !important;
    }
    
    .profile-actions {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }
    
    .profile-actions .btn {
        width: 100% !important;
    }
    
    .menu-items-grid,
    .supplies-grid {
        grid-template-columns: 1fr !important;
    }
    
    .cart-sidebar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        max-height: 50vh !important;
        border-radius: 12px 12px 0 0 !important;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.15) !important;
        z-index: 1000 !important;
    }
    
    .cart-toggle-mobile {
        display: block !important;
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        z-index: 999 !important;
        background: #e74c3c !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    }
    
    /* Checkout Page */
    .checkout-container {
        flex-direction: column !important;
    }
    
    .checkout-main {
        width: 100% !important;
        padding: 1rem !important;
    }
    
    .order-summary {
        position: static !important;
        width: 100% !important;
        margin-top: 1rem !important;
        padding: 1rem !important;
    }
    
    .section {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .section-title {
        font-size: 1.1rem !important;
    }
    
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    .payment-method-option {
        padding: 1rem !important;
    }
    
    .card-element {
        padding: 0.875rem !important;
    }
    
    /* Login/Register Page */
    .login-container {
        flex-direction: column !important;
        padding: 1rem !important;
    }
    
    .login-section {
        width: 100% !important;
        padding: 1rem !important;
    }
    
    .register-section {
        grid-template-columns: 1fr !important;
    }
    
    .benefit-card {
        padding: 1rem !important;
    }
    
    .tab-buttons {
        flex-wrap: wrap !important;
    }
    
    .tab-btn {
        flex: 1 1 auto !important;
        min-width: 120px !important;
    }
}

/* Tablet: Medium screens (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 0 20px !important;
    }
    
    .caterer-grid,
    .menu-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .stats-grid,
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .order-info-grid,
    .info-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .search-form {
        flex-direction: row !important;
    }
    
    .search-input {
        min-width: 300px !important;
    }
    
    table {
        font-size: 0.9rem !important;
    }
}

/* Large tablets and small desktops (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .caterer-grid,
    .menu-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .stats-grid,
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    *:hover {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Better tap feedback */
    button:active,
    .btn:active,
    a:active {
        opacity: 0.7;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .search-section {
        padding: 1.5rem 0 !important;
    }
    
    .modal-content {
        max-height: 85vh !important;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS Safari bottom bar */
    body {
        min-height: -webkit-fill-available;
    }
    
    /* Prevent zoom on input focus */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

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