/* ═══════════════════════════════════════════════
   Room SOC — Cap Vermell Grand Hotel
   Brand-aligned luxury monitoring dashboard
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Cap Vermell brand palette */
    --gold: #c4b18c;
    --gold-light: #d4c6a3;
    --gold-dim: rgba(196,177,140,0.15);
    --gold-glow: rgba(196,177,140,0.25);

    /* Warm dark backgrounds */
    --bg-primary: #0f0e0c;
    --bg-secondary: #171613;
    --bg-card: #1e1d19;
    --bg-card-hover: #26251f;
    --bg-surface: #141311;
    --bg-inset: #0c0b09;

    --border: rgba(196,177,140,0.08);
    --border-hover: rgba(196,177,140,0.18);
    --border-active: rgba(196,177,140,0.30);

    /* Text */
    --text-primary: #e8e4dc;
    --text-secondary: #9e978a;
    --text-muted: #6b6459;

    /* Status colors — warm tones */
    --status-ok: #6fcf97;
    --status-warn: #e2b93b;
    --status-critical: #e85d5d;
    --status-info: #7eb8d4;
    --status-offline: #5a564e;

    /* Fonts */
    --serif: 'Cormorant Garamond', Georgia, serif;
    --sans: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;

    --radius: 8px;
    --radius-sm: 5px;
    --radius-pill: 100px;
}

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

body {
    font-family: var(--sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.soc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.brand-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
}

.brand-icon svg { width: 32px; height: 32px; }

.soc-header h1 {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold);
}

.header-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 18px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--status-ok);
    animation: pulse-dot 2.5s ease-in-out infinite;
}

.live-dot.offline {
    background: var(--status-critical);
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 3px var(--status-ok); }
    50% { opacity: 0.35; box-shadow: 0 0 8px var(--status-ok); }
}

.header-clock {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.btn-refresh {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
    padding: 7px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.btn-refresh:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-dim);
}

.btn-refresh.spinning svg {
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Summary Strip ── */
.summary-strip {
    display: flex;
    gap: 1px;
    background: var(--border);
    border-bottom: 1px solid var(--border);
}

.stat-card {
    flex: 1;
    padding: 18px 20px;
    background: var(--bg-surface);
    text-align: center;
    transition: background 0.3s;
}

.stat-card:hover { background: var(--bg-card); }

.stat-value {
    font-family: var(--sans);
    font-size: 28px;
    font-weight: 600;
    line-height: 1.1;
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 4px;
}

.stat-online .stat-value { color: var(--status-ok); }
.stat-offline .stat-value { color: var(--status-critical); }
.stat-alerts .stat-value { color: var(--status-warn); }
.stat-cameras .stat-value { color: var(--status-info); }
.stat-rooms .stat-value { color: var(--gold); }
.stat-timestamp .stat-value {
    font-family: var(--mono) !important;
    font-size: 18px !important;
    color: var(--text-secondary) !important;
}

/* ── Alert Banner ── */
.alert-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 28px;
    background: rgba(232,93,93,0.06);
    border-bottom: 1px solid rgba(232,93,93,0.20);
}

.alert-banner-icon {
    display: flex;
    align-items: center;
    color: var(--status-critical);
}

.alert-banner-text {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--status-critical);
}

.alert-banner-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}

.alert-banner-close:hover { color: var(--text-primary); }

/* ── Section Titles ── */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin-bottom: 18px;
}

.section-title svg {
    color: var(--gold);
    opacity: 0.6;
}

/* ── Blocks Grid ── */
.blocks-section {
    padding: 28px;
}

.blocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
}

.block-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.block-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.block-card.status-ok::before { background: var(--status-ok); }
.block-card.status-warn::before { background: var(--status-warn); }
.block-card.status-critical::before { background: var(--status-critical); }

.block-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.block-card:active { transform: translateY(0); }

.block-name {
    font-family: var(--sans);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.block-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    font-size: 11px;
}

.block-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.block-stat .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-ok { background: var(--status-ok); }
.dot-warn { background: var(--status-warn); }
.dot-critical { background: var(--status-critical); }
.dot-info { background: var(--status-info); }
.dot-muted { background: var(--status-offline); }

.block-alert-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--status-critical);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badge-glow 3s ease-in-out infinite;
}

@keyframes badge-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232,93,93,0.3); }
    50% { box-shadow: 0 0 0 5px rgba(232,93,93,0); }
}

