/* ============================================================================
   GREY CORNER — ADMIN CONSOLE STYLING (DARK LUXURY DASHBOARD)
   ============================================================================ */

:root {
    --bg: #0A0F1A;
    --card: #121A2A;
    --card-accent: #172237;
    --gold: #C9A84C;
    --gold-dark: #A48332;
    --sc-gold-light: #E2C97E;
    --text: #F8F9FA;
    --muted: rgba(240, 234, 216, 0.45);
    --border: rgba(201, 168, 76, 0.15);
    --success: #2ecc71;
    --alert: #e74c3c;
    --water: #3498db;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    padding: 24px;
}

/* ============================================================================
   1. HEADER & KPI METRICS STYLING
   ============================================================================ */
.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--gold);
}

.admin-badge {
    background: rgba(201, 168, 76, 0.12);
    border: 1px solid var(--border);
    color: var(--sc-gold-light);
    font-family: 'DM Sans', sans-serif;
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    vertical-align: middle;
}

.cleanup-btn {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: var(--alert);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    outline: none;
}

.cleanup-btn:hover {
    background: var(--alert);
    color: #FFFFFF;
}

/* --- KPI Stats Cards --- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.metric-card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.metric-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-icon-wrap svg {
    width: 22px;
    height: 22px;
}

.metric-icon-wrap.bg-gold {
    background: rgba(201, 168, 76, 0.12);
    color: var(--gold);
    border: 1px solid rgba(201, 168, 76, 0.25);
}

.metric-icon-wrap.bg-alert {
    background: rgba(231, 76, 60, 0.12);
    color: var(--alert);
    border: 1px solid rgba(231, 76, 60, 0.25);
}

.metric-icon-wrap.bg-order {
    background: rgba(240, 234, 216, 0.06);
    color: var(--sc-gold-light);
    border: 1px solid rgba(240, 234, 216, 0.15);
}

.metric-icon-wrap.bg-success {
    background: rgba(46, 204, 113, 0.12);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.25);
}

.metric-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 9.5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-val {
    font-family: 'Poppins', sans-serif;
    font-size: 1.45rem;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.1;
}

/* ============================================================================
   2. MAIN SPLITS LAYOUT
   ============================================================================ */
.dashboard-split {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .dashboard-split {
        grid-template-columns: 1fr;
    }
}

.split-left, .split-right {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.panel-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 4px;
}

.panel-header p {
    font-size: 0.82rem;
    color: var(--muted);
}

/* ============================================================================
   3. TABLE GRID MATRIX (LEFT SIDE)
   ============================================================================ */
.table-matrix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.admin-table-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.admin-table-card:hover {
    border-color: var(--gold);
    background: rgba(201, 168, 76, 0.03);
    transform: translateY(-2px);
}

.atc-number {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 4px;
    line-height: 1;
}

.atc-waiter-pill {
    display: inline-block;
    font-family: 'DM Sans', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Color pills depending on state */
.atc-waiter-pill.assigned {
    background: rgba(201, 168, 76, 0.12);
    color: var(--sc-gold-light);
    border: 1px solid rgba(201, 168, 76, 0.25);
}

.atc-waiter-pill.unassigned {
    background: rgba(255,255,255,0.03);
    color: var(--muted);
    border: 1px dashed rgba(255,255,255,0.1);
}

/* Pulsing table card if there's a client alert on this table */
.admin-table-card.table-alert-pending {
    border-color: rgba(231, 76, 60, 0.55);
    background: rgba(231, 76, 60, 0.05);
    animation: atcPulseAlert 1.5s infinite ease-in-out;
}

@keyframes atcPulseAlert {
    0%, 100% { border-color: rgba(231, 76, 60, 0.35); box-shadow: none; }
    50% { border-color: rgba(231, 76, 60, 0.8); box-shadow: 0 0 10px rgba(231, 76, 60, 0.15); }
}

.admin-table-card.table-alert-pending .atc-number {
    color: var(--alert);
}

.alert-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--alert);
    box-shadow: 0 0 6px var(--alert);
}

/* ============================================================================
   4. LIVE CHRONOLOGICAL LOGS FEED (RIGHT SIDE)
   ============================================================================ */
