body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

html, body {
    overflow-x: hidden;
}

/* Cabecera con imagen superior */
header {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 10px 0;
}

/* Imagen superior (ancha, encima del fondo gris) */
.header-banner {
    width: 100%;
    height: auto;
    display: block;
    margin: 0;
}

/* Si usas un título dentro del header */
header h1 {
    margin: 0;
}

/* Navegación dentro del header */
header nav {
    margin-top: 10px;
}

header nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 15px;
}

header nav a:hover {
    text-decoration: underline;
}


main {
    padding: 20px;
    max-width: 1200px;
    margin: 20px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h2, h3 {
    color: #0056b3;
}

/* Flashed messages */
.flashes {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.flashes li {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    font-weight: bold;
}

.flashes .success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flashes .error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Forms */
.upload-form {
    margin-bottom: 30px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.upload-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.upload-form input[type="file"] {
    margin-bottom: 15px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.upload-form button {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.upload-form button:hover {
    background-color: #0056b3;
}

/* Tables */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 20px;
    margin-bottom: 20px;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

table th {
    background-color: #007bff;
    color: white;
}

table tr:nth-child(even) {
    background-color: #f2f2f2;
}

table tr:hover {
    background-color: #ddd;
}

/* Order Page Layout */
.order-container {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Productos a la izquierda, resumen a la derecha */
    gap: 30px;
    margin-top: 20px;
}

/* Order Page Layout - Full Width (without summary) */
.order-container-full {
    margin-top: 20px;
}

.product-selection {
    background-color: #fdfdfd;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-input {
    width: calc(100% - 22px); /* Ajuste para padding */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}

/* New: Order Type Selector */
.order-type-selector {
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #f5f5f5;
    display: flex;
    gap: 15px;
    align-items: center;
}

.order-type-selector label {
    font-weight: bold;
    color: #555;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.order-type-selector input[type="radio"] {
    margin-right: 8px;
    width: 20px;
    height: 20px;
}

.order-type-selector a {
    padding: 8px 15px;
    text-decoration: none;
    color: #333;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: all 0.3s;
}

.order-type-selector a:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

.order-type-selector a.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}


/* New: Category Tree */
.category-tree {
    max-height: 600px; /* Altura máxima para scroll */
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 5px;
}

.category-item {
    margin-bottom: 10px;
}

.category-header {
    background-color: #e9ecef;
    padding: 10px;
    margin: 0;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
    font-weight: bold;
    color: #343a40;
}

.category-header:hover {
    background-color: #dee2e6;
}

.toggle-icon {
    font-size: 1.2em;
    font-weight: bold;
    transition: transform 0.2s;
}

.products-in-category {
    border-left: 2px solid #ccc;
    padding-left: 15px;
    margin-top: 5px;
}

.product-item {
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
}

.product-item:last-child {
    border-bottom: none;
}

.product-item h5 {
    margin: 0 0 5px 0;
    color: #333;
}

.product-item p {
    margin: 0 0 3px 0;
    font-size: 0.9em;
}

.product-info-line {
    display: flex;
    justify-content: space-between; /* Alinea el nombre del producto a la izquierda y los controles a la derecha */
    align-items: center;
    gap: 10px; /* Espacio entre el nombre y los controles */
    flex-wrap: wrap; /* Permite que los elementos se envuelvan en pantallas pequeñas */
}

.product-info-line h5 {
    margin: 0;
    color: #333;
    flex-grow: 1; /* Permite que el nombre del producto ocupe el espacio disponible */
}

.add-to-cart-controls {
    display: flex;
    align-items: center;
    gap: 8px; /* Espacio entre elementos de control */
    white-space: nowrap; /* Evita que los controles se dividan en varias líneas */
}

.price-display {
    font-size: 0.9em;
    color: #555;
    margin-right: 5px; /* Pequeño espacio antes del input de cantidad */
}

.add-to-cart-controls .quantity-input {
    width: 50px; /* Hacer el input más pequeño */
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

.add-to-cart-controls button {
    background-color: #28a745;
    color: white;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.add-to-cart-controls button:hover {
    background-color: #218838;
}

.order-summary {
    background-color: #fdfdfd;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#cart-items {
    margin-bottom: 20px;
    min-height: 150px; /* Para que no se colapse */
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 5px;
    max-height: 400px;
    overflow-y: auto;
}

#cart-items table {
    width: 100%;
    font-size: 0.9em;
}

#cart-items th, #cart-items td {
    padding: 5px;
}

.remove-button {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
}

.remove-button:hover {
    background-color: #c82333;
}

.order-totals {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    font-size: 1.1em;
    font-weight: bold;
}

.order-totals p {
    margin: 5px 0;
}

.confirm-button {
    width: 100%;
    background-color: #007bff;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    margin-top: 20px;
}

.confirm-button:hover {
    background-color: #0056b3;
}

#order-confirmation {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #28a745;
    background-color: #e2ffe5;
    border-radius: 5px;
    text-align: center;
}

#order-confirmation h3 {
    color: #28a745;
    margin-top: 0;
}

.download-button {
    display: inline-block;
    background-color: #17a2b8;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 10px;
    text-decoration: none;
}

.download-button:hover {
    background-color: #138496;
}

.share-button {
    display: inline-block;
    background-color: #25D366;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 10px;
}

.share-button:hover {
    background-color: #1DA851;
}

footer {
    text-align: center;
    padding: 15px;
    margin-top: 30px;
    background-color: #333;
    color: #fff;
    font-size: 0.9em;
}

.footer-banner {
    width: 100%;
    height: auto;
    display: block;
}

.footer-info {
    margin-top: 15px;
    line-height: 1.6;
}

.footer-info a {
    color: #fff;
    text-decoration: none;
}

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

.footer-social {
    margin-top: 10px;
}

.footer-social a {
    margin: 0 10px;
    color: #fff;
    font-weight: bold;
}


/* Modal styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    text-align: center;
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-top: 0;
    color: #0056b3;
}

.modal-content button {
    background-color: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin: 5px;
}

.modal-content button:hover {
    background-color: #0056b3;
}

.cancel-button {
    background-color: #6c757d !important;
}

.cancel-button:hover {
    background-color: #5a6268 !important;
}

/* Header container for cart icon */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.cart-icon-container {
    position: relative;
    cursor: pointer;
    padding-top: 10px;
}

.cart-icon {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    position: relative;
}

.cart-icon:hover {
    opacity: 0.8;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    display: none;
}

/* Cart Modal */
.cart-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.cart-modal-content {
    background-color: #fefefe;
    margin: auto;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.cart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.cart-modal-header h2 {
    margin: 0;
    color: #333;
}

.cart-modal-close {
    color: #aaa;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.cart-modal-close:hover,
.cart-modal-close:focus {
    color: #000;
}

.cart-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Add to cart animation */
@keyframes addToCartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background-color: #28a745; }
    100% { transform: scale(1); }
}

.cart-icon.pulse {
    animation: addToCartPulse 0.5s ease-in-out;
}

/* Notification animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 0);
        opacity: 1;
    }
    to {
        transform: translate(-50%, -100px);
        opacity: 0;
    }
}

/* Cart Page Styles */
.cart-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.cart-page-container #cart-items {
    margin-bottom: 20px;
    min-height: 150px;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 5px;
}

.cart-page-container .order-totals {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #333;
    font-size: 1.3em;
    font-weight: bold;
    text-align: right;
}

.cart-page-container .confirm-button {
    width: 100%;
    background-color: #007bff;
    color: white;
    padding: 15px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
    margin-top: 20px;
}

.cart-page-container .confirm-button:hover {
    background-color: #0056b3;
}

/* Availability management buttons */
.btn-primary {
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 10px;
}

.btn-primary:hover {
    background-color: #218838;
}

.btn-secondary {
    background-color: #dc3545;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.btn-secondary:hover {
    background-color: #c82333;
}

.btn-small {
    background-color: #007bff;
    color: white;
    padding: 5px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85em;
}

.btn-small:hover {
    background-color: #0056b3;
}

.availability-checkbox {
    cursor: pointer;
    width: 20px;
    height: 20px;
}

.category-header-row {
    background-color: #e9ecef !important;
}

.category-header-row:hover {
    background-color: #dee2e6 !important;
}

/* Fix checkbox sizes globally for mobile */
@media (max-width: 768px) {
    /* Make all checkboxes and radio buttons properly sized for mobile */
    input[type="checkbox"],
    input[type="radio"] {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        min-height: 24px !important;
        cursor: pointer;
        margin: 4px;
    }
    
    /* Specific styling for status checkboxes in admin tables */
    .status-checkbox,
    .availability-checkbox,
    .category-checkbox {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
    }
}

/* Responsive Design - Media Queries */

/* Tablets and smaller devices (max-width: 768px) */
@media (max-width: 768px) {
    /* Hide footer banner on mobile */
    .footer-banner {
        display: none;
    }
    
    /* Header adjustments */
    header {
        padding: 5px 0;
    }
    
    .header-container {
        padding: 10px;
        flex-wrap: wrap;
    }
    
    .header-title {
        font-size: 1.2em;
    }
    
    header nav {
        font-size: 0.85em;
        margin-top: 5px;
        width: 100%;
        text-align: center;
    }
    
    header nav a {
        margin: 0 5px;
        display: inline-block;
        padding: 5px;
    }
    
    /* Fix main container width on mobile to prevent expansion beyond viewport */
    main {
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
        margin: 10px auto !important;
        padding: 10px !important;
    }
    
    /* Admin Section - Orders Table */
    .orders-container {
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100%;
    }
    
    .orders-table {
        font-size: 0.75em;
        min-width: 900px; /* Ensure table is wide enough to trigger scroll on mobile */
    }
    
    .orders-table th,
    .orders-table td {
        padding: 6px 3px;
        white-space: nowrap;
        font-size: 0.95em;
    }
    
    .orders-table .actions {
        white-space: normal;
        min-width: 80px;
    }
    
    .orders-table .btn-edit,
    .orders-table .btn-save,
    .orders-table .btn-cancel,
    .orders-table .btn-delete {
        padding: 4px 6px;
        font-size: 0.7em;
        margin: 1px 0;
        display: block;
        width: 100%;
        white-space: nowrap;
    }
    
    /* Admin Section - Order Detail */
    .order-info {
        padding: 10px !important;
        margin: 10px 0 !important;
    }
    
    .order-info > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 5px !important;
        display: grid !important;
    }
    
    .order-info h3 {
        font-size: 1.1em;
        margin-top: 0;
    }
    
    .order-detail-table {
        font-size: 0.75em;
        min-width: 700px; /* Ensure table is wide enough to trigger scroll */
    }
    
    .order-detail-table th,
    .order-detail-table td {
        padding: 6px 3px;
        font-size: 0.95em;
        white-space: nowrap;
    }
    
    /* Admin Section - Comanda */
    .comanda-filters {
        padding: 10px;
        margin: 10px 0;
    }
    
    .comanda-filters form > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr;
        gap: 10px;
        display: block;
    }
    
    .comanda-filters label {
        font-size: 0.9em;
        display: block;
        margin: 8px 0;
    }
    
    .comanda-filters input[type="checkbox"] {
        margin-right: 8px;
    }
    
    .comanda-table {
        font-size: 0.75em;
        min-width: 700px; /* Ensure table is wide enough to trigger scroll */
    }
    
    .comanda-table th,
    .comanda-table td {
        padding: 6px 3px;
        font-size: 0.95em;
        white-space: nowrap;
    }
    
    /* Admin buttons responsive */
    .btn-back,
    .btn-download {
        padding: 10px 15px !important;
        font-size: 0.9em !important;
        display: inline-block;
        margin: 5px 0 !important;
        box-sizing: border-box;
    }
    
    div[style*="margin-bottom: 20px"] > .btn-back,
    div[style*="margin-bottom: 20px"] > .btn-download {
        width: 100%;
        margin-left: 0 !important;
    }
    
    div[style*="display: flex"] > .btn-back,
    div[style*="display: flex"] > .btn-download {
        width: 100%;
        margin: 5px 0 !important;
    }
    
    /* Search inputs responsive */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    input[type="number"],
    input[type="file"] {
        font-size: 16px !important;
    }
    
    /* Import order form */
    .upload-form {
        padding: 10px !important;
    }
    
    .upload-form input[type="file"],
    .upload-form input[type="number"],
    .upload-form button {
        width: 100%;
        margin-bottom: 10px;
    }
    
    /* Main content */
    main {
        padding: 10px;
        margin: 10px auto;
    }
    
    /* Order type selector */
    .order-type-selector {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .order-type-selector a {
        text-align: center;
        padding: 10px;
    }
    
    /* Product selection */
    .product-selection {
        padding: 10px;
    }
    
    .search-input {
        width: calc(100% - 20px);
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Category tree */
    .category-tree {
        max-height: 500px;
    }
    
    .category-header {
        font-size: 1em;
        padding: 8px;
    }
    
    /* Product items */
    .product-info-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .product-info-line h5 {
        font-size: 0.95em;
    }
    
    .add-to-cart-controls {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .add-to-cart-controls button {
        flex: 1;
        min-width: 80px;
        padding: 8px 10px;
    }
    
    .quantity-input {
        width: 60px !important;
    }
    
    /* Tables */
    .table-container {
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100%;
    }
    
    table {
        font-size: 0.85em;
        min-width: 600px; /* Ensure tables are wide enough to trigger horizontal scroll */
    }
    
    table th, table td {
        padding: 6px 4px;
        white-space: nowrap; /* Prevent text wrapping in cells */
    }
    
    /* Modal */
    .modal {
        padding: 20px;
        align-items: flex-start;
        padding-top: 10vh;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px auto;
        padding: 20px;
    }
    
    .modal-content button {
        padding: 12px 20px;
        font-size: 1em;
        width: 100%;
        max-width: 300px;
    }
    
    /* Cart */
    .cart-icon-container {
        padding: 5px;
    }
    
    .cart-icon span {
        font-size: 28px !important;
    }
    
    .cart-badge {
        font-size: 0.7em;
        padding: 2px 5px;
    }
    
    .cart-page-container {
        padding: 10px;
    }
    
    #cart-items {
        max-height: 300px;
        font-size: 0.9em;
    }
    
    .order-totals {
        font-size: 1.1em;
    }
    
    .confirm-button {
        padding: 12px;
        font-size: 1em;
    }
    
    /* Cart Action Buttons - Make responsive */
    .cart-action-buttons {
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    .cart-action-buttons button {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 15px;
        font-size: 1em;
        box-sizing: border-box !important;
        margin: 0;
        min-width: auto !important;
    }
    
    .cart-continue-button,
    .cart-confirm-button,
    .cart-reset-button {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 15px;
        font-size: 1em;
        box-sizing: border-box !important;
        display: block;
    }
    
    /* Cart page container */
    .cart-page-container {
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
        padding: 10px;
    }
    
    /* Cart customer form */
    #customer-form {
        padding: 10px;
        margin: 15px 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    #customer-form input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        font-size: 16px;
    }
    
    #customer-form button {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        margin: 5px 0;
    }
    
    #customer-form div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    /* Cart items table */
    #cart-items .table-container {
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100%;
    }
    
    #cart-items table {
        font-size: 0.75em;
        min-width: 700px;
    }
    
    #cart-items th,
    #cart-items td {
        padding: 6px 3px;
        white-space: nowrap;
    }
    
    #cart-items input[type="number"] {
        width: 60px;
        max-width: 60px;
        font-size: 0.9em;
        box-sizing: border-box;
    }
    
    /* Footer */
    footer {
        padding: 10px;
        font-size: 0.8em;
        margin-bottom: 0;
    }
    
    .footer-info {
        font-size: 0.85em;
    }
    
    .footer-social a {
        display: block;
        margin: 5px 0;
    }
    
    /* Prevent empty space below footer on mobile */
    body {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    main {
        flex: 1;
    }
    
    /* Forms */
    .upload-form {
        padding: 10px;
    }
    
    .upload-form input[type="file"],
    .upload-form input[type="number"],
    .upload-form input[type="text"] {
        font-size: 16px; /* Prevents zoom on iOS */
        width: 100%;
    }
    
    .upload-form button {
        width: 100%;
        padding: 12px;
    }
    
    /* Buttons */
    .btn-primary, .btn-secondary, .btn-small {
        padding: 8px 12px;
        font-size: 0.9em;
    }
}

