:root {
    --color-primary: #D32F2F;
    /* Rojo */
    --color-secondary: #000000;
    /* Negro */
    --color-background: #FFFFFF;
    /* Blanco */
    --color-text: #333333;
    --color-text-light: #F5F5F5;
    --color-border: #DDDDDD;
    --spacing-unit: 1rem;
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Mobile-first: prevent any horizontal overflow */
* {
    max-width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}


/* Tipografía */
h1,
h2,
h3 {
    color: var(--color-secondary);
    margin-bottom: var(--spacing-unit);
}

a {
    text-decoration: none;
    color: var(--color-primary);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-secondary);
}

/* Botones */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;

}

.btn:hover {
    background-color: #B71C1C;
    /* Rojo más oscuro */
}

.btn-secondary {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background-color: #f5f5f5;
    color: #000000;
}

.btn-back {
    display: inline-block;
    padding: 10px 20px;
    background-color: #5a6268;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.btn-back:hover {
    background-color: #4a5156;
    color: white;
}

/* Utilidades */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .container {
        padding: 2rem 1rem;
    }
}


.card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Grid System */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 601px) and (max-width: 1024px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}



/* Cards */
.card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.8rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

@media (min-width: 768px) {
    .card {
        padding: 1rem;
    }
}


.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.product-image-container {
    width: 100%;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.8rem;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .product-image-container {
        height: 250px;
    }
}


.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Asegura que la imagen completa se vea sin cortes */
    transition: transform 0.3s ease;
}

.card:hover .product-image {
    transform: scale(1.05);
}

/* Hint text for all devices */
.product-hint-text {
    color: #999;
    font-size: 0.8rem;
    text-align: center;
    font-style: italic;
    margin: 0.3rem 0 0.5rem 0;
    padding: 0.4rem;
    background: #f8f9fa;
    border-radius: 4px;
}



.card h3 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.card p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}


/* Navigation Bar */
.navbar {
    background-color: #FFFFFF;
    color: var(--color-text);
    padding: 0.5rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--color-border);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    /* Asegurar padding lateral */
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    /* Rojo corporativo */
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-nav {
    display: flex;
    gap: 20px;
}

.navbar-nav a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.3s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--color-primary);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 5px;
}

/* Responsivo */
@media (max-width: 768px) {
    .navbar-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }

    .navbar-nav.show {
        display: flex;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .navbar .container {
        flex-wrap: wrap;
    }
}

.container {
    width: 100%;
    padding: 1rem;
}


/* Typography - Larger for readability */
body {
    font-size: 16px;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.2rem;
}

/* Cards - Stack vertically */
.card {
    padding: 1.25rem;
    margin-bottom: 1rem;
}

/* Grid - Single column on mobile */
/* Grid - Responsive adjustments */
@media (max-width: 600px) {
    .grid {
        display: grid;
        grid-template-columns: 1fr;
        /* Force single column on mobile */
        gap: 1rem;
    }

    .card {
        padding: 0.75rem;
        /* Más compacto */
    }

    /* Tablas Responsivas */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    table {
        min-width: 600px;
        /* Asegura que la tabla no se colapse demasiado */
        font-size: 13px;
        /* Fuente más pequeña para móviles */
    }

    th,
    td {
        padding: 8px 4px;
        /* Menos padding */
    }

    /* Inputs de hora más compactos */
    input[type="time"] {
        padding: 4px;
        font-size: 12px;
        width: 100px;
    }

    /* Botones más pequeños en móvil */
    .btn,
    .btn-secondary,
    .btn-back,
    .btn-delete {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
        width: 100%;
        /* Ocupar todo el ancho en móvil para mejor toque */
        margin-left: 0 !important;
    }

    .actions-group {
        display: flex;
        flex-direction: column;
        gap: 12px;
        /* Espacio de seguridad entre botones */
    }
}

.btn-delete {
    background-color: var(--color-primary);
    color: white;
}

.btn-delete:hover {
    background-color: #B71C1C;
}

.actions-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Dashboard cards - Better mobile sizing */
.grid .card h3 {
    font-size: 0.95rem !important;
    margin-bottom: 0.5rem;
}

.grid .card p {
    font-size: 1rem !important;
    margin-bottom: 0.5rem;
}

.grid .card small {
    font-size: 0.8rem;
}

/* Forms - Consistent inputs */
input,
select,
textarea {
    width: 100%;
    padding: 1rem;
    font-size: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 1.25rem;
    box-sizing: border-box;
    font-family: var(--font-family);
    transition: border-color 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Buttons - Consistent targets */
.btn,
.btn-secondary,
.btn-back {
    display: inline-block;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
}

@media (max-width: 600px) {
    .grid {
        display: grid;
        grid-template-columns: 1fr;
        /* Force single column on mobile */
        gap: 1rem;
    }

    .card {
        padding: 1rem;
    }
}

/* ========================================
   CATALOG ENHANCEMENTS - MODAL & PURCHASE
   ======================================== */

/* Purchase Button */
.btn-comprar {
    display: block;
    width: 100%;
    padding: 0.5rem 0.7rem;
    background: linear-gradient(135deg, #D32F2F 0%, #B71C1C 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
    text-align: center;
    margin-top: 1rem;
}

.btn-comprar:hover {
    background: linear-gradient(135deg, #B71C1C 0%, #8B0000 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(211, 47, 47, 0.4);
}

.btn-comprar:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}

/* Modal Overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Modal Content */
.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Close Button */
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--color-primary);
}

