/* ═══════════════════════════════════════════════════════════════════════════
   Menu Manager Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Sticky toolbar (header + category bar scroll together) ────────────── */
.menu-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    padding-bottom: 18px;
}
/* Fill the content-area padding gap above so scrolled content can't show through */
.menu-sticky-bar::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    height: 30px;
    background: var(--bg-primary);
}
.menu-sticky-bar .menu-header { margin-bottom: 14px; }
.menu-sticky-bar .menu-category-bar { margin-bottom: 0; }

/* ── Page header ───────────────────────────────────────────────────────── */
.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.menu-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.menu-header-left h2 {
    font-size: 15px;
    font-weight: 600;
}

/* ── View Toggle ───────────────────────────────────────────────────────── */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.view-toggle-btn {
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    background: var(--bg-primary);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.12s, color 0.12s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-toggle-btn + .view-toggle-btn {
    border-left: 1px solid var(--border);
}

.view-toggle-btn.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.view-toggle-btn:hover:not(.active) {
    background: var(--bg-secondary);
}

.view-toggle-btn svg { width: 15px; height: 15px; }

/* ── Category filter ───────────────────────────────────────────────────── */
.menu-category-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.category-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s;
}

.category-tag:hover { border-color: var(--border-strong); color: var(--text-primary); }
.category-tag.active { background: var(--text-primary); color: var(--text-white); border-color: var(--text-primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   Table View
   ═══════════════════════════════════════════════════════════════════════════ */
.menu-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.menu-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

.menu-table thead { background: var(--bg-secondary); }

.menu-table th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
}

.menu-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.menu-table tbody tr:last-child td { border-bottom: none; }

.menu-table tbody tr {
    transition: background 0.1s;
}

.menu-table tbody tr:hover { background: var(--bg-secondary); }

.menu-item-name {
    font-weight: 500;
}

.menu-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-item-price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.menu-item-category {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 500;
    display: inline-block;
}

.menu-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Gallery View
   ═══════════════════════════════════════════════════════════════════════════ */
.menu-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.menu-gallery-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.15s;
}

.menu-gallery-card:hover { border-color: var(--border-strong); }

.gallery-card-img {
    width: 100%;
    height: 120px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    font-size: 28px;
}

.gallery-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gallery-card-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.gallery-card-category {
    font-size: 12px;
    color: var(--text-secondary);
}

.gallery-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.gallery-card-price {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.gallery-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Unavailable overlay ───────────────────────────────────────────────── */
.menu-gallery-card.unavailable .gallery-card-img { opacity: 0.5; }
.menu-gallery-card.unavailable .gallery-card-name { opacity: 0.5; }

.menu-table tbody tr.unavailable td {
    opacity: 0.5;
}
.menu-table tbody tr.unavailable td:last-child {
    opacity: 1;
}

/* ── Modal form specifics ──────────────────────────────────────────────── */
.menu-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Category section headers (table + gallery grouped views)
   ═══════════════════════════════════════════════════════════════════════════ */
.menu-section-header {
    padding: 10px 0 6px;
    margin: 18px 0 8px;
}

.menu-section-header:first-child {
    margin-top: 0;
}

.menu-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    padding: 0 0 6px;
    border-bottom: 1px solid var(--border);
}

/* Category separator row inside the table view */
.menu-table .category-row td {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

.menu-table .category-row:first-child td {
    border-top: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Add-on rows (inside the menu item modal)
   ═══════════════════════════════════════════════════════════════════════════ */
.addon-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.addon-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.addon-row .addon-name {
    flex: 1;
}

.addon-row .addon-price {
    width: 90px;
    flex-shrink: 0;
}

.addon-row .addon-remove {
    flex-shrink: 0;
    color: var(--red);
    padding: 4px 8px;
}

.addon-count-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Image Upload Area (menu item modal)
   ═══════════════════════════════════════════════════════════════════════════ */
.mi-image-upload-area {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mi-image-upload-area:hover {
    border-color: var(--accent);
}

.mi-image-upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.mi-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.mi-image-placeholder svg {
    color: var(--text-tertiary);
}

.mi-image-preview {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.mi-image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius);
}

.mi-image-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s;
}

.mi-image-remove:hover {
    background: var(--red);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Gallery card image (real image support)
   ═══════════════════════════════════════════════════════════════════════════ */
.gallery-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Table view — item thumbnail
   ═══════════════════════════════════════════════════════════════════════════ */
.menu-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-item-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-tertiary);
}

.menu-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.menu-item-text {
    min-width: 0;
}