/* Mobile phones (max-width: 480px) */
@media (max-width: 480px) {
    .header-title {
        font-size: 1em;
    }
    
    header nav {
        font-size: 0.75em;
    }
    
    header nav a {
        display: block;
        margin: 3px 0;
        padding: 8px;
        border-bottom: 1px solid #555;
    }
    
    h2 {
        font-size: 1.3em;
    }
    
    h3 {
        font-size: 1.1em;
    }
    
    .category-header {
        font-size: 0.95em;
        padding: 6px;
    }
    
    .product-info-line h5 {
        font-size: 0.9em;
    }
    
    .price-display {
        font-size: 0.85em;
    }
    
    .add-to-cart-controls button {
        font-size: 0.85em;
        padding: 6px 8px;
    }
    
    table {
        font-size: 0.75em;
        min-width: 500px; /* Smaller min-width for very small screens but still triggers scroll */
    }
    
    table th, table td {
        padding: 4px 2px;
    }
    
    .cart-page-container .order-totals {
        font-size: 1em;
    }
    
    .modal-content {
        width: 98%;
        padding: 10px;
    }
    
    .paella-info-note {
        font-size: 0.85em;
        padding: 8px;
    }
    
    /* Cart Action Buttons - Further adjustments for small screens */
    .cart-action-buttons button {
        padding: 10px 12px;
        font-size: 0.95em;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .cart-continue-button,
    .cart-confirm-button,
    .cart-reset-button {
        padding: 10px 12px;
        font-size: 0.95em;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Admin tables for very small screens */
    .orders-table,
    .order-detail-table,
    .comanda-table {
        font-size: 0.65em;
        min-width: 700px; /* Maintain min-width for scrolling even on very small screens */
    }
    
    .orders-table th,
    .orders-table td,
    .order-detail-table th,
    .order-detail-table td,
    .comanda-table th,
    .comanda-table td {
        padding: 5px 2px;
        font-size: 1em;
    }
    
    /* Admin buttons for very small screens */
    .btn-back,
    .btn-download {
        padding: 8px 12px;
        font-size: 0.85em;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .orders-table .btn-edit,
    .orders-table .btn-save,
    .orders-table .btn-cancel,
    .orders-table .btn-delete {
        padding: 3px 5px;
        font-size: 0.65em;
    }
    
    /* Comanda filters for small screens */
    .comanda-filters input[type="date"],
    .comanda-filters button {
        font-size: 0.9em;
        width: 100%;
    }
    
    .comanda-filters button[type="submit"] {
        padding: 10px;
        box-sizing: border-box;
    }
    
    /* Order info grid */
    .order-info p {
        font-size: 0.85em;
        margin: 5px 0;
        line-height: 1.4;
    }
    
    .order-info strong {
        display: inline-block;
        min-width: 100px;
    }
    
    /* Cart items for very small screens */
    #cart-items .table-container {
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100%;
    }
    
    #cart-items table {
        font-size: 0.7em;
        min-width: 600px;
    }
    
    #cart-items th,
    #cart-items td {
        padding: 4px 2px;
    }
    
    /* Customer form for small screens */
    #customer-form h4 {
        font-size: 1em;
    }
    
    #customer-form label {
        font-size: 0.9em;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .category-tree {
        max-height: 300px;
    }
    
    #cart-items {
        max-height: 200px;
    }
}

