/* ============================================
   SHARED MODAL STYLES
   Standard modal styling for all in-app modals
   ============================================ */

/* Modal Overlay - Background */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    /* Chrome mobile: 100vh includes the area beneath the URL/back/forward bar,
       so part of the overlay (and any modal pinned to its bottom) gets hidden
       behind it. 100dvh tracks the visible viewport. */
    height: 100dvh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    /* Use viewport-aware padding so the modal never overflows the visible
       viewport on mobile (URL bar, notch, etc.). On small screens we tighten
       horizontal padding so wider forms have room to breathe. */
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top, 0));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0));
    box-sizing: border-box;
}

/* Modal Container - Base */
/* All modal container class aliases are unified here for consistency */
.modal,
.modal-content,
.modal-dialog,
.settings-modal {
    position: relative;
    background: var(--bg-card, #1a1a2e);
    border-radius: 18px;
    width: 100%;
    max-width: 520px;
    /* Cap height to the visible viewport minus the overlay padding so the
       modal never has its top or bottom clipped on mobile Chrome. */
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow: hidden;
    /* Promote to its own stacking/paint context so the rounded corner mask is
       applied AFTER the gradient header paints. Without this, mobile WebKit /
       Blink can render the gradient slightly past the rounded clip. */
    isolation: isolate;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    margin: auto;
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Size Variants */
.modal-sm, .modal-content.modal-sm, .modal-dialog.modal-sm, .settings-modal.modal-sm {
    max-width: 400px;
}

.modal-md, .modal-content.modal-md, .modal-dialog.modal-md, .settings-modal.modal-md {
    max-width: 520px;
}

.modal-lg, .modal-content.modal-lg, .modal-dialog.modal-lg, .settings-modal.modal-lg {
    max-width: 650px;
}

.modal-xl, .modal-content.modal-xl, .modal-dialog.modal-xl, .settings-modal.modal-xl {
    max-width: 800px;
}

/* Modal Header - Gradient */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    flex-shrink: 0;
    /* Match parent radius on the top edge so the gradient is crisply clipped
       to the rounded corners (some mobile browsers leave a 1px hairline
       artifact when the parent alone provides border-radius + overflow:hidden). */
    border-radius: 18px 18px 0 0;
}

/* Modal Header - Danger Variant */
.modal-header.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Modal Header - Success Variant */
.modal-header.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Modal Header - Warning Variant */
.modal-header.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Modal Title */
.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: white;
    font-weight: 600;
}

.modal-header p {
    margin: 4px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

/* Modal Title Section (with icon) */
.modal-title-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-icon {
    font-size: 28px;
    background: rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Close Button - Standard */
.modal-close,
.close-btn,
.modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.modal-close:hover,
.close-btn:hover,
.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Modal Body */
.modal-body {
    padding: 24px;
    padding-bottom: 28px; /* Extra bottom space so last element isn't clipped at scroll edge */
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Ensure last interactive element in modal body has breathing room */
.modal-body > :last-child {
    margin-bottom: 4px;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    background: var(--bg-secondary, rgba(255, 255, 255, 0.02));
    flex-shrink: 0;
    flex-wrap: wrap;
    /* Mirror the header's explicit corner clip so the footer background
       doesn't bleed past the modal's rounded bottom edge on mobile. */
    border-radius: 0 0 18px 18px;
}

/* ============================================
   FORM ELEMENTS IN MODALS
   Polished, consistent form styling
   ============================================ */

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group > label:first-child {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.form-group .required {
    color: #ef4444;
    font-weight: 700;
    margin-left: 2px;
}

/* Form hint text below inputs */
.form-group .form-hint,
.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted, rgba(255, 255, 255, 0.45));
    margin-top: 6px;
    line-height: 1.4;
}

/* Unified input styling for all form controls */
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group textarea,
.form-group select,
.form-control,
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #ffffff);
    box-sizing: border-box;
}

/* Styled select dropdowns */
.form-group select,
.form-input[type="select"],
select.form-input,
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

/* Hover state */
.form-group input:not([type="checkbox"]):not([type="radio"]):hover,
.form-group textarea:hover,
.form-group select:hover,
.form-control:hover,
.form-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--bg-secondary, rgba(255, 255, 255, 0.06));
}

/* Focus state */
.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group textarea:focus,
.form-group select:focus,
.form-control:focus,
.form-input:focus {
    outline: none;
    border-color: var(--accent-primary, var(--brand-primary));
    box-shadow: 0 0 0 3px var(--brand-primary-light);
    background: var(--bg-secondary, rgba(255, 255, 255, 0.06));
}

