/**
 * Smardoo Menu Items — Frontend Styles
 *
 * Namespaced under .smi-wrap to avoid conflicts.
 * Follows the same design conventions as smardoo-booking.css.
 */

/* ==================================================================
   Reset / Base
   ================================================================== */

.smi-wrap *,
.smi-wrap *::before,
.smi-wrap *::after {
    box-sizing: border-box;
}

.smi-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    color: #1e293b;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================================================================
   Notices / Messages
   ================================================================== */

.smi-notice {
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}

.smi-notice--error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.smi-msg {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    display: none;
}

.smi-msg--success {
    display: block !important;
    background: #f0fdf4;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.smi-msg--error {
    display: block !important;
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

/* ==================================================================
   Loading bar
   ================================================================== */

.smi-loading {
    margin-bottom: 16px;
}

.smi-loading__bar {
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 25%, #e2e8f0 50%, #3b82f6 75%);
    background-size: 200% 100%;
    border-radius: 2px;
    animation: smi-loading 1.2s ease-in-out infinite;
}

@keyframes smi-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================================================================
   Buttons
   ================================================================== */

.smi-btn {
    display: inline-block;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.5;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    background: #f1f5f9;
    color: #1e293b;
}

.smi-btn:hover {
    background: #e2e8f0;
}

.smi-btn--primary {
    background: #1e3a5f;
    color: #fff;
}

.smi-btn--primary:hover {
    background: #162d4a;
}

.smi-btn--secondary {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
}

.smi-btn--secondary:hover {
    background: #e2e8f0;
}

.smi-btn--danger {
    background: #ef4444;
    color: #fff;
}

.smi-btn--danger:hover {
    background: #dc2626;
}

.smi-btn--ghost {
    background: transparent;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.smi-btn--ghost:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.smi-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* ==================================================================
   Tabs
   ================================================================== */

.smi-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 0;
    padding: 0;
}

.smi-tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    background: none;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.smi-tab:hover {
    color: #1e3a5f;
}

.smi-tab--active {
    color: #1e3a5f;
    border-bottom-color: #1e3a5f;
}

.smi-tab-panel {
    display: none;
    padding: 24px 0;
}

.smi-tab-panel--active {
    display: block;
}

/* ==================================================================
   Panel header
   ================================================================== */

.smi-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.smi-panel-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
}

/* ==================================================================
   Form card
   ================================================================== */

.smi-form-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.smi-form-card h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e3a5f;
}

.smi-field {
    margin-bottom: 14px;
}

.smi-field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: #334155;
}

.smi-field input[type="text"],
.smi-field input[type="number"],
.smi-field input[type="url"],
.smi-field textarea,
.smi-field select {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    transition: border-color 0.2s;
}

.smi-field input:focus,
.smi-field textarea:focus,
.smi-field select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.smi-field textarea {
    resize: vertical;
    min-height: 60px;
}

.smi-field small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #94a3b8;
}

.smi-field-row {
    display: flex;
    gap: 16px;
}

.smi-field-row .smi-field {
    flex: 1;
}

.smi-req {
    color: #ef4444;
}

.smi-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

/* ==================================================================
   Filter bar
   ================================================================== */

.smi-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.smi-filter-bar label {
    font-weight: 600;
    font-size: 13px;
    color: #475569;
}

.smi-filter-bar select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #1e293b;
}

/* ==================================================================
   Tables
   ================================================================== */

.smi-table-wrap {
    overflow-x: auto;
}

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

.smi-table th {
    text-align: left;
    padding: 10px 12px;
    background: #f1f5f9;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.smi-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.smi-table tr:hover td {
    background: #f8fafc;
}

.smi-table .smi-item-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
}

.smi-table .smi-actions {
    display: flex;
    gap: 6px;
}

.smi-table .smi-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.smi-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 15px;
}

/* ==================================================================
   Checkbox group (labels)
   ================================================================== */

.smi-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.smi-checkbox-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 0;
    line-height: 1;
}

.smi-checkbox-group input[type="checkbox"] {
    width: 15px;
    height: 15px;
    min-width: 15px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    vertical-align: middle;
}