.live-activity-feed {
    height: 380px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.feed-log-row {
    background: rgba(255,255,255,0.015);
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    font-size: 0.85rem;
    animation: feedInsert 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

@keyframes feedInsert {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flr-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.flr-text {
    color: #FFFFFF;
    word-break: break-word;
}

.flr-time {
    font-family: 'Poppins', sans-serif;
    font-size: 7.5px;
    color: var(--muted);
    font-weight: 500;
    text-transform: uppercase;
}

.flr-badge {
    font-family: 'DM Sans', sans-serif;
    font-size: 8px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Log custom colors */
.flr-badge.l-waiter { background: rgba(231, 76, 60, 0.12); color: var(--alert); }
.flr-badge.l-water { background: rgba(52, 152, 219, 0.12); color: var(--water); }
.flr-badge.l-bill { background: rgba(46, 204, 113, 0.12); color: var(--success); }
.flr-badge.l-order { background: rgba(201, 168, 76, 0.12); color: var(--sc-gold-light); }

.feed-log-empty {
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
}

/* ============================================================================
   5. TABLE REASSIGNMENT OVERLAY MODAL
   ============================================================================ */
.assignment-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.assignment-modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 380px;
    padding: 24px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    box-sizing: border-box;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.modal-header h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    outline: none;
}

.modal-close-btn:hover {
    color: #FFFFFF;
}

.assignment-modal p {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 18px;
}

.waiters-list-select {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.w-select-btn {
    height: 44px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    color: #FFFFFF;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    text-align: left;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.w-select-btn:hover {
    border-color: var(--gold);
    background: rgba(201, 168, 76, 0.05);
}

.w-select-btn.active-assigned {
    border-color: var(--gold);
    background: rgba(201, 168, 76, 0.12);
    color: var(--sc-gold-light);
    font-weight: 600;
}

.w-select-btn.unassign-option {
    border-color: rgba(231, 76, 60, 0.2);
    color: var(--alert);
}

.w-select-btn.unassign-option:hover {
    background: rgba(231, 76, 60, 0.08);
}

/* ============================================================================
   6. PREMIUM ZONED SECTIONS (SALON, LOGE, TERRASSE)
   ============================================================================ */
.admin-zones-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.admin-zone-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px;
}

.admin-zone-header {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--sc-gold-light);
    text-transform: uppercase;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(201, 168, 76, 0.15);
    padding-bottom: 6px;
}
/* =========================
   SYSTEM FREEZE MODE
========================= */

.system-freeze-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.system-freeze-overlay.hidden {
    display: none;
}

.freeze-box {
    background: #121a2a;
    border: 1px solid rgba(231,76,60,0.4);
    padding: 24px;
    border-radius: 14px;
    text-align: center;
    max-width: 320px;
}

.freeze-title {
    color: #e74c3c;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.freeze-text {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

/* Freeze button */
.freeze-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(231,76,60,0.3);
    background: transparent;
    color: #e74c3c;
    font-weight: 600;
    cursor: pointer;
}

.freeze-btn:hover {
    background: rgba(231,76,60,0.15);
}

/* --- Live Connection Pill --- */
.connection-pill {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 12px;
    vertical-align: middle;
    transition: all 0.3s ease;
}

.connection-pill.connected {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.connection-pill.disconnected {
    background-color: #3498db;
    box-shadow: 0 0 8px #3498db;
    animation: freezePulse 1.5s infinite alternate;
}

.connection-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
}

@keyframes freezePulse {
    0% { opacity: 0.4; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1.1); }
}

/* System frozen button active state */
.freeze-btn.frozen-active {
    background: rgba(231, 76, 60, 0.25);
    border-color: var(--alert);
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.3);
    animation: freezeBtnGlow 2s infinite alternate;
}

@keyframes freezeBtnGlow {
    0% { box-shadow: 0 0 4px rgba(231, 76, 60, 0.2); }
    100% { box-shadow: 0 0 12px rgba(231, 76, 60, 0.5); }
}

/* Frozen visual table card styles */
.admin-table-card.system-frozen-table {
    border-color: rgba(52, 152, 219, 0.25) !important;
    background: rgba(10, 15, 26, 0.5) !important;
    filter: saturate(0.5);
    opacity: 0.85;
}

.admin-table-card.system-frozen-table .atc-number {
    color: #aeb6bf;
}

/* ============================================================================
   5. ADMIN TABS IN SPLIT-RIGHT
   ============================================================================ */
.admin-tabs-nav {
    display: flex;
    gap: 18px;
}

.admin-tab-btn {
    cursor: pointer;
    font-size: 1.25rem;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    color: var(--muted);
    transition: color 0.2s, border-bottom 0.2s;
    border-bottom: 2px solid transparent;
    padding-bottom: 4px;
}

.admin-tab-btn.active {
    color: #FFFFFF !important;
    border-bottom: 2px solid var(--gold) !important;
}

.admin-tab-panel {
    display: none;
}

.admin-tab-panel.active {
    display: block;
}

.admin-history-item {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.admin-history-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-history-item-table {
    font-weight: 600;
    color: var(--gold);
}

.admin-history-item-status {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}

.admin-history-items-list {
    background: rgba(10, 15, 26, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    padding: 8px 10px;
}

.admin-history-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.admin-history-row:last-child {
    border-bottom: none;
}