/* Placeholder styling */
.form-group input::placeholder,
.form-group textarea::placeholder,
.form-control::placeholder,
.form-input::placeholder {
    color: var(--text-muted, rgba(255, 255, 255, 0.35));
}

/* Light mode form controls in modals */
[data-theme="light"] .form-group input:not([type="checkbox"]):not([type="radio"]),
[data-theme="light"] .form-group textarea,
[data-theme="light"] .form-group select,
[data-theme="light"] .modal-content .form-control,
[data-theme="light"] .modal-content .form-input,
[data-theme="light"] .settings-modal .form-control,
[data-theme="light"] .settings-modal .form-input,
[data-theme="light"] .modal-dialog .form-control,
[data-theme="light"] .modal-dialog .form-input {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .form-group input::placeholder,
[data-theme="light"] .form-group textarea::placeholder,
[data-theme="light"] .form-control::placeholder,
[data-theme="light"] .form-input::placeholder {
    color: #94a3b8;
}

[data-theme="light"] .form-group input:not([type="checkbox"]):not([type="radio"]):hover,
[data-theme="light"] .form-group textarea:hover,
[data-theme="light"] .form-group select:hover,
[data-theme="light"] .form-control:hover,
[data-theme="light"] .form-input:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

[data-theme="light"] .form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236366f1' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-color: #ffffff;
}

[data-theme="light"] .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
[data-theme="light"] .form-group textarea:focus,
[data-theme="light"] .form-group select:focus,
[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: #ffffff;
}

[data-theme="light"] .form-group > label:first-child {
    color: #475569;
}

[data-theme="light"] .form-hint {
    color: #64748b;
}

