/* ============================================
   Restaurant Analytics — Component Library
   ============================================
   Extends styles.css with standardized, reusable
   patterns used across multiple pages. All colors
   use CSS custom properties from the theme system.

   styles.css provides: buttons, tables, badges,
   status messages, cards, sections, tabs, forms.
   This file ADDS missing components — not replaces.
   ============================================ */


/* -------------------------------------------
   1. Additional Badge Variants
   Used by activity, logs, maintenance, reports
   ------------------------------------------- */

.badge.ok   { background: rgba(34, 197, 94, 0.13);  color: var(--green); }
.badge.warn { background: rgba(245, 158, 11, 0.13); color: var(--amber); }
.badge.fail { background: rgba(239, 68, 68, 0.13);  color: var(--red); }
.badge.info { background: rgba(59, 130, 246, 0.13); color: var(--blue); }
.badge.skip { background: rgba(100, 116, 139, 0.13); color: var(--text-dim); }


/* -------------------------------------------
   2. Controls Bar
   Standardized filter/control row used by
   activity, logs, ordering, reports pages
   ------------------------------------------- */

.controls-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.ctrl-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ctrl-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    white-space: nowrap;
}


/* -------------------------------------------
   3. Modal System
   Unified overlay + dialog for pages that
   need modals (temp_admin, kiosk, ordering).
   Does NOT override existing .modal-overlay
   from styles.css — use these class names for
   new modals or gradual migration.
   ------------------------------------------- */

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    justify-content: center;
    align-items: center;
}

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

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.modal-dialog h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.modal-dialog .modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}


/* -------------------------------------------
   4. Spinner
   Three-dot bounce animation for loading states.
   Usage: <span class="spinner">
            <span class="dot"></span>
            <span class="dot"></span>
            <span class="dot"></span>
          </span>
   ------------------------------------------- */

.spinner {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.spinner .dot {
    width: 8px;
    height: 8px;
    background: var(--text-dim);
    border-radius: 50%;
    animation: spinner-bounce 1.4s infinite ease-in-out both;
}

.spinner .dot:nth-child(1) { animation-delay: -0.32s; }
.spinner .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes spinner-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40%           { transform: scale(1); }
}


/* -------------------------------------------
   5. Empty State
   Centered placeholder for loading or no-data.
   Complements .no-data from styles.css with a
   more structured variant.
   ------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-size: 14px;
}

.empty-state .icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.empty-state .message {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 8px;
}


/* -------------------------------------------
   6. Page Title
   Standalone heading for pages after nav cleanup.
   ------------------------------------------- */

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}


/* -------------------------------------------
   7. Flex / Grid Utilities
   Common layout patterns used across pages.
   ------------------------------------------- */

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.gap-sm { gap: 6px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 20px; }


/* -------------------------------------------
   8. Mobile Overrides
   Ensure new components scale on phones.
   ------------------------------------------- */

@media (max-width: 768px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 12px;
    }

    .modal-dialog {
        padding: 16px;
        max-width: 95%;
        max-height: 85vh;
    }

    .page-title {
        font-size: 20px;
    }
}

.mobile .controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
}

.mobile .modal-dialog {
    padding: 16px;
    max-width: 95%;
    max-height: 85vh;
}

.mobile .ctrl-label {
    font-size: 13px;
}