/* ── Detail Panel ── */
.detail-panel {
    margin: 0 28px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: panel-in 0.25s ease;
}

@keyframes panel-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
}

.detail-header h2 {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
}

.btn-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: var(--radius-pill);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    border-color: var(--status-critical);
    color: var(--status-critical);
    background: rgba(232,93,93,0.08);
}

.detail-rooms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    padding: 18px 22px;
}

/* ── Room Card ── */
.room-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    transition: border-color 0.2s;
}

.room-card.room-ok { border-left: 3px solid var(--status-ok); }
.room-card.room-warn { border-left: 3px solid var(--status-warn); }
.room-card.room-critical { border-left: 3px solid var(--status-critical); }

.room-card:hover { border-color: var(--border-hover); }

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.room-name {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.room-status-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.badge-ok { background: rgba(111,207,151,0.12); color: var(--status-ok); }
.badge-warn { background: rgba(226,185,59,0.12); color: var(--status-warn); }
.badge-critical { background: rgba(232,93,93,0.12); color: var(--status-critical); }
.badge-offline { background: rgba(90,86,78,0.2); color: var(--status-offline); }

.room-devices {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.device-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: rgba(196,177,140,0.06);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--mono);
    font-size: 10px;
}

.device-chip .chip-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.room-alerts {
    margin-top: 8px;
}

.room-alert-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 11px;
    font-weight: 500;
}

.room-alert-item .alert-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.room-alert-item.critical-alert { color: var(--status-critical); }
.room-alert-item.warn-alert { color: var(--status-warn); }
.room-alert-item.info-alert { color: var(--status-info); }

/* ── Alerts Section ── */
.alerts-section {
    padding: 0 28px 28px;
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: border-color 0.2s;
}

.alert-item:hover { border-color: var(--border-hover); }

.alert-item.critical { border-left: 3px solid var(--status-critical); }
.alert-item.warning { border-left: 3px solid var(--status-warn); }
.alert-item.info { border-left: 3px solid var(--status-info); }

.alert-severity {
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    flex-shrink: 0;
}

.sev-critical { background: rgba(232,93,93,0.12); color: var(--status-critical); }
.sev-warning { background: rgba(226,185,59,0.12); color: var(--status-warn); }
.sev-info { background: rgba(126,184,212,0.12); color: var(--status-info); }

.alert-message { flex: 1; color: var(--text-primary); font-weight: 400; }
.alert-location {
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11px;
}

.no-alerts {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 13px;
}

.no-alerts svg {
    display: block;
    margin: 0 auto 10px;
    color: var(--status-ok);
    opacity: 0.5;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .soc-header { padding: 12px 16px; }
    .soc-header h1 { font-size: 16px; letter-spacing: 2px; }
    .summary-strip { flex-wrap: wrap; gap: 1px; }
    .stat-card { min-width: 33.3%; padding: 14px 12px; }
    .stat-value { font-size: 24px; }
    .blocks-section, .alerts-section { padding: 16px; }
    .blocks-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
    .detail-panel { margin: 0 16px 16px; }
    .detail-rooms { grid-template-columns: 1fr; }
}

/* ── Loading Overlay ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15,14,12,0.92);
    backdrop-filter: blur(8px);
}

.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 48px;
}

.loading-logo {
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

/* Clients stat color */
.stat-clients .stat-value { color: var(--status-info); }

/* ── Login Overlay ── */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.login-card {
    width: 360px;
    max-width: 90vw;
    padding: 44px 36px 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.login-brand {
    margin-bottom: 32px;
}

.login-brand svg { margin-bottom: 12px; }

.login-brand h2 {
    font-family: var(--sans);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 4px;
}

.login-brand p {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.login-field {
    margin-bottom: 16px;
    text-align: left;
}

.login-field label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--sans);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.login-field input::placeholder {
    color: var(--text-muted);
}

.login-field input:focus {
    border-color: var(--gold);
}

.login-error {
    font-size: 12px;
    color: var(--status-critical);
    min-height: 20px;
    margin-bottom: 8px;
    font-weight: 500;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--gold);
    border: none;
    border-radius: var(--radius-pill);
    color: var(--bg-primary);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    background: var(--gold-light);
    box-shadow: 0 4px 16px rgba(196,177,140,0.25);
}

.login-footer {
    margin-top: 24px;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