/* ==================================================================
   Image upload
   ================================================================== */

#smi-image-preview img {
    max-width: 180px;
    max-height: 180px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

/* ==================================================================
   Labels / Badges
   ================================================================== */

.smi-item-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.smi-label {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.smi-vis-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.smi-vis-badge--yes {
    background: #f0fdf4;
    color: #16a34a;
}

.smi-vis-badge--no {
    background: #fef2f2;
    color: #dc2626;
}

.smi-label--spicy       { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.smi-label--vegetarian  { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }
.smi-label--vegan       { background: #f0fdf4; color: #15803d; border: 1px solid #4ade80; }
.smi-label--gluten-free { background: #fffbeb; color: #d97706; border: 1px solid #fcd34d; }
.smi-label--light       { background: #f8fafc; color: #64748b; border: 1px solid #cbd5e1; }
.smi-label--organic     { background: #ecfdf5; color: #059669; border: 1px solid #6ee7b7; }

.smi-allergen-badge {
    display: inline-block;
    padding: 3px 10px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* ==================================================================
   Public menu — category filter bar
   ================================================================== */

.smi-cat-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.smi-cat-filter-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.smi-cat-filter-btn:hover {
    border-color: #1e3a5f;
    color: #1e3a5f;
}

.smi-cat-filter--active {
    background: #1e3a5f;
    border-color: #1e3a5f;
    color: #fff;
}

.smi-cat-filter--active:hover {
    background: #162d4a;
    color: #fff;
}

/* ==================================================================
   Public menu — toolbar
   ================================================================== */

.smi-view-toggle {
    display: flex;
    gap: 0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
}

.smi-view-toggle-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: background 0.2s;
}

.smi-view-toggle-btn:hover {
    background: #f1f5f9;
}

.smi-view-toggle--active {
    background: #1e3a5f;
    color: #fff;
}

.smi-view-toggle--active:hover {
    background: #162d4a;
}

/* ==================================================================
   Public menu — header
   ================================================================== */

.smi-menu-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
}

.smi-menu-business-name {
    font-size: 28px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
}

/* ==================================================================
   Public menu — items grid
   ================================================================== */

.smi-menu-items.smi-view-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.smi-menu-items.smi-view-list {
    display: block;
}

.smi-menu-items.smi-view-list .smi-menu-item {
    display: flex;
    flex-direction: row;
    gap: 16px;
    margin-bottom: 16px;
}

.smi-menu-items.smi-view-list .smi-item-image {
    width: 120px;
    min-width: 120px;
}

.smi-menu-items.smi-view-list .smi-item-image img {
    height: 120px;
}

/* Category section within grid */
.smi-menu-category-section {
    /* Used for JS filtering */
}

.smi-view-grid .smi-menu-category-section {
    display: contents;
}

/* Item card */
.smi-menu-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.smi-menu-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.smi-view-list .smi-menu-item {
    flex-direction: row;
}

.smi-item-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f8fafc;
}

.smi-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.smi-view-list .smi-item-image {
    width: 120px;
    min-width: 120px;
    height: 120px;
}

.smi-view-list .smi-item-image img {
    height: 120px;
}

.smi-item-body {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.smi-view-list .smi-item-body {
    padding: 12px 16px;
}

.smi-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.smi-item-name {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.smi-item-price {
    font-size: 16px;
    font-weight: 700;
    color: #1e3a5f;
    white-space: nowrap;
}

.smi-item-category-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 8px;
}

.smi-item-description {
    font-size: 13px;
    color: #64748b;
    margin: 6px 0;
    line-height: 1.5;
}

.smi-item-detail {
    font-size: 12px;
    color: #475569;
    margin-top: 6px;
}

.smi-item-detail strong {
    font-weight: 600;
}

.smi-item-allergens {
    margin-top: 6px;
}

/* ==================================================================
   Single item card
   ================================================================== */

.smi-single-item-card {
    display: flex;
    gap: 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    padding: 24px;
}

.smi-single-item-image {
    flex: 0 0 300px;
}

.smi-single-item-image img {
    width: 100%;
    border-radius: 8px;
}

.smi-single-item-body {
    flex: 1;
}

.smi-single-item-body h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.smi-single-item-description {
    font-size: 15px;
    color: #64748b;
    margin: 12px 0;
    line-height: 1.7;
}

.smi-single-item-section {
    margin-top: 16px;
}

.smi-single-item-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    margin: 0 0 4px 0;
}

.smi-single-item-section p {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

/* ==================================================================
   Translations tab
   ================================================================== */

#smi-trans-list {
    margin-top: 12px;
}

.smi-trans-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
}

.smi-trans-item span {
    font-size: 14px;
    font-weight: 500;
}

.smi-trans-locale {
    display: inline-block;
    padding: 2px 8px;
    background: #1e3a5f;
    color: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 8px;
}

/* ==================================================================
   Responsive
   ================================================================== */

@media (max-width: 1024px) {
    .smi-menu-items.smi-view-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .smi-tabs {
        flex-direction: column;
        border-bottom: none;
        gap: 0;
    }

    .smi-tab {
        border-bottom: 1px solid #e2e8f0;
        margin-bottom: 0;
    }

    .smi-tab--active {
        border-bottom-color: #1e3a5f;
    }

    .smi-field-row {
        flex-direction: column;
        gap: 0;
    }

    .smi-menu-items.smi-view-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .smi-single-item-card {
        flex-direction: column;
    }

    .smi-single-item-image {
        flex: none;
    }

    .smi-cat-filters {
        gap: 6px;
    }

    .smi-cat-filter-btn {
        font-size: 12px;
        padding: 5px 12px;
    }
}

@media (max-width: 480px) {
    .smi-wrap {
        padding: 12px;
    }

    .smi-menu-items.smi-view-grid {
        grid-template-columns: 1fr;
    }

    .smi-panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .smi-table {
        font-size: 12px;
    }

    .smi-table th,
    .smi-table td {
        padding: 6px 8px;
    }

    .smi-menu-business-name {
        font-size: 22px;
    }
}

/* ==================================================================
   Featured badge
   ================================================================== */

.smi-menu-item--featured {
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px #fbbf24;
}

.smi-featured-badge {
    color: #f59e0b;
    font-size: 18px;
    margin-right: 4px;
    vertical-align: middle;
}

/* ==================================================================
   Language selector
   ================================================================== */

.smi-lang-select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
}

.smi-lang-select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================================================================
   Opening hours badge
   ================================================================== */

.smi-hours-badge {
    display: inline-block;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 20px;
    margin-top: 8px;
}

.smi-hours-badge--open {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #86efac;
}

.smi-hours-badge--closed {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

/* ==================================================================
   Modifier display
   ================================================================== */

.smi-item-modifiers {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

.smi-item-modifier {
    font-size: 12px;
    color: #475569;
    margin-bottom: 4px;
    line-height: 1.5;
}

.smi-item-modifier strong {
    font-weight: 600;
    color: #334155;
}

.smi-modifier-choices {
    color: #64748b;
}

/* ==================================================================
   Menu toolbar (public)
   ================================================================== */

.smi-menu-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.smi-menu-toolbar .smi-view-toggle {
    flex-shrink: 0;
}

/* ==================================================================
   Dashboard — extra tabs / panels
   ================================================================== */

.smi-hours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.smi-hours-day {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.smi-hours-day label {
    font-weight: 600;
    font-size: 13px;
    min-width: 80px;
    color: #334155;
}

.smi-hours-day input[type="time"] {
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 13px;
}

.smi-hours-day input[type="checkbox"] {
    margin-right: 4px;
}

.smi-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.smi-analytics-card {
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    text-align: center;
}

.smi-analytics-card h4 {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.smi-analytics-card .smi-analytics-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e3a5f;
}

/* ==================================================================
   Pagination
   ================================================================== */

.smi-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 16px;
}

.smi-pagination button {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    color: #475569;
    cursor: pointer;
}

.smi-pagination button:hover {
    background: #f1f5f9;
}

.smi-pagination .smi-page--active {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}