[data-theme="light"] .form-group select option {
    background-color: #ffffff;
    color: #1e293b;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted, #64748b);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 3-column form row for compact layouts */
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* Inline checkbox row at bottom of forms - sits beside other fields */
.form-row-inline {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row-inline > .form-group {
    flex: 1;
    min-width: 120px;
}

.form-row-inline > .form-group-check {
    display: flex;
    align-items: center;
    padding-bottom: 10px; /* Align with the center of adjacent inputs */
    white-space: nowrap;
}

/* ============================================
   CHECKBOX STYLING
   ============================================ */

.checkbox-row {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    padding-top: 4px;
}

/* .checkbox-label styles are in forms.css (single source of truth) */

/* ============================================
   MODAL BUTTONS
   ============================================ */

/*
 * Footer buttons: shared sizing + a min-width so paired buttons
 * (Cancel / Save, Cancel / Create, etc.) line up visually inside the
 * modal-footer, regardless of label length.
 *
 * Colour variants (.btn-primary, .btn-secondary, .btn-danger, .btn-success,
 * .btn-cancel, .btn-save) are owned by buttons.css — the canonical button
 * stylesheet. The modal-scoped rules below ONLY add the modal-specific lift
 * effect on hover; they intentionally do NOT redeclare the base colours so
 * we don't shadow buttons.css globally.
 */
.modal-footer .btn,
.modal .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    min-width: 90px;
}

.modal-footer .btn-save:hover:not(:disabled),
.modal-footer .btn-primary:hover:not(:disabled),
.modal .btn-save:hover:not(:disabled),
.modal .btn-primary:hover:not(:disabled) {
    box-shadow: 0 8px 16px var(--brand-shadow);
    transform: translateY(-1px);
}

.modal-footer .btn-danger:hover:not(:disabled),
.modal .btn-danger:hover:not(:disabled) {
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.modal-footer .btn-success:hover:not(:disabled),
.modal .btn-success:hover:not(:disabled) {
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

/* ============================================
   LIGHT MODE OVERRIDES
   ============================================ */

[data-theme="light"] .modal-header h2,
[data-theme="light"] .modal-header h3 {
    color: white;
}

[data-theme="light"] .checkbox-label input[type="checkbox"] {
    border-color: #94a3b8;
    background: #f1f5f9;
}

[data-theme="light"] .checkbox-label input[type="checkbox"]:hover {
    border-color: var(--brand-primary);
    background: rgba(99, 102, 241, 0.1);
}

/* Light-mode cancel/secondary inside modal footers — buttons.css owns the
   global look; this only nudges the in-modal contrast slightly lighter. */
[data-theme="light"] .modal-footer .btn-cancel,
[data-theme="light"] .modal-footer .btn-secondary,
[data-theme="light"] .modal .btn-cancel,
[data-theme="light"] .modal .btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .modal-footer .btn-cancel:hover,
[data-theme="light"] .modal-footer .btn-secondary:hover,
[data-theme="light"] .modal .btn-cancel:hover,
[data-theme="light"] .modal .btn-secondary:hover {
    background: #cbd5e1;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .modal,
    .modal-content {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 12px 16px;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        align-items: stretch;
    }

    .modal-footer > * {
        margin: 0;
        flex: 1 1 0;
        min-width: 0;
    }

    .modal-footer .btn {
        flex: 1 1 0;
        min-width: 0;
        width: auto;
        padding-left: 8px;
        padding-right: 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-row-3 {
        grid-template-columns: 1fr 1fr;
    }

    .form-row-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row-inline > .form-group-check {
        padding-bottom: 0;
    }
}

/* ============================================
   MENU EDIT MODAL
   Full-featured item editing modal
   ============================================ */

.menu-edit-modal {
    background: var(--bg-card, #1a1a2e);
    border-radius: 20px;
    width: 100%;
    max-width: 700px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    isolation: isolate;
}

/* Inside .menu-edit-modal the gradient header should match the larger 20px
   container radius so corners line up cleanly. */
.menu-edit-modal > .modal-header {
    border-radius: 20px 20px 0 0;
}

.menu-edit-modal > .modal-footer,
.menu-edit-modal > .modal-actions {
    border-radius: 0 0 20px 20px;
}

.menu-edit-modal .modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

/* Modal Sections */
.modal-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.modal-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.modal-section .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    margin: 0 0 18px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-section .section-title i {
    color: var(--accent-primary, var(--brand-primary));
    font-size: 16px;
}

.modal-section .section-subtitle {
    margin: -12px 0 16px 0;
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    font-style: italic;
}

/* Form Grid Layout */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field.full-width {
    grid-column: span 2;
}

.form-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Checkbox / toggle labels inside form-field cells should NOT inherit the
   uppercase field-label styling — they are interactive controls, not titles. */
.form-field label.checkbox-label,
.form-field label.toggle-switch,
.form-field label.switch {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #ffffff);
    text-transform: none;
    letter-spacing: normal;
}

.form-field label.checkbox-label span,
.form-field label.toggle-switch span,
.form-field label.switch span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #ffffff);
    text-transform: none;
    letter-spacing: normal;
}

.form-field input,
.form-field select,
.form-field textarea {
    padding: 12px 14px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-secondary, #12121a);
    color: var(--text-primary, #ffffff);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent-primary, var(--brand-primary));
    box-shadow: 0 0 0 3px var(--brand-primary-light);
}

.form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.form-field textarea {
    resize: vertical;
    min-height: 70px;
}

/* Image + Price/Category horizontal layout */
.image-price-row {
    grid-column: span 2;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.image-price-row .image-section {
    flex-shrink: 0;
}

.image-price-row .price-category-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Input with button inline */
.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
}

.inline-add-btn {
    padding: 10px 16px;
    background: var(--accent-primary, var(--brand-primary));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.inline-add-btn:hover {
    background: var(--accent-hover, #5558e3);
}

/* Settings Grid - Toggle Switches */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    padding: 12px 16px;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
    transition: all 0.2s ease;
}

.setting-toggle:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}

.setting-toggle input[type="checkbox"] {
    display: none;
}

.toggle-visual {
    width: 48px;
    height: 26px;
    background: var(--bg-tertiary, #374151);
    border-radius: 13px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-visual::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.setting-toggle input[type="checkbox"]:checked + .toggle-visual {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
}

.setting-toggle input[type="checkbox"]:checked + .toggle-visual::after {
    left: 25px;
}

.toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
}

.toggle-desc {
    font-size: 12px;
    color: var(--text-muted, #64748b);
}

/* Cook Time Field */
.cook-time-field {
    margin-top: 16px;
}

.cook-time-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cook-time-input-group input {
    max-width: 150px;
}

.cook-time-help {
    font-size: 12px;
    color: var(--text-muted, #64748b);
}

/* Flow Selection */
.flow-selection-container {
    margin-top: 12px;
}

.flow-select {
    width: 100%;
}

.flow-preview {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    border-radius: 10px;
}

.flow-preview label {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    margin-bottom: 10px;
    display: block;
}

.flow-points-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.flow-point-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.05));
    border-radius: 8px;
    border-left: 3px solid;
    font-size: 13px;
}

.flow-point-chip .final-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--success, #10b981);
    color: white;
    border-radius: 4px;
    font-weight: 600;
}

.flow-arrow {
    color: var(--text-muted, #64748b);
    font-size: 12px;
}

.legacy-mode-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
    color: #f59e0b;
    font-size: 13px;
    margin-top: 12px;
}

/* Section Header with Action Button */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-action-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.section-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--brand-shadow);
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--accent-primary, var(--brand-primary));
    color: white;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

/* Modifier Groups List */
.modifier-groups-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modifier-group-card {
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    overflow: hidden;
}

.modifier-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.02));
}

