﻿/* ============================================================
   TABLE STATUS — Style.css
   Card colours derived from the project's status-pill system.
   Available is intentionally distinct from Ready.
============================================================ */

/* ── Page wrapper ─────────────────────────────────────────── */
.tablestatus {
    padding: 20px;
    background: #f6f7f9;
    max-width: 100%;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Header ───────────────────────────────────────────────── */
.ts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

    .ts-header h2 {
        margin: 0;
        font-size: 22px;
    }

.ts-subtitle {
    font-size: 13px;
    color: #777;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-refresh {
    background: #000;
    color: #fff;
    padding: 8px 14px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .btn-refresh:hover {
        background: #333;
    }

/* ── Legend pills ─────────────────────────────────────────── */
.ts-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.legend-pill {
    padding: 0.3rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1.5px solid;
}

    /* Each pill mirrors its status-card colour exactly */
    .legend-pill.available {
        background: #f1f5f9;
        border-color: #94a3b8;
        color: #334155;
    }

    .legend-pill.placed {
        background: #cce5ff;
        border-color: #74b9ff;
        color: #004085;
    }

    .legend-pill.updated {
        background: #f3e8ff;
        border-color: #c084fc;
        color: #6b21a8;
    }

    .legend-pill.preparing {
        background: #fff3cd;
        border-color: #fbbf24;
        color: #856404;
    }

    .legend-pill.serving {
        background: #ffedd5;
        border-color: #fb923c;
        color: #9a3412;
    }

    .legend-pill.cleaning {
        background: #cffafe;
        border-color: #22d3ee;
        color: #155e75;
    }

    .legend-pill.ready {
        background: #d4edda;
        border-color: #7bc89d;
        color: #155724;
    }

/* ── Section card ─────────────────────────────────────────── */
.ts-section-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* ── Loading / Error states ───────────────────────────────── */
.ts-loading,
.ts-error {
    font-size: 14px;
    color: #888;
    padding: 20px 0;
    text-align: center;
}

.ts-error {
    color: #d32f2f;
}

/* ── Table grid ───────────────────────────────────────────── */
.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

/* ── Base card ────────────────────────────────────────────── */
.table-card {
    border-radius: 10px;
    padding: 12px 14px;
    border: 1.5px solid;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .table-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 18px rgba(0,0,0,0.13);
    }

    .table-card.selected {
        box-shadow: 0 0 0 3px #2563eb;
    }

    /* Available — neutral slate; reads as "empty/no one seated",
       completely outside the active-status colour palette */
    .table-card.available {
        background: #f1f5f9;
        border-color: #94a3b8;
    }

    /* Ready — muted sage green; "done, waiting to serve" */
    .table-card.ready {
        background: #d4edda;
        border-color: #7bc89d;
    }

    /* Placed — light blue */
    .table-card.placed {
        background: #cce5ff;
        border-color: #74b9ff;
    }

    /* Updated — soft purple */
    .table-card.updated {
        background: #f3e8ff;
        border-color: #c084fc;
    }

    /* Preparing — amber */
    .table-card.preparing {
        background: #fff3cd;
        border-color: #fbbf24;
    }

    /* Serving — warm orange */
    .table-card.serving {
        background: #ffedd5;
        border-color: #fb923c;
    }

    /* Cleaning — cyan */
    .table-card.cleaning {
        background: #cffafe;
        border-color: #22d3ee;
    }

/* ── Card inner elements ──────────────────────────────────── */
.tc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.tc-name {
    font-weight: 700;
    font-size: 0.97rem;
    color: #1e293b;
}

.tc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

    /* Dot colours — unique per status */
    .tc-dot.available {
        background: #64748b;
    }
    /* slate — empty/neutral */
    .tc-dot.ready {
        background: #388e3c;
    }
    /* dark forest green */
    .tc-dot.placed {
        background: #3b82f6;
    }
    /* blue */
    .tc-dot.updated {
        background: #a855f7;
    }
    /* purple */
    .tc-dot.preparing {
        background: #eab308;
    }
    /* amber */
    .tc-dot.serving {
        background: #f97316;
    }
    /* orange */
    .tc-dot.cleaning {
        background: #06b6d4;
    }
/* cyan */

/* Status label text — mirrors status-pill text colours exactly */
.tc-status {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
}

    .tc-status.available {
        color: #334155;
    }

    .tc-status.ready {
        color: #155724;
    }

    .tc-status.placed {
        color: #004085;
    }

    .tc-status.updated {
        color: #6b21a8;
    }

    .tc-status.preparing {
        color: #856404;
    }

    .tc-status.serving {
        color: #9a3412;
    }

    .tc-status.cleaning {
        color: #155e75;
    }

.tc-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.77rem;
    color: #475569;
    margin-top: 2px;
}

/* ── Detail panel ─────────────────────────────────────────── */
.ts-detail-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 18px;
    margin-top: 4px;
}

.tdp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.tdp-title {
    font-weight: 700;
    font-size: 0.97rem;
    color: #1e293b;
}

.tdp-close {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
    cursor: pointer;
    color: #64748b;
    padding: 0.22rem 0.55rem;
    border-radius: 6px;
    transition: all 0.15s;
    line-height: 1;
}

    .tdp-close:hover {
        background: #e2e8f0;
        color: #1e293b;
    }

.tdp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.tdp-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    text-align: left;
}

.tdp-item-icon {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.tdp-item-label {
    font-size: 0.70rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 4px;
    font-weight: 600;
}

.tdp-item-value {
    font-size: 0.97rem;
    font-weight: 700;
    color: #1e293b;
    word-break: break-word;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .table-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .tdp-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tablestatus {
        padding: 10px;
    }

    .table-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .tdp-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ts-section-card {
        padding: 14px;
    }
}
