/* ── Variables ───────────────────────────────────────────── */
:root {
    --color-texto:      #1a1c2c;
    --color-rojo:       #e31b23;
    --color-rojo-hover: #b3141a;
    --color-verde:      #27ae60;
}

/* ── Layout base ─────────────────────────────────────────── */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: #f7f7f8;
    color: var(--color-texto);
}

main {
    flex: 1;
    padding: clamp(1rem, 3vw, 2.5rem);
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* ── Cabecera ────────────────────────────────────────────── */
.menu-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    margin-bottom: 20px;
}

.menu-header-texto h1 {
    font-size: clamp(1.4rem, 2.5vw, 1.8rem);
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--color-texto);
}

.menu-header-texto p {
    font-size: 0.9rem;
    font-weight: 400;
    color: #666;
    margin: 0;
}

.menu-badge-total {
    background: var(--color-rojo);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 50px;
    white-space: nowrap;
    display: none;
    flex-shrink: 0;
}

.menu-badge-total.visible { display: block; }

/* ── Avisos ──────────────────────────────────────────────── */
.aviso-error {
    background: #fdecea;
    color: #c62828;
    border: 1px solid #ef9a9a;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    font-size: 0.88rem;
}

.aviso-ok {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.88rem;
}

/* ── Lista de platos ─────────────────────────────────────── */
.lista-comidas {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding-left: 40px;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .lista-comidas { padding-left: 0; }
}

/* ── Tarjeta individual ──────────────────────────────────── */
.item-comida {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px 22px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,.04);
    transition: box-shadow .2s, transform .15s;
    width: 100%;
    box-sizing: border-box;
}

.item-comida:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,.09);
    transform: translateY(-2px);
}

/* ── Imagen ──────────────────────────────────────────────── */
.item-comida img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    background: #f0f0f0;
    flex-shrink: 0;
}

/* ── Info del plato ──────────────────────────────────────── */
.item-info {
    flex: 1;
    min-width: 0;
}

.item-info .nombre {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-texto);
    margin: 0 0 4px;
}

.item-info .descripcion {
    font-size: 0.83rem;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 8px;
}

/* ── Badge ───────────────────────────────────────────────── */
.badge-categoria {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 20px;
    padding: 2px 10px;
    background: #e8f5e9;
    color: #2e7d32;
}

/* ── Bloque precio + acción ──────────────────────────────── */
.item-accion {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
}

.item-accion .precio {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-texto);
    white-space: nowrap;
    min-width: 56px;
    text-align: right;
}

/* ── Botón "+" ───────────────────────────────────────────── */
.btn-pedir {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--color-rojo);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 300;
    border-radius: 50%;
    transition: background .18s, transform .14s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-pedir:hover {
    background: var(--color-rojo-hover);
    transform: scale(1.1);
}

/* ── Contador inline ─────────────────────────────────────── */
.contador-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--color-texto);
    border-radius: 50px;
    padding: 5px 10px;
}

.btn-menos-inline,
.btn-mas-inline {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-weight: 700;
    transition: background .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-menos-inline:hover,
.btn-mas-inline:hover { background: rgba(255,255,255,.28); }

.contador-inline span {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    color: #fff;
}

/* ── Estado vacío ────────────────────────────────────────── */
.vacio {
    text-align: center;
    color: #ccc;
    font-size: 1rem;
    padding: 80px 20px;
}

/* ── Modal overlay ───────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 28, 44, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.activo { display: flex; }

/* ── Caja del modal ──────────────────────────────────────── */
.modal {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px 26px;
    width: min(460px, 92vw);
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    position: relative;
    animation: aparece .22s ease;
}

@keyframes aparece {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 20px;
    padding-right: 28px;
    color: var(--color-texto);
}

.modal label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.label-req {
    color: var(--color-rojo);
    font-weight: 700;
}

/* ── Campo fecha ─────────────────────────────────────────── */
.fecha-input-wrap {
    display: flex;
    align-items: center;
    background: #f4f5f9;
    border: 1.5px solid #e4e6f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 7px;
    transition: border-color .2s, box-shadow .2s;
}

.fecha-input-wrap:focus-within {
    border-color: var(--color-rojo);
    box-shadow: 0 0 0 3px rgba(227,27,35,.09);
    background: #fff;
}

.fecha-icono {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    background: var(--color-texto);
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.fecha-input-wrap input[type="date"] {
    flex: 1;
    border: none;
    background: transparent;
    padding: 11px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--color-texto);
    cursor: pointer;
    min-width: 0;
    box-sizing: border-box;
}

.fecha-input-wrap input[type="date"]:focus {
    outline: none;
}

.modal-fecha-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    color: #767676;
    margin: 0 0 18px;
}

.modal textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--color-texto);
    background: #f9f9f9;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
    margin-bottom: 18px;
    resize: vertical;
    min-height: 80px;
}

.modal textarea:focus {
    outline: none;
    border-color: var(--color-rojo);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(227, 27, 35, 0.1);
}

/* ── Pie del modal ───────────────────────────────────────── */
.modal-pie {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.contador-modal {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #eef0f5;
    border-radius: 50px;
    padding: 6px 12px;
    flex-shrink: 0;
}

.cantidad-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #666;
}

.btn-menos,
.btn-mas {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s, transform .1s;
}

.btn-menos { background: var(--color-rojo); }
.btn-mas   { background: var(--color-verde); }

.btn-menos:hover,
.btn-mas:hover { opacity: .82; transform: scale(1.08); }

.contador-modal > span {
    font-size: 1rem;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    color: var(--color-texto);
}

/* ── Botón confirmar ─────────────────────────────────────── */
.btn-confirmar {
    flex: 1;
    padding: 12px;
    background: var(--color-texto);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .1s;
}

.btn-confirmar:hover {
    background: #2c3060;
    transform: translateY(-1px);
}

/* ── Botón cerrar modal ──────────────────────────────────── */
.btn-cerrar-modal {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: #ccc;
    transition: color .2s;
}

.btn-cerrar-modal:hover { color: var(--color-texto); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    main { padding: 20px 20px 40px; }
    .item-comida { gap: 12px; padding: 12px 16px; }
    .item-comida img { width: 56px; height: 56px; }
}

@media (max-width: 480px) {
    main { padding: 16px 14px 32px; }
    .item-accion { gap: 10px; }
    .modal-pie { flex-direction: column; align-items: stretch; }
    .contador-modal { justify-content: center; }
}