.modifier-group-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modifier-group-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
}

.modifier-group-rules {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rule-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 500;
}

.rule-badge.required {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.rule-badge.selections {
    background: var(--brand-primary-light);
    color: #a5b4fc;
}

.group-remove-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border: none;
    border-radius: 6px;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.group-remove-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.modifier-options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
}

.modifier-option-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.04));
    border-radius: 8px;
    font-size: 13px;
}

.modifier-option-item.unavailable {
    opacity: 0.5;
    text-decoration: line-through;
}

.modifier-option-name {
    color: var(--text-primary, #ffffff);
}

.modifier-price {
    font-size: 12px;
    font-weight: 600;
}

.modifier-price.add {
    color: #10b981;
}

.modifier-price.subtract {
    color: #ef4444;
}

.modifier-inv-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 6px;
    background: var(--brand-primary-light);
    color: #a5b4fc;
    border-radius: 4px;
}

.modifier-edit-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.modifier-edit-btn:hover {
    background: var(--accent-primary, var(--brand-primary));
    border-color: var(--accent-primary, var(--brand-primary));
    color: #ffffff;
}

.modifier-edit-btn i {
    font-size: 12px;
}

.no-modifiers-msg {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted, #64748b);
    font-style: italic;
}

/* Empty Modifiers State */
.empty-modifiers-state {
    text-align: center;
    padding: 30px 20px;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.02));
    border-radius: 12px;
    border: 1px dashed var(--border-color, rgba(255, 255, 255, 0.1));
}

.empty-modifiers-state .empty-icon {
    font-size: 32px;
    color: var(--text-muted, #64748b);
    margin-bottom: 12px;
    display: block;
}

.empty-modifiers-state p {
    color: var(--text-secondary, #94a3b8);
    margin: 0 0 4px 0;
    font-size: 14px;
}

.empty-modifiers-state .empty-hint {
    font-size: 12px;
    color: var(--text-muted, #64748b);
}

/* Legacy Modifiers */
.legacy-modifiers-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color, rgba(255, 255, 255, 0.1));
}

.legacy-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #f59e0b;
    margin-bottom: 10px;
}

.modifier-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.modifier-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.05));
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary, #ffffff);
}

.modifier-tag.legacy {
    border-left: 3px solid #f59e0b;
}

.modifier-tag button {
    background: none;
    border: none;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 1;
}

.modifier-tag button:hover {
    color: #ef4444;
}

/* Inventory Links */
.inventory-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.inventory-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    border-radius: 10px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.inv-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary, #ffffff);
}

.inv-name i {
    color: var(--accent-primary, var(--brand-primary));
}

.inv-qty {
    font-size: 13px;
    color: var(--text-secondary, #94a3b8);
    padding: 4px 10px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.05));
    border-radius: 6px;
}

.inv-actions {
    display: flex;
    gap: 6px;
}

.inv-actions button {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.05));
    border: none;
    border-radius: 6px;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    transition: all 0.2s ease;
}

.inv-actions button:hover {
    background: var(--accent-primary, var(--brand-primary));
    color: white;
}

.inv-actions button:last-child:hover {
    background: #ef4444;
}

.link-inventory-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    border: 1px dashed var(--border-color, rgba(255, 255, 255, 0.15));
    border-radius: 10px;
    color: var(--accent-primary, var(--brand-primary));
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.link-inventory-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary, var(--brand-primary));
}

/* ============================================
   ASSIGN MODIFIER GROUP MODAL
   ============================================ */

.assign-modifier-modal {
    background: var(--bg-card, #1a1a2e);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    max-height: 80dvh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.assign-modifier-modal .modal-header.compact {
    padding: 16px 20px;
}

.modifier-group-select-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
}

.modifier-group-select-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    border: 2px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modifier-group-select-item:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
    border-color: var(--brand-shadow);
}

.modifier-group-select-item.selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary, var(--brand-primary));
}

.modifier-group-select-item input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary, var(--brand-primary));
    cursor: pointer;
}