/* Additional responsive styles for admin sections */
@media (max-width: 768px) {
    /* Make button groups stack vertically on mobile */
    div[style*="display: flex"][style*="gap"] {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }
    
    div[style*="display: flex"][style*="gap"] > button,
    div[style*="display: flex"][style*="gap"] > a {
        width: 100% !important;
        margin: 5px 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure search and filter inputs are full width */
    #ordersSearch,
    #importOrderNumber,
    #importExcelFile {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Make editable table inputs responsive */
    .editable input {
        width: 100% !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
    }
    
    /* Checkbox cells alignment */
    .checkbox-cell {
        text-align: center;
        padding: 8px !important;
    }
    
    .status-checkbox {
        width: 20px;
        height: 20px;
    }
    
    /* Override inline styles for forms on mobile */
    form input[type="text"],
    form input[type="email"],
    form input[type="tel"],
    form input[type="date"],
    form input[type="time"],
    form input[type="number"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        font-size: 16px !important;
    }
    
    form button {
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 5px 0 !important;
    }
    
    /* Make all admin section grids single column */
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    
    /* Ensure proper spacing for form fields */
    div[style*="margin-bottom"] {
        margin-bottom: 10px !important;
    }
    
    /* Make all tables scrollable */
    .table-container,
    .orders-container {
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
    }
    
    /* Improve touch targets */
    button,
    a.btn-back,
    a.btn-download,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-edit,
    .btn-save,
    .btn-cancel,
    .btn-delete {
        min-height: 36px !important;
    }
}

/* Large screens - optimize use of space */
@media (min-width: 1400px) {
    main {
        max-width: 1400px;
    }
    
    .order-container {
        grid-template-columns: 3fr 1fr;
    }
}