/* ========================================
   MOBILE-FIRST RESPONSIVE STYLES
   Restaurant POS System - Enhanced UX/UI
   ======================================== */

/* ============ GLOBAL MOBILE STYLES ============ */
:root {
    --primary-color: #28a745;
    --primary-dark: #1e7e34;
    --primary-light: #34ce57;
    --secondary-color: #6c757d;
    --accent-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --light-bg: #f8f9fa;
    --dark-text: #2c3e50;
    --shadow-light: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.15);
    --shadow-heavy: 0 8px 30px rgba(0,0,0,0.2);
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --transition: all 0.3s ease;
}

/* Base responsive typography */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        line-height: 1.5;
        margin: 0;
        padding: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        min-height: 100vh;
    }
    
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.4rem; }
    h4 { font-size: 1.2rem; }
    h5 { font-size: 1.1rem; }
    h6 { font-size: 1rem; }
}

/* ============ ENHANCED HEADER STYLES ============ */
.mobile-header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    box-shadow: var(--shadow-medium);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--primary-color);
}

@media (max-width: 768px) {
    .mobile-header {
        padding: 10px 0;
    }
    
    .mobile-header h4 {
        font-size: 1.1rem;
        color: var(--dark-text);
        margin-bottom: 2px;
        font-weight: 600;
    }
    
    .mobile-header .badge {
        font-size: 0.8rem;
        padding: 6px 10px;
        border-radius: 25px;
        background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
        border: none;
        box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
        font-weight: 500;
    }
    
    .mobile-header small {
        font-size: 0.75rem;
        color: var(--secondary-color);
    }
}

/* ============ ENHANCED NAVIGATION TABS ============ */
.mobile-nav-tabs {
    background: white;
    box-shadow: var(--shadow-light);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin: 10px;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .mobile-nav-tabs .nav-link {
        padding: 12px 8px;
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--dark-text);
        border: none;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
        transition: var(--transition);
        position: relative;
    }
    
    .mobile-nav-tabs .nav-link.active {
        background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
        color: white;
        box-shadow: var(--shadow-light);
    }
    
    .mobile-nav-tabs .nav-link:hover:not(.active) {
        background: var(--light-bg);
        transform: translateY(-2px);
    }
    
    .mobile-nav-tabs .nav-link i {
        margin-right: 6px;
        font-size: 1rem;
    }
    
    /* Badge on nav tabs */
    .mobile-nav-tabs .badge {
        position: absolute;
        top: 5px;
        right: 5px;
        min-width: 18px;
        height: 18px;
        border-radius: 50%;
        font-size: 0.7rem;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--danger-color);
        color: white;
        border: 2px solid white;
        box-shadow: var(--shadow-light);
    }
}

/* ============ ENHANCED CONTENT CONTAINERS ============ */
.mobile-content {
    background: white;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    margin: 0 10px 10px 10px;
    min-height: calc(100vh - 180px);
    box-shadow: var(--shadow-heavy);
    overflow: hidden;
}

@media (max-width: 768px) {
    .mobile-content {
        margin: 0 8px 8px 8px;
        border-radius: 0 0 var(--border-radius) var(--border-radius);
    }
}

/* ============ ENHANCED CARD STYLES ============ */
.mobile-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid #e9ecef;
    transition: var(--transition);
    overflow: hidden;
}

@media (max-width: 768px) {
    .mobile-card {
        margin-bottom: 12px;
        border-radius: 10px;
    }
    
    .mobile-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-medium);
    }
    
    .mobile-card-header {
        background: linear-gradient(135deg, var(--light-bg), #e9ecef);
        padding: 12px 15px;
        border-bottom: 1px solid #dee2e6;
        font-weight: 600;
        color: var(--dark-text);
    }
    
    .mobile-card-body {
        padding: 15px;
    }
    
    .mobile-card-footer {
        background: var(--light-bg);
        padding: 10px 15px;
        border-top: 1px solid #dee2e6;
    }
}