.group-select-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.group-select-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
}

.group-select-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-item {
    font-size: 12px;
    color: var(--text-muted, #64748b);
}

.meta-badge {
    font-size: 11px;
    padding: 2px 8px;
    background: var(--brand-primary-light);
    color: #a5b4fc;
    border-radius: 5px;
}

.meta-badge.required {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.empty-state-inline {
    text-align: center;
    padding: 30px 20px;
}

.empty-state-inline span {
    font-size: 28px;
    display: block;
    margin-bottom: 12px;
    color: var(--text-muted, #64748b);
}

.empty-state-inline p {
    margin: 0 0 4px 0;
    color: var(--text-secondary, #94a3b8);
    font-size: 14px;
}

.empty-state-inline .hint {
    font-size: 12px;
    color: var(--text-muted, #64748b);
}

/* Flow Section Header */
.form-section-header {
    margin-bottom: 12px;
}

.form-section-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    margin: 0 0 4px 0;
}

.form-section-header h3 i {
    color: var(--accent-primary, var(--brand-primary));
}

.form-section-header small {
    font-size: 12px;
    color: var(--text-muted, #64748b);
}

/* Light Theme Overrides */
[data-theme="light"] .menu-edit-modal,
[data-theme="light"] .assign-modifier-modal {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .form-field input,
[data-theme="light"] .form-field select,
[data-theme="light"] .form-field textarea {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .form-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236366f1' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-color: #ffffff;
}

[data-theme="light"] .setting-toggle,
[data-theme="light"] .modifier-group-card,
[data-theme="light"] .modifier-option-item,
[data-theme="light"] .inventory-link-item,
[data-theme="light"] .modifier-group-select-item {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] .toggle-visual {
    background: #cbd5e1;
}

[data-theme="light"] .empty-modifiers-state,
[data-theme="light"] .flow-preview {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

/* Menu Edit Modal - Mobile Responsive */
@media (max-width: 768px) {
    .menu-edit-modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .menu-edit-modal .modal-body {
        padding: 16px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field.full-width {
        grid-column: span 1;
    }

    .input-with-btn {
        flex-direction: column;
    }

    .inline-add-btn {
        width: 100%;
    }

    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-action-btn {
        width: 100%;
        text-align: center;
    }

    .modifier-group-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .flow-points-preview {
        flex-direction: column;
        align-items: flex-start;
    }

    .flow-arrow {
        transform: rotate(90deg);
    }
}

/* ===== Automation / Fees / Discounts Modal Containers ===== */

.df-edit-modal,
.promo-rule-modal,
.df-override-modal {
    background: var(--bg-card, #1a1a2e);
    border-radius: 20px;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    margin: auto;
}

.df-edit-modal {
    max-width: 520px;
}

.promo-rule-modal {
    max-width: 650px;
}

.df-override-modal {
    max-width: 520px;
}

/* Header color variants */
.modal-header.discount-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.modal-header.fee-header {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ===== Automation Form Components ===== */

.condition-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.condition-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.05));
    border: 2px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 10px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-weight: 500;
}

.condition-btn i {
    font-size: 20px;
}

.condition-btn:hover {
    border-color: var(--accent-primary, var(--brand-primary));
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary, white);
}

.condition-btn.active {
    background: linear-gradient(135deg, var(--accent-primary, var(--brand-primary)) 0%, var(--accent-secondary, var(--brand-secondary)) 100%);
    border-color: var(--accent-primary, var(--brand-primary));
    color: white;
}

/* Multi-select checkbox container */
.multi-select-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.multi-select-container.categories {
    max-height: 200px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 6px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: var(--text-primary, white);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.03));
    user-select: none;
}

.checkbox-item:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--brand-shadow);
}

.checkbox-item.selected {
    background: var(--brand-primary-light);
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--accent-primary, var(--brand-primary));
    font-weight: 500;
}

.checkbox-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    accent-color: var(--accent-primary, var(--brand-primary));
    cursor: pointer;
}

.checkbox-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Days of week selector */
.days-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.day-btn {
    padding: 8px 14px;
    border: 2px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.05));
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.day-btn:hover {
    border-color: var(--accent-primary, var(--brand-primary));
    color: var(--text-primary, white);
}

.day-btn.active {
    background: var(--accent-primary, var(--brand-primary));
    border-color: var(--accent-primary, var(--brand-primary));
    color: white;
}

/* Field hint text */
.field-hint {
    font-size: 11px;
    color: var(--text-muted, rgba(255, 255, 255, 0.4));
    margin-top: 2px;
}