/* Modal Image */
.modal-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    background-color: #f8f9fa;
}

/* Modal Description */
.modal-description {
    color: #555;
    line-height: 1.8;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Form Modal Specific */
.form-modal {
    max-width: 500px;
}

.form-modal h2 {
    color: var(--color-secondary);
    margin-bottom: 0.5rem;
}

.form-modal label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-text);
}

.form-modal input,
.form-modal textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.form-modal input:focus,
.form-modal textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

/* Product Description Short */
.product-description-short {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    min-height: 3em;
}

/* Image Container Hover Effect */
.product-image-container {
    transition: transform 0.3s ease;
}

.product-image-container:hover {
    transform: scale(1.02);
}

/* Responsive Modal Adjustments */
@media (max-width: 600px) {
    .modal-content {
        padding: 1.5rem;
        width: 95%;
        max-height: 95vh;
    }

    .modal-image {
        max-height: 250px;
    }

    .btn-comprar {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
    }

    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* ========================================
   SHOPPING CART & SEARCH ENHANCEMENTS
   ======================================== */

/* Cart Icon in Navbar */
.cart-icon-container {
    position: relative;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s ease;
    user-select: none;
}

.cart-icon-container:hover {
    transform: scale(1.1);
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Search Container */
.search-container {
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-container input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    border: 2px solid var(--color-border);
    border-radius: 50px;
    transition: all 0.3s ease;
    font-family: var(--font-family);
}

.search-container input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.1);
}

/* Product Actions (Dual Buttons) */
.product-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-add-cart {
    flex: 1;
    padding: 0.5rem 0.7rem;
    background: white;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-add-cart:hover {
    background: var(--color-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

.btn-comprar {
    flex: 1.5;
}

/* Cart Modal Specific */
.cart-modal {
    max-width: 650px;
}

.cart-modal h2 {
    margin-bottom: 1.5rem;
    color: var(--color-secondary);
}

.cart-item {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile Responsive Improvements */
@media (max-width: 768px) {
    .navbar .container {
        position: relative;
    }

    .cart-icon-container {
        position: absolute;
        right: 60px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
    }

    .cart-icon-container:hover {
        transform: translateY(-50%) scale(1.1);
    }
}

@media (max-width: 600px) {

    /* Search Bar Mobile */
    .search-container {
        margin-bottom: 1.5rem;
    }

    .search-container input {
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
    }

    /* Product Actions Mobile */
    .product-actions {
        flex-direction: column;
        gap: 0.7rem;
    }

    .btn-add-cart,
    .btn-comprar {
        flex: 1;
        width: 100%;
        padding: 0.9rem;
        font-size: 0.95rem;
    }

    /* Cart Modal Mobile */
    .cart-modal {
        padding: 1.2rem;
    }

    .cart-item>div {
        flex-wrap: wrap;
    }

    .cart-item img,
    .cart-item>div>div:first-child {
        width: 50px !important;
        height: 50px !important;
    }

    /* Improve touch targets */
    button {
        min-height: 44px;
    }

    /* Navbar adjustments */
    .cart-icon-container {
        right: 50px;
        font-size: 1.4rem;
    }

    .cart-badge {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
}

/* Empty Cart Message */
.empty-cart-message {
    text-align: center;
    color: #999;
    padding: 2rem;
    font-size: 1.1rem;
}

/* Product Card Improvements */
.product-card {
    transition: all 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Ensure proper spacing on mobile */
@media (max-width: 600px) {
    .container {
        padding: 1rem 0.8rem;
    }

    h1 {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }

    .grid {
        gap: 1.2rem;
        grid-template-columns: 1fr !important;
    }

    .card {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
    }

    .product-image-container {
        height: 220px !important;
        width: 100% !important;
        margin-bottom: 1rem;
    }

    .product-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .product-description-short {
        font-size: 0.9rem;
        min-height: 2.5em;
    }

    /* Fix navbar overflow */
    .navbar .container {
        padding: 0.5rem 0.8rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .navbar-brand img {
        height: 40px !important;
    }
}

/* Additional mobile fixes for very small screens */
@media (max-width: 400px) {
    .product-image-container {
        height: 180px !important;
    }

    .card h3 {
        font-size: 1rem;
    }

    .cart-icon-container {
        right: 45px;
        font-size: 1.3rem;
    }
}