/* ══════════════════════════════════════════════════════════
   Klario Restau — Feuille de style principale
   Thème : Orange chaud (#D84315 → #FF6D00 → #FFB74D)
   ══════════════════════════════════════════════════════════ */

/* ── Base ── */
html, body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #FFF8F0;
    margin: 0;
}

/* ── Login ── */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #FFF8F0 0%, #FFE0B2 50%, #FFCC80 100%);
    padding: 16px;
}

.login-card {
    max-width: 420px;
    width: 100%;
    border-radius: 16px !important;
    border-top: 4px solid #D84315;
}

/* ── Plan de salle ── */
.floor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.floor-table {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: center;
    min-height: 140px;
}

.floor-table:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.floor-table__number {
    font-size: 1.4rem;
    font-weight: 700;
    color: #3E2723;
}

.floor-table__cap {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.floor-table--available {
    border: 2px solid #4CAF50;
    background: #E8F5E9;
}

.floor-table--occupied {
    border: 2px solid #E53935;
    background: #FFEBEE;
}

.floor-table--reserved {
    border: 2px solid #FF9800;
    background: #FFF3E0;
}

.floor-table--cleaning {
    border: 2px dashed #42A5F5;
    background: #E3F2FD;
}

/* ── Menu grid (prise de commande) ── */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.menu-item-card {
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
    border-left: 3px solid #FF6D00;
}

.menu-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ── KDS (Kitchen Display) ── */
.kds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.kds-card {
    padding: 16px;
    border-top: 4px solid #FF6D00;
}

.kds-card--warning {
    border-top-color: #FF9800 !important;
    background: #FFF8E1 !important;
}

.kds-card--urgent {
    border-top-color: #E53935 !important;
    background: #FFEBEE !important;
    animation: kds-pulse 1.5s ease-in-out infinite;
}

@keyframes kds-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(229, 57, 53, 0); }
}

.kds-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.kds-line {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.kds-line--done {
    opacity: 0.5;
    text-decoration: line-through;
}

/* ── Order cards ── */
.order-card {
    transition: transform 0.15s;
}

.order-card:hover {
    transform: translateY(-2px);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .floor-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }

    .kds-grid {
        grid-template-columns: 1fr;
    }

    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
}

/* ── Utilities ── */
.cursor-pointer { cursor: pointer; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ── Plan de salle libre (tables disposées comme dans la vraie salle) ── */
.floor-plan { position: relative; }

.floor-plan__room {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    min-height: 320px;
    border-radius: 18px;
    background: #FAF7F4;
    border: 2px solid #EADFD6;
    background-image: linear-gradient(#0000000a 1px, transparent 1px), linear-gradient(90deg, #0000000a 1px, transparent 1px);
    background-size: 5% 8%;
    overflow: hidden;
    touch-action: manipulation;
    /* Les tailles des tables se mesurent sur la salle, pas sur l'écran :
       une position enregistrée sur tablette reste juste sur téléphone. */
    container-type: inline-size;
}

.floor-plan.is-editing .floor-plan__room { border-color: #D84315; background: #FFF8F5; }
.floor-plan.is-moving .floor-plan__room { touch-action: none; }

.floor-tablep {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 15%;
    aspect-ratio: 1;
    min-width: 44px;
    border-radius: 50%;
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: box-shadow .15s, transform .05s;
}

/* Grandes tablées : forme allongée plutôt que ronde. */
.floor-tablep--large { width: 23%; aspect-ratio: 1.9; border-radius: 16px; }

.floor-plan.is-editing .floor-tablep { cursor: grab; }
.floor-tablep.is-dragging { cursor: grabbing; z-index: 5; box-shadow: 0 10px 26px rgba(0,0,0,.26); transform: translate(-50%, -50%) scale(1.06); }

.floor-tablep__num { font-size: clamp(11px, 4.4cqw, 22px); font-weight: 700; color: #3E2723; line-height: 1.1; }
.floor-tablep__meta { font-size: clamp(8px, 2.4cqw, 12px); color: #6d5d55; line-height: 1.15; }
.floor-tablep__time { font-size: clamp(8px, 2.5cqw, 12px); font-weight: 700; }

.floor-tablep--available { border: 2px solid #4CAF50; background: #E8F5E9; }
.floor-tablep--occupied { border: 2px solid #E53935; background: #FFEBEE; }
.floor-tablep--reserved { border: 2px solid #FF9800; background: #FFF3E0; }
.floor-tablep--cleaning { border: 2px dashed #42A5F5; background: #E3F2FD; }

/* Table occupée depuis longtemps : le gérant doit la repérer de loin. */
.floor-tablep--late { box-shadow: 0 0 0 4px #FFCDD2, 0 2px 8px rgba(0,0,0,.12); }
.floor-tablep--late .floor-tablep__time { color: #C62828; }

.floor-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: .78rem; color: #6d5d55; }
.floor-legend span { display: inline-flex; align-items: center; gap: 6px; }
.floor-legend i { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }

/* Sur téléphone la salle devient verticale, mais les tables gardent leur taille relative. */
@media (max-width: 600px) {
    .floor-plan__room { aspect-ratio: 3 / 4; min-height: 420px; }
}