/* Condition settings section */
.condition-settings {
    background: var(--bg-secondary, rgba(255, 255, 255, 0.02));
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

/* Collapsible section */
.modal-section.collapsible .section-title,
.modal-section.collapsible > h3 {
    cursor: pointer;
}

.modal-section.collapsible > h3:hover {
    color: var(--accent-primary, var(--brand-primary));
}

/* Promo rule body scrolling */
.promo-rule-body {
    max-height: calc(90vh - 150px);
    overflow-y: auto;
}

/* Light mode overrides for Automation modals */
[data-theme="light"] .condition-btn {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}

[data-theme="light"] .condition-btn:hover {
    background: #eff6ff;
    border-color: var(--brand-primary);
    color: #1e293b;
}

[data-theme="light"] .condition-btn.active {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    border-color: var(--brand-primary);
    color: white;
}

[data-theme="light"] .multi-select-container {
    border-color: #e2e8f0;
}

[data-theme="light"] .checkbox-item {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
}

[data-theme="light"] .checkbox-item:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

[data-theme="light"] .checkbox-item.selected {
    background: #eff6ff;
    border-color: var(--brand-primary);
    color: var(--brand-primary-active);
}

[data-theme="light"] .day-btn {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}

[data-theme="light"] .day-btn:hover {
    border-color: var(--brand-primary);
    color: #1e293b;
}

[data-theme="light"] .day-btn.active {
    color: white;
}

[data-theme="light"] .condition-settings {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] .field-hint {
    color: #94a3b8;
}

/* Mobile responsive */
@media (max-width: 640.98px) {
    .df-edit-modal,
    .promo-rule-modal,
    .df-override-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .condition-type-selector {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    .days-selector {
        gap: 6px;
    }

    .day-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* ============================================
   PAYMENT MODAL - GUEST MODE BUTTON
   ============================================ */

.payment-modal .modal-header-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.payment-modal .modal-header-content h2 {
    margin: 0;
}

.btn-guest-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-guest-mode:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-guest-mode svg {
    stroke: currentColor;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .btn-guest-mode span {
        display: none;
    }
    
    .btn-guest-mode {
        padding: 8px 10px;
    }
}

/* Guest payment post button */
.guest-post-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 12px;
}

.btn-post-guest {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #10b981;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.btn-post-guest:hover:not(:disabled) {
    background: #059669;
}

.btn-post-guest:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

.guest-paid-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: #10b981;
    font-size: 14px;
    font-weight: 600;
}

.guest-paid-badge svg {
    flex-shrink: 0;
}

/* ============================================
   ON-SCREEN KEYBOARD
   Touch-friendly virtual keyboard for POS
   ============================================ */

.onscreen-kb {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    margin-top: 12px;
    background: var(--bg-tertiary, #f1f5f9);
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.kb-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.kb-key {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #1e293b);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    user-select: none;
    -webkit-user-select: none;
}

.kb-key:hover {
    background: var(--bg-hover, #f1f5f9);
    border-color: var(--accent-primary, var(--brand-primary));
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.kb-key:active {
    transform: translateY(1px);
    box-shadow: none;
    background: var(--accent-primary-light, var(--brand-primary-light));
    border-color: var(--accent-primary, var(--brand-primary));
    color: var(--accent-primary, var(--brand-primary));
}

/* Wide keys (backspace, clear) */
.kb-key-wide {
    min-width: 60px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--text-secondary, #475569);
    background: var(--bg-tertiary, #f1f5f9);
}

.kb-key-wide:hover {
    color: var(--accent-primary, var(--brand-primary));
}

/* Space bar */
.kb-key-space {
    flex: 1;
    max-width: 200px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #475569);
    background: var(--bg-tertiary, #f1f5f9);
}

.kb-key-space:hover {
    color: var(--accent-primary, var(--brand-primary));
}

/* ============================================
   ASSIGNMENT CARD LIST
   Used for Screens & Sections assignment modals
   ============================================ */

.assignment-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted, #64748b);
    font-size: 13px;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.12);
}

.assignment-hint i {
    color: var(--accent-primary, var(--brand-primary));
    font-size: 15px;
    flex-shrink: 0;
}

.assignment-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.assignment-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    transition: all 0.2s ease;
    gap: 12px;
}

.assignment-card.active {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.2);
}

.assignment-card.inactive {
    opacity: 0.6;
}

.assignment-card:hover {
    border-color: var(--brand-shadow);
    background: rgba(99, 102, 241, 0.08);
    opacity: 1;
}

.assignment-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.assignment-card-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--brand-primary-light);
    color: var(--accent-primary, var(--brand-primary));
    transition: all 0.2s ease;
}

.assignment-card.active .assignment-card-icon {
    background: var(--brand-primary-light);
    border-color: rgba(99, 102, 241, 0.25);
}

.assignment-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.assignment-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assignment-card-meta {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 4px;
}

.assignment-card-meta i {
    font-size: 11px;
}

.assignment-card-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Order badge with up/down buttons */
.order-badge-group {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.06));
    border-radius: 10px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    overflow: hidden;
}