/* ============ ENHANCED BUTTON STYLES ============ */
@media (max-width: 768px) {
    .btn {
        border-radius: 25px;
        font-weight: 500;
        transition: var(--transition);
        border: none;
        box-shadow: var(--shadow-light);
    }
    
    .btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-medium);
    }
    
    .btn-primary {
        background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    }
    
    .btn-success {
        background: linear-gradient(135deg, var(--success-color), #34ce57);
    }
    
    .btn-warning {
        background: linear-gradient(135deg, var(--warning-color), #ffcd39);
        color: var(--dark-text);
    }
    
    .btn-danger {
        background: linear-gradient(135deg, var(--danger-color), #e55a6b);
    }
    
    .btn-info {
        background: linear-gradient(135deg, var(--accent-color), #20c997);
    }
    
    .btn-outline-primary {
        border: 2px solid var(--primary-color);
        color: var(--primary-color);
        background: white;
    }
    
    .btn-outline-primary:hover {
        background: var(--primary-color);
        color: white;
    }
    
    /* Floating Action Button */
    .btn-floating {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        z-index: 999;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        border: none;
        background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
        color: white;
        transition: var(--transition);
    }
    
    .btn-floating:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    }
    
    /* Quick Navigation Buttons */
    .quick-nav-buttons {
        position: fixed;
        bottom: 20px;
        left: 20px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        z-index: 998;
    }
    
    .quick-nav-btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        box-shadow: 0 3px 12px rgba(0,0,0,0.25);
        transition: var(--transition);
        background: linear-gradient(135deg, var(--accent-color), #20c997);
        color: white;
    }
    
    .quick-nav-btn:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    }
    
    .quick-nav-btn.btn-cart {
        background: linear-gradient(135deg, var(--warning-color), #ffcd39);
        color: #856404;
    }
    
    .quick-nav-btn.btn-order {
        background: linear-gradient(135deg, var(--success-color), #34ce57);
        color: white;
    }
    
    /* Hide quick nav on desktop */
    @media (min-width: 769px) {
        .quick-nav-buttons {
            display: none;
        }
    }
}

/* ============ ENHANCED FORM STYLES ============ */
@media (max-width: 768px) {
    .form-control {
        border-radius: var(--border-radius);
        border: 2px solid #e9ecef;
        padding: 12px 15px;
        font-size: 1rem;
        transition: var(--transition);
    }
    
    .form-control:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
    }
    
    .input-group {
        border-radius: var(--border-radius);
        overflow: hidden;
        box-shadow: var(--shadow-light);
    }
    
    .input-group-text {
        background: linear-gradient(135deg, var(--light-bg), #e9ecef);
        border: 2px solid #e9ecef;
        color: var(--dark-text);
    }
}

/* ============ ENHANCED TABLE STYLES ============ */
@media (max-width: 768px) {
    .table-responsive {
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-light);
        overflow: hidden;
    }
    
    .table {
        margin-bottom: 0;
    }
    
    .table th {
        background: linear-gradient(135deg, var(--light-bg), #e9ecef);
        color: var(--dark-text);
        font-weight: 600;
        border: none;
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .table td {
        padding: 10px 8px;
        border-color: #f8f9fa;
        vertical-align: middle;
    }
    
    .table-striped tbody tr:nth-of-type(odd) {
        background-color: rgba(0,0,0,0.02);
    }
}

/* ============ ENHANCED MENU CARD STYLES ============ */
@media (max-width: 768px) {
    .mobile-menu-card {
        background: white;
        border-radius: var(--border-radius);
        overflow: hidden;
        box-shadow: var(--shadow-light);
        transition: var(--transition);
        border: 1px solid #e9ecef;
        padding: 15px;
        margin-bottom: 12px;
        cursor: pointer;
    }
    
    .mobile-menu-card:hover {
        box-shadow: var(--shadow-medium);
        transform: translateY(-2px);
        border-color: var(--primary-color);
    }
    
    /* Mobile Layout: Stack vertically for better readability */
    .mobile-menu-layout {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .mobile-menu-header {
        display: flex;
        align-items: flex-start;
        gap: 12px;
    }
    
    .mobile-menu-image {
        width: 80px;
        height: 80px;
        background: linear-gradient(45deg, var(--light-bg), #e9ecef);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        color: var(--secondary-color);
        border-radius: 12px;
        flex-shrink: 0;
        overflow: hidden;
    }
    
    .mobile-menu-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .mobile-menu-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .mobile-menu-name {
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--dark-text);
        line-height: 1.3;
        margin: 0;
    }
    
    .mobile-menu-description {
        font-size: 0.9rem;
        color: var(--secondary-color);
        line-height: 1.4;
        margin: 0;
    }
    
    .mobile-menu-category {
        font-size: 0.8rem;
        color: var(--accent-color);
        font-weight: 500;
        margin: 0;
        padding: 2px 8px;
        background: rgba(23, 162, 184, 0.1);
        border-radius: 12px;
        display: inline-block;
        width: fit-content;
    }
    
    .mobile-menu-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 8px;
        border-top: 1px solid #f0f0f0;
    }
    
    .mobile-menu-price {
        color: var(--success-color);
        font-weight: 700;
        font-size: 1.2rem;
    }
    
    .mobile-menu-actions .btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        font-size: 1rem;
        box-shadow: var(--shadow-light);
    }
}

/* ============ ENHANCED CART STYLES ============ */
@media (max-width: 768px) {
    .mobile-cart-item {
        background: white;
        border-radius: var(--border-radius);
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: var(--shadow-light);
        border: 1px solid #e9ecef;
    }
    
    .mobile-cart-header {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .mobile-cart-title-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .mobile-cart-name {
        font-weight: 700;
        color: var(--dark-text);
        font-size: 1.1rem;
        line-height: 1.3;
        margin: 0;
        flex: 1;
        margin-right: 10px;
    }
    
    .mobile-cart-total {
        font-weight: 700;
        font-size: 1.2rem;
        color: var(--success-color);
        white-space: nowrap;
    }
    
    .mobile-cart-price {
        color: var(--secondary-color);
        font-size: 0.9rem;
        margin: 0;
    }
    
    .mobile-cart-notes {
        color: var(--accent-color);
        font-size: 0.85rem;
        margin: 8px 0 0 0;
        padding: 6px 12px;
        background: rgba(23, 162, 184, 0.1);
        border-radius: 16px;
        display: inline-block;
        line-height: 1.3;
    }
    
    .mobile-cart-controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
    }
    
    .mobile-qty-controls {
        display: flex;
        align-items: center;
        gap: 12px;
        background: var(--light-bg);
        border-radius: 25px;
        padding: 6px;
    }
    
    .mobile-qty-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        transition: var(--transition);
        font-size: 1rem;
        box-shadow: var(--shadow-light);
    }
    
    .mobile-qty-btn:hover {
        transform: scale(1.05);
    }
    
    .mobile-qty-input {
        width: 60px;
        text-align: center;
        border: none;
        background: transparent;
        font-weight: 600;
        color: var(--dark-text);
        font-size: 1rem;
    }
    
    .mobile-cart-remove {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: none;
        background: var(--danger-color);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        box-shadow: var(--shadow-light);
        transition: var(--transition);
    }
    
    .mobile-cart-remove:hover {
        transform: scale(1.05);
        background: #c82333;
    }
}

/* ============ ENHANCED TOTALS SECTION ============ */
@media (max-width: 768px) {
    .mobile-totals {
        background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
        color: white;
        padding: 25px;
        border-radius: var(--border-radius);
        margin: 20px 0;
        box-shadow: var(--shadow-medium);
        font-size: 1.1rem;
    }
    
    .mobile-totals .d-flex {
        margin-bottom: 12px;
        align-items: center;
        min-height: 32px;
    }
    
    .mobile-totals .d-flex:last-child {
        margin-bottom: 0;
        padding-top: 15px;
        border-top: 2px solid rgba(255,255,255,0.3);
        font-weight: 700;
        font-size: 1.3rem;
        min-height: 40px;
    }
    
    .mobile-totals span {
        line-height: 1.4;
    }
    
    /* Enhanced Order Summary Cards */
    .order-summary {
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-medium);
        border: 1px solid #e9ecef;
        background: white;
    }
    
    .order-summary .card-header,
    .mobile-card-header {
        background: linear-gradient(135deg, var(--light-bg), #e9ecef);
        padding: 18px 20px;
        border-bottom: 1px solid #dee2e6;
        font-weight: 700;
        font-size: 1.2rem;
        color: var(--dark-text);
    }
    
    .order-summary .card-body,
    .mobile-card-body {
        padding: 20px;
        font-size: 1rem;
    }
    
    .order-summary .card-footer,
    .mobile-card-footer {
        background: var(--light-bg);
        padding: 18px 20px;
        border-top: 1px solid #dee2e6;
    }
}

/* ============ ENHANCED LOADING STATES ============ */
@media (max-width: 768px) {
    .mobile-loading {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 40px 20px;
        color: var(--secondary-color);
    }
    
    .mobile-loading .spinner-border {
        width: 3rem;
        height: 3rem;
        border-width: 0.3em;
        color: var(--primary-color);
        margin-bottom: 15px;
    }
    
    .mobile-empty-state {
        text-align: center;
        padding: 40px 20px;
        color: var(--secondary-color);
    }
    
    .mobile-empty-state i {
        font-size: 3rem;
        margin-bottom: 15px;
        opacity: 0.3;
        color: var(--secondary-color);
    }
    
    .mobile-empty-state h6 {
        margin-bottom: 8px;
        color: var(--dark-text);
    }
    
    .mobile-empty-state p {
        font-size: 0.9rem;
        margin-bottom: 0;
    }
}

/* ============ ENHANCED ALERTS & NOTIFICATIONS ============ */
@media (max-width: 768px) {
    .alert {
        border-radius: var(--border-radius);
        border: none;
        box-shadow: var(--shadow-light);
        margin-bottom: 15px;
    }
    
    .alert-success {
        background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(52, 206, 87, 0.1));
        color: var(--success-color);
        border-left: 4px solid var(--success-color);
    }
    
    .alert-warning {
        background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 205, 57, 0.1));
        color: #856404;
        border-left: 4px solid var(--warning-color);
    }
    
    .alert-danger {
        background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(229, 90, 107, 0.1));
        color: var(--danger-color);
        border-left: 4px solid var(--danger-color);
    }
    
    .alert-info {
        background: linear-gradient(135deg, rgba(23, 162, 184, 0.1), rgba(32, 201, 151, 0.1));
        color: var(--accent-color);
        border-left: 4px solid var(--accent-color);
    }
}

