/**
 * Restaurant Menu Manager CSS
 * ------------------------------------------------------------
 * Versión limpia.
 * El formulario Add New Dish queda en UNA sola columna.
 */

:root {
    --bg: #fff8ef;
    --card: #ffffff;
    --text: #21160f;
    --muted: #735f50;
    --brand: #b9411f;
    --brand-dark: #872d18;
    --gold: #e5a22f;
    --line: rgba(91, 56, 33, 0.14);
    --shadow: 0 18px 45px rgba(67, 35, 19, 0.12);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #fff2db 0, var(--bg) 45%, #fff 100%);
    color: var(--text);
}

button,
input,
textarea,
select {
    font: inherit;
}

/* Header */
.admin-header {
    min-height: 260px;
    padding: 44px 22px;
    background: linear-gradient(135deg, rgba(32, 18, 12, .95), rgba(141, 48, 22, .92));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.admin-kicker {
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: .14em;
    font-weight: 900;
    font-size: .82rem;
}

.admin-header h1 {
    margin: 10px 0;
    font-size: clamp(2.4rem, 6vw, 5rem);
    line-height: .95;
    letter-spacing: -0.05em;
}

.admin-header p {
    margin: 0;
    color: rgba(255, 255, 255, .86);
    max-width: 620px;
}

.view-menu-btn {
    flex: 0 0 auto;
    color: #21160f;
    background: #ffffff;
    padding: 13px 22px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 900;
    box-shadow: 0 16px 38px rgba(0, 0, 0, .25);
}

/* Page */
.admin-page {
    width: min(1180px, calc(100% - 28px));
    margin: -34px auto 70px;
    position: relative;
    z-index: 5;
}

.alert {
    padding: 16px 18px;
    border-radius: 18px;
    margin-bottom: 18px;
    font-weight: 800;
    box-shadow: var(--shadow);
}

.success {
    background: #e9fff1;
    border: 1px solid #b7e7c8;
    color: #146032;
}

.error {
    background: #fff0ef;
    border: 1px solid #ffc8c2;
    color: #8b1d12;
}

/* Cards */
.admin-grid,
.admin-grid-single {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    align-items: stretch;
    margin-bottom: 22px;
    width: 100%;
}

.admin-card {
    width: 100%;
    max-width: none;
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.admin-card h2,
.modal-box h2 {
    margin: 0 0 10px;
    font-size: 1.55rem;
}

.helper {
    color: var(--muted);
    margin: 0 0 18px;
    line-height: 1.45;
}

/* Forms - always one column */
.admin-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
}

.admin-form > * {
    grid-column: 1 / -1;
    width: 100%;
}

.admin-form label {
    font-weight: 900;
    color: var(--text);
}

.admin-form input[type="text"],
.admin-form input[type="file"],
.admin-form textarea,
.admin-form select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 13px 14px;
    background: #fffaf2;
    color: var(--text);
}

.admin-form textarea {
    resize: vertical;
    min-height: 100px;
}

.category-choice,
.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.radio-pill,
.checks label {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff6e8;
    border: 1px solid rgba(185, 65, 31, .16);
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 800;
}

/* Buttons */
.primary-btn,
.secondary-btn,
.cancel-btn,
.edit-item-btn,
.edit-category-btn,
.delete-btn {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 950;
    cursor: pointer;
    text-decoration: none;
}

.primary-btn {
    width: 100%;
    color: #ffffff;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    box-shadow: 0 14px 30px rgba(185, 65, 31, .25);
}

.secondary-btn {
    color: #ffffff;
    background: #111111;
}

.cancel-btn {
    color: var(--text);
    background: #f1e5d6;
}

.edit-item-btn,
.edit-category-btn {
    color: var(--brand-dark);
    background: #fff6e8;
    border: 1px solid rgba(185, 65, 31, .16);
}

.delete-btn {
    color: #a32217;
    background: #fff0ef;
    border: 1px solid #ffd0ca;
}

.locked-delete {
    display: inline-flex;
    align-items: center;
    padding: 9px 13px;
    border-radius: 999px;
    background: #f2eee9;
    color: #7c6d60;
    font-weight: 850;
    font-size: .9rem;
}

/* Images */
.current-image {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff6e8;
    border-radius: 18px;
    padding: 10px;
    color: var(--muted);
    font-size: .9rem;
}

.current-image img {
    width: 76px;
    height: 62px;
    object-fit: cover;
    border-radius: 14px;
    background: #f1e5d6;
}

/* Current menu list */
.menu-list-admin {
    margin-top: 8px;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.admin-group {
    border-top: 1px solid var(--line);
    padding: 20px 0;
}

.admin-group:first-of-type {
    border-top: 0;
}

.admin-group-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}

.admin-group-head h3 {
    margin: 0;
    font-size: 1.35rem;
}

.admin-group-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.admin-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-items {
    display: grid;
    gap: 12px;
}

.admin-item {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 14px;
    align-items: center;
    background: #fffaf2;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
}

.admin-item img {
    width: 90px;
    height: 78px;
    object-fit: cover;
    border-radius: 14px;
    background: #f1e5d6;
}

.admin-item strong,
.admin-item span,
.admin-item b,
.admin-item small {
    display: block;
}

.admin-item strong {
    font-size: 1.05rem;
}

.admin-item span {
    color: var(--muted);
    margin: 4px 0;
    line-height: 1.35;
}

.admin-item b {
    color: var(--brand);
    font-size: 1.1rem;
}

.admin-item small {
    color: var(--muted);
    margin-top: 3px;
}

.empty {
    color: var(--muted);
    background: #fff6e8;
    border-radius: 16px;
    padding: 14px;
    margin: 0;
}

.empty.small {
    font-size: .93rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(24, 12, 5, .62);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.is-open {
    display: flex;
}

.modal-box {
    width: min(760px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #ffffff;
    border-radius: 26px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
    padding: 24px;
    position: relative;
}

.small-modal {
    width: min(560px, 100%);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    border: 0;
    background: #fff0ef;
    color: #a32217;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* Responsive */
@media (max-width: 820px) {
    .admin-header {
        display: block;
        min-height: auto;
    }

    .view-menu-btn {
        display: inline-flex;
        margin-top: 22px;
    }

    .admin-item {
        grid-template-columns: 74px 1fr;
    }

    .admin-item img {
        width: 74px;
        height: 70px;
    }

    .admin-item .admin-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .admin-group-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .admin-card,
    .modal-box {
        padding: 17px;
    }

    .admin-page {
        width: min(100% - 18px, 1180px);
    }

    .primary-btn,
    .secondary-btn,
    .cancel-btn {
        width: 100%;
    }

    .modal-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}