.order-adjust-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s ease;
    padding: 0;
}

.order-adjust-btn:hover {
    background: var(--brand-primary-light);
    color: var(--accent-primary, var(--brand-primary));
}

.order-badge-group .order-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-primary, var(--brand-primary));
    border-left: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-right: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    padding: 0 4px;
}

/* Compact toggle switch for assignment cards */
.toggle-switch.compact {
    gap: 0;
}

.toggle-switch.compact .toggle-slider {
    width: 40px;
    height: 22px;
    border-radius: 11px;
}

.toggle-switch.compact .toggle-slider::before {
    width: 16px;
    height: 16px;
    top: 3px;
    left: 3px;
}

.toggle-switch.compact input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* ===== Light Mode Assignment Cards ===== */
[data-theme="light"] .assignment-hint {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.1);
    color: #64748b;
}

[data-theme="light"] .assignment-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .assignment-card.active {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.2);
}

[data-theme="light"] .assignment-card.inactive {
    background: #f8fafc;
}

[data-theme="light"] .assignment-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: rgba(99, 102, 241, 0.06);
}

[data-theme="light"] .assignment-card-icon {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.12);
}

[data-theme="light"] .assignment-card-name {
    color: #1e293b;
}

[data-theme="light"] .assignment-card-meta {
    color: #94a3b8;
}

[data-theme="light"] .order-badge-group {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

[data-theme="light"] .order-adjust-btn {
    color: #94a3b8;
}

[data-theme="light"] .order-adjust-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--brand-primary);
}

[data-theme="light"] .order-badge-group .order-badge {
    color: var(--brand-primary);
    border-color: #e2e8f0;
}

[data-theme="light"] .toggle-switch.compact .toggle-slider {
    background: #cbd5e1;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .assignment-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px;
    }

    .assignment-card-right {
        justify-content: flex-end;
    }
}

/* ============================================
   BUCKET LAYOUT
   Two-panel available/assigned picker
   ============================================ */

.bucket-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 350px;
}

.bucket {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    background: var(--bg-secondary, rgba(255, 255, 255, 0.03));
    overflow: hidden;
}

.bucket-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary, #94a3b8);
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.04));
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.bucket-header i {
    font-size: 16px;
    color: var(--text-muted, #64748b);
}

.bucket-header.assigned {
    color: var(--accent-primary, var(--brand-primary));
    background: rgba(99, 102, 241, 0.06);
    border-bottom-color: rgba(99, 102, 241, 0.12);
}

.bucket-header.assigned i {
    color: var(--accent-primary, var(--brand-primary));
}

.bucket-count {
    margin-left: auto;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-primary, var(--brand-primary));
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    min-width: 24px;
    text-align: center;
}

.bucket-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 400px;
}

.bucket-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.bucket-item:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--brand-primary-light);
}

.bucket-item.assigned {
    cursor: default;
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.1);
}

.bucket-item.assigned:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.18);
}

.bucket-item-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary, var(--brand-primary));
    transition: all 0.2s ease;
}

.bucket-item.assigned .bucket-item-icon {
    background: var(--brand-primary-light);
}

.bucket-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.bucket-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.bucket-item-meta {
    font-size: 12px;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 4px;
}

.bucket-item-meta i {
    font-size: 11px;
}