/* ============ ENHANCED STATUS BADGES ============ */
@media (max-width: 768px) {
    .badge {
        font-size: 0.75rem;
        padding: 6px 12px;
        border-radius: 25px;
        font-weight: 500;
        box-shadow: var(--shadow-light);
    }
    
    .badge-status-pending {
        background: linear-gradient(135deg, var(--warning-color), #ffcd39);
        color: #856404;
    }
    
    .badge-status-confirmed {
        background: linear-gradient(135deg, var(--accent-color), #20c997);
        color: white;
    }
    
    .badge-status-cooking {
        background: white;
        color: #6f42c1;
        border: 2px solid #6f42c1;
    }
    
    .badge-status-served {
        background: linear-gradient(135deg, var(--success-color), #34ce57);
        color: white;
    }
    
    .badge-status-cancelled {
        background: linear-gradient(135deg, var(--danger-color), #e55a6b);
        color: white;
    }
}

/* ============ ORDER ITEMS (Staff Order Page) ============ */
@media (max-width: 768px) {
    .mobile-order-item {
        background: white;
        border-radius: var(--border-radius);
        padding: 16px;
        margin-bottom: 10px;
        box-shadow: var(--shadow-light);
        border: 1px solid #e9ecef;
    }
    
    .mobile-order-header {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .mobile-order-title-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .mobile-order-name {
        font-weight: 700;
        color: var(--dark-text);
        font-size: 1.1rem;
        line-height: 1.3;
        margin: 0;
        flex: 1;
        margin-right: 10px;
    }
    
    .mobile-order-price {
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--success-color);
        white-space: nowrap;
    }
    
    .mobile-order-details {
        color: var(--secondary-color);
        font-size: 0.9rem;
        margin: 0;
    }
    
    .mobile-order-notes {
        color: var(--accent-color);
        font-size: 0.85rem;
        margin: 8px 0 0 0;
        padding: 6px 12px;
        background: rgba(23, 162, 184, 0.1);
        border-radius: 16px;
        display: inline-block;
        line-height: 1.3;
    }
    
    .mobile-order-controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
    }
    
    .mobile-order-status {
        padding: 6px 12px;
        border-radius: 16px;
        font-size: 0.8rem;
        font-weight: 600;
        text-align: center;
        min-width: 80px;
    }
}

/* ============ RESPONSIVE UTILITIES ============ */
@media (max-width: 576px) {
    .mobile-content {
        margin: 0 5px 5px 5px;
    }
    
    .mobile-nav-tabs {
        margin: 5px;
        margin-bottom: 0;
    }
    
    .mobile-card-body {
        padding: 12px;
    }
    
    .mobile-menu-card {
        padding: 12px;
    }
    
    .mobile-menu-image {
        width: 70px;
        height: 70px;
    }
    
    .mobile-menu-name {
        font-size: 1rem;
    }
    
    .mobile-menu-price {
        font-size: 1.1rem;
    }
    
    .mobile-cart-item, .mobile-order-item {
        padding: 14px;
    }
}

/* ============ SMOOTH ANIMATIONS ============ */
@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.slide-in-up {
    animation: slideInUp 0.3s ease-out;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.pulse-animation {
    animation: pulse 2s infinite;
}

/* ============ ACCESSIBILITY IMPROVEMENTS ============ */
@media (max-width: 768px) {
    /* Larger touch targets */
    .btn, .nav-link, .mobile-menu-card {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better focus states */
    .btn:focus, .form-control:focus, .nav-link:focus {
        outline: 3px solid rgba(40, 167, 69, 0.5);
        outline-offset: 2px;
    }
    
    /* High contrast text */
    .text-muted {
        color: #6c757d !important;
    }
    
    /* Fix table status text visibility */
    .table-status-occupied {
        font-size: 1rem !important;
        padding: 0.5rem 0.75rem !important;
        line-height: 1.4 !important;
        min-height: 36px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
        font-weight: 600 !important;
    }
    
    .table-status-free {
        font-size: 1rem !important;
        padding: 0.5rem 0.75rem !important;
        line-height: 1.4 !important;
        min-height: 36px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap !important;
        font-weight: 600 !important;
    }
}