:root {
    /* PALETA K-LIBRE 21 (Dark Theme) */
    --bg-dark: #121212;
    --card-bg: rgba(30, 30, 30, 0.8);
    --primary-yellow: #f1c40f;
    --accent-red: #e74c3c;
    --text-white: #ecf0f1;
    --text-gray: #bdc3c7;

    --success-color: #27ae60;
    --dark-color: #2d3436;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, sans-serif;
    background: radial-gradient(circle at top, #1e1e1e, #000000);
    color: var(--text-white);
    min-height: 100vh;
}

header {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 1px;
}

header nav a {
    color: var(--text-gray);
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9rem;
    transition: color 0.3s;
}

header nav a:hover {
    color: var(--primary-yellow);
}

.container {
    margin: 0 auto;
    padding: 20px;
    max-width: 1200px;
}

/* --- MODULE CARDS (HOME) --- */
.module-card {
    background: var(--card-bg);
    width: 100%;
    /* Flexible */
    max-width: 260px;
    /* Un poco mas ancho si hay espacio */
    min-width: 180px;
    /* Para que no se rompa en pantallas chicas */
    height: 300px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: var(--text-white);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 20px 40px rgba(241, 196, 15, 0.2);
    border-color: rgba(241, 196, 15, 0.5);
    background: rgba(40, 40, 40, 0.9);
}

.module-card .icon {
    font-size: 4.5rem;
    margin-bottom: 25px;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s;
}

.module-card:hover .icon {
    transform: scale(1.1) rotate(5deg);
}

.module-card h3 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--primary-yellow);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.module-card p {
    color: var(--text-gray);
    font-size: 0.9rem;
    font-weight: 300;
}

.module-card:nth-child(1) {
    border-bottom: 4px solid var(--primary-yellow);
}

.module-card:nth-child(2) {
    border-bottom: 4px solid var(--accent-red);
}

.module-card:nth-child(3) {
    border-bottom: 4px solid var(--success-color);
}

.module-card:nth-child(4) {
    border-bottom: 4px solid #3498db;
}

/* --- POS INTERFACE (PEDIDO) --- */

.order-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    /* Panel productos flexible, panel ticket fijo */
    gap: 30px;
    height: 85vh;
    /* Ocupar casi toda la pantalla */
    overflow: hidden;
}

/* Categorias */
.categories-wrapper {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.categories-wrapper::-webkit-scrollbar {
    height: 6px;
}

.categories-wrapper::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.btn-category {
    background: #333;
    color: #fff;
    border: 1px solid #555;
    padding: 10px 20px;
    border-radius: 50px;
    white-space: nowrap;
    cursor: pointer;
    transition: 0.3s;
}

.btn-category:hover,
.btn-category.active {
    background: var(--primary-yellow);
    color: #000;
    border-color: var(--primary-yellow);
    font-weight: bold;
}

/* Grid Productos */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    padding-right: 10px;
    overflow-y: auto;
    height: 100%;
    padding-bottom: 50px;
    /* Espacio final */
}

.product-grid::-webkit-scrollbar {
    width: 6px;
}

.product-grid::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.product-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 150px;
    /* Un poco más alto por defecto */
    height: 100%;
    /* Ocupar todo el alto de la celda del grid */
}

.product-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: var(--primary-yellow);
}

.product-card h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #eee;
    line-height: 1.3;

    /* Limitar a 3 líneas máx y puntos suspensivos */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card .price {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-yellow);
    margin-top: auto;
    padding-top: 5px;
}

/* Ticket Panel */
.order-summary {
    background: #1e1e1e;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    padding: 20px;
}

.order-items {
    flex: 1;
    overflow-y: auto;
    margin: 15px 0;
    padding-right: 5px;
}

.order-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid var(--primary-yellow);
}

/* GENERAL BUTTONS */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: #333;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: 0.3s;
    border: none;
}

.btn:hover {
    background-color: #444;
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary-yellow);
    color: #000;
    font-weight: bold;
}

.btn-primary:hover {
    background: #f39c12;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
    margin-top: 10px;
}

/* MODALS */
.modal-box {
    background: #1e1e1e !important;
    color: white !important;
    border: 1px solid #333;
}

.modal-title {
    color: var(--primary-yellow) !important;
}

.mesa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.mesa-card {
    height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    border-radius: 15px;
    color: white;
}

.mesa-libre {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.mesa-ocupada {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
}

/* MODAL GLOBAL STYLES */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s;
}

.modal-box {
    background: #1e1e1e;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 1px solid #333;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    color: white;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
}

.modal-title {
    color: var(--primary-yellow);
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}