.bucket-item-order {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-primary, var(--brand-primary));
    background: rgba(99, 102, 241, 0.12);
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.bucket-item-action {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.bucket-item-action.add {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.bucket-item-action.add:hover {
    background: rgba(34, 197, 94, 0.25);
    color: #16a34a;
    transform: scale(1.1);
}

.bucket-item-action.remove {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.bucket-item-action.remove:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #dc2626;
    transform: scale(1.1);
}

.bucket-item-reorder {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.reorder-btn {
    width: 24px;
    height: 18px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
    padding: 0;
}

.reorder-btn:hover:not(.disabled) {
    background: var(--brand-primary-light);
    color: var(--accent-primary, var(--brand-primary));
}

.reorder-btn.disabled {
    opacity: 0.25;
    cursor: default;
}

.bucket-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    color: var(--text-muted, #64748b);
    font-size: 13px;
    text-align: center;
}

.bucket-empty i {
    font-size: 28px;
    opacity: 0.4;
}

/* ===== Light Mode Bucket ===== */
[data-theme="light"] .bucket {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .bucket-header {
    background: #f8fafc;
    border-bottom-color: #e2e8f0;
    color: #475569;
}

[data-theme="light"] .bucket-header i {
    color: #94a3b8;
}

[data-theme="light"] .bucket-header.assigned {
    background: rgba(99, 102, 241, 0.04);
    border-bottom-color: rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .bucket-item:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.12);
}

[data-theme="light"] .bucket-item.assigned {
    background: rgba(99, 102, 241, 0.03);
    border-color: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .bucket-item-icon {
    background: rgba(99, 102, 241, 0.08);
}

[data-theme="light"] .bucket-item-name {
    color: #1e293b;
}

[data-theme="light"] .bucket-item-meta {
    color: #94a3b8;
}

[data-theme="light"] .bucket-empty {
    color: #94a3b8;
}

[data-theme="light"] .reorder-btn {
    color: #94a3b8;
}

[data-theme="light"] .reorder-btn:hover:not(.disabled) {
    background: rgba(99, 102, 241, 0.1);
    color: var(--brand-primary);
}

/* ===== Responsive Bucket ===== */
@media (max-width: 640px) {
    .bucket-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .bucket-list {
        max-height: 250px;
    }
}

/* ==========================================
   Menu Schedule Section (Menus.razor edit modal)
   ========================================== */

/* Base icon-button (was unstyled — round, neutral, square-ish; matches dark theme) */
.btn-icon {
    appearance: none;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    color: var(--text-muted, rgba(255, 255, 255, 0.65));
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn-icon:hover {
    background: var(--bg-secondary, rgba(255, 255, 255, 0.08));
    border-color: var(--accent-primary, var(--brand-primary));
    color: var(--text-primary, #ffffff);
}

.btn-icon.danger {
    color: #f87171;
}

.btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    color: #fca5a5;
}

/* Info banner above the schedule list */
.schedule-info-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 6px;
    color: var(--text-primary, #ffffff);
    font-size: 13px;
    margin-bottom: 12px;
}

.schedule-info-banner i {
    color: var(--accent-primary, var(--brand-primary));
    font-size: 16px;
    flex-shrink: 0;
}

/* List of existing schedules */
.schedules-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.schedule-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    transition: border-color 120ms ease, background-color 120ms ease;
}

.schedule-row:hover {
    border-color: rgba(99, 102, 241, 0.35);
}

.schedule-row.inactive {
    opacity: 0.6;
}

.schedule-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.schedule-name {
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-summary {
    font-size: 12px;
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
}

.schedule-status {
    display: flex;
    align-items: center;
}

.schedule-status .status-badge.inactive {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted, rgba(255, 255, 255, 0.6));
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.schedule-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Empty-state when there are no schedules yet */
.no-schedules-state {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.03));
    border: 1px dashed var(--border-primary, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    margin-bottom: 12px;
}

.no-schedules-state i {
    color: var(--text-muted, rgba(255, 255, 255, 0.45));
}

/* Add/Edit schedule form card */
.add-schedule-section {
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.03)) !important;
}

.add-schedule-section h5 {
    margin-top: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    text-transform: none;
    letter-spacing: 0;
}

.schedule-form-actions {
    justify-content: flex-end;
}

/* Light theme overrides */
[data-theme="light"] .schedule-row {
    background: #ffffff;
    border-color: #e5e7eb;
}

[data-theme="light"] .schedule-row:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

[data-theme="light"] .schedule-name {
    color: #111827;
}

[data-theme="light"] .schedule-summary {
    color: #6b7280;
}

[data-theme="light"] .schedule-info-banner {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.25);
    color: #1f2937;
}

[data-theme="light"] .no-schedules-state {
    background: #f9fafb;
    border-color: #e5e7eb;
}

[data-theme="light"] .add-schedule-section {
    background: #f9fafb !important;
    border-color: #e5e7eb;
}

[data-theme="light"] .add-schedule-section h5 {
    color: #111827;
}

[data-theme="light"] .schedule-status .status-badge.inactive {
    background: #f3f4f6;
    color: #6b7280;
    border-color: #d1d5db;
}

