/* =====================================================================
   Feuille de Style - Tableau de Bord Réception Chauffage Hôtel Ath
   ===================================================================== */

:root {
    --bg-dark: #0b1120;
    --bg-card: #1e293b;
    --bg-card-hover: #273549;
    --bg-input: #0f172a;
    --border-color: #334155;
    --border-light: #475569;
    
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-light: #38bdf8;
    
    --text-white: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --color-heat: #f97316;
    --color-heat-glow: rgba(249, 115, 22, 0.25);
    --color-green: #22c55e;
    --color-green-glow: rgba(34, 197, 94, 0.2);
    --color-amber: #f59e0b;
    --color-red: #ef4444;
    --color-red-glow: rgba(239, 68, 68, 0.25);
    --color-cyan: #06b6d4;
    --color-purple: #a855f7;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font);
    line-height: 1.5;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    background: #0f172a;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

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

.brand-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.brand-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.brand-text span {
    font-size: 13px;
    color: var(--primary-light);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1e293b;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid var(--border-color);
}

.pulse-dot {
    width: 9px;
    height: 9px;
    background: var(--color-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.btn-icon {
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #334155;
    border-color: var(--primary-light);
}

/* Conteneur principal */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
}

/* Statistiques globales (KPI Cards) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

.stat-card.heating::before { background: var(--color-heat); }
.stat-card.window::before { background: var(--color-amber); }
.stat-card.offline::before { background: var(--color-red); }
.stat-card.temp::before { background: var(--color-cyan); }

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-details h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-details .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-white);
}

.stat-details .sub {
    font-size: 12px;
    color: var(--text-dim);
}

/* Bandeau d'actions rapides Hôtel */
.quick-actions-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.quick-actions-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action {
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-action:hover {
    border-color: var(--primary);
    background: #1e293b;
    transform: translateY(-1px);
}

.btn-action.eco:hover { border-color: var(--color-green); color: var(--color-green); }
.btn-action.night:hover { border-color: var(--color-purple); color: var(--color-purple); }
.btn-action.comfort:hover { border-color: var(--color-heat); color: var(--color-heat); }

/* Filtres et Barre de recherche */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 14px;
}

.tabs-group {
    display: flex;
    gap: 6px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.4);
}

.tab-btn:hover:not(.active) {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

.filters-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    width: 200px;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

/* Grille des chambres */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 18px;
}

/* Carte de chambre */
.room-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    position: relative;
    cursor: pointer;
}

.room-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

.room-card.is-heating {
    border-color: var(--color-heat);
    box-shadow: 0 0 15px var(--color-heat-glow);
}

.room-card.has-window-alert {
    border-color: var(--color-red);
    box-shadow: 0 0 15px var(--color-red-glow);
}

.room-card.is-offline {
    opacity: 0.75;
}

/* En-tête de la carte */
.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 10px;
}

.room-title-block {
    display: flex;
    align-items: center;
    gap: 10px;
}

.room-number {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
}

.floor-badge {
    background: #0f172a;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.room-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-occupancy {
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-occupancy.OCCUPIED { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.badge-occupancy.VACANT { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-occupancy.CLEANING { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.4); }

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-green);
    box-shadow: 0 0 6px var(--color-green);
}

.online-dot.offline {
    background: var(--color-red);
    box-shadow: 0 0 6px var(--color-red);
}

/* Corps de la carte : Températures */
.room-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.temp-main {
    display: flex;
    flex-direction: column;
}

.temp-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.temp-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -1px;
}

.temp-target-block {
    text-align: right;
}

.target-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.target-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.btn-step {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-white);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-step:hover {
    background: var(--primary);
    border-color: var(--primary-light);
}

.target-display {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-light);
    min-width: 58px;
    text-align: center;
}

/* Statuts / Alertes */
.room-alerts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.alert-pill {
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.alert-pill.heating {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.alert-pill.window {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: flash 1.5s infinite;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.alert-pill.pending {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Bas de la carte : Actions rapides */
.room-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    gap: 8px;
}

.room-meta {
    font-size: 11px;
    color: var(--text-dim);
}

.btn-action-small {
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-action-small:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Modal Détail Chambre */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

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

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    padding: 28px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-white);
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 22px;
    color: var(--text-white);
}

.modal-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.modal-section {
    margin-bottom: 24px;
}

.modal-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-light);
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
}

/* Grille de contrôles dans le Modal */
.modal-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.control-group select,
.control-group input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.control-group select:focus,
.control-group input:focus {
    border-color: var(--primary);
}

/* Graphique Historique */
.chart-container {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    height: 220px;
    position: relative;
}

canvas#historyChart {
    width: 100% !important;
    height: 100% !important;
}

/* Diagnostics Info */
.diag-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.diag-item {
    background: var(--bg-input);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.diag-item span {
    font-size: 11px;
    color: var(--text-dim);
    display: block;
}

.diag-item strong {
    font-size: 13px;
    color: var(--text-white);
}

/* Toast de notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    border: 1px solid var(--primary);
    color: var(--text-white);
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 200;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-color: var(--color-green); }
.toast.error { border-color: var(--color-red); }

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 14px; }
    .rooms-grid { grid-template-columns: 1fr; }
    .modal-controls-grid { grid-template-columns: 1fr; }
    .diag-grid { grid-template-columns: 1fr 1fr; }
}

