:root {
    --bg-color: #0b1120;
    --bg-glow: rgba(59, 130, 246, 0.1);
    --card-bg: rgba(30, 41, 59, 0.78);
    --card-hover-bg: rgba(30, 41, 59, 0.96);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border-subtle: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Verrouillage strict de l'écran (Zéro scroll) */
html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 0%, var(--bg-glow) 0%, transparent 70%);
    color: var(--text-main);
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5vh 2.5vw 2.5vh 2.5vw;
    position: relative;
}

/* Badge Horloge Temps Réel en haut à droite */
.server-badge {
    position: fixed;
    top: 2vh;
    right: 2.5vw;
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-main);
    z-index: 50;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

header {
    text-align: center;
    margin-bottom: 2vh;
    flex-shrink: 0;
}

.clickable-title {
    font-size: clamp(2.4rem, 5vh, 3.4rem);
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    user-select: none;
    display: inline-block;
    padding: 0 1rem;
    line-height: 1.1;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), filter 0.2s ease;
}

.clickable-title:hover {
    transform: scale(1.04);
    filter: brightness(1.15);
}

header p {
    color: var(--text-muted);
    margin-top: 0.4vh;
    font-size: clamp(0.95rem, 2vh, 1.2rem);
    font-weight: 500;
}

.container {
    width: 100%;
    max-width: 1350px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.view {
    display: none;
    flex-direction: column;
    min-height: 0;
    animation: fadeInScale 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.view.active {
    display: flex;
}

/* --- VUE 1 : ACCUEIL (Boutons proportionnés comme avant, centrés) --- */
.dom-home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5vw;
    align-content: center;
    justify-content: center;
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    min-height: 0;
}

.card-hero {
    padding: 3rem 2rem !important;
    min-height: 250px;
    max-height: 320px;
}

.card-hero .icon {
    font-size: 4rem !important;
    margin-bottom: 1rem;
}

.card-hero h2 {
    font-size: 2rem !important;
    margin-bottom: 0.5rem;
}

.card-hero p {
    font-size: 1.05rem !important;
}

/* --- VUE 2 : INFOS (Hauteur limitée et bloquée sans dépassement) --- */
.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5vh;
    background-color: var(--card-bg);
    padding: 1vh 1.5rem;
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background-color: var(--success);
    border-radius: 50%;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-refresh {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 0.45rem 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

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

.infos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto auto;
    gap: 1.8vh 2vw;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 180px);
}

.card-featured {
    grid-column: span 2;
}

/* --- VUE 3 : CONTRÔLES --- */
.controles-layout {
    display: flex;
    flex-direction: column;
    gap: 2vh;
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 180px);
}

.controles-layout .admin-grid,
.controles-layout .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2vw;
    flex: 1;
    min-height: 0;
    max-height: 48%;
}

/* Cartes standard */
.card {
    background-color: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
    user-select: none;
}

.card:hover {
    background-color: var(--card-hover-bg);
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.45), 0 0 20px rgba(59, 130, 246, 0.25);
}

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

.card h2 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.card h3 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.card p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.35; }
.card .icon {
    font-size: 3rem;
    margin-bottom: 0.8rem;
    transition: transform 0.25s ease;
}

/* Cartes de données (Météo, Agenda, Mails, Ampoules) avec limite stricte */
.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.stat-title {
    font-weight: 700;
    font-size: 1.2rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
}

.sys-info-list {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    min-height: 0;
    margin-top: 0.5rem;
}

.sys-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.05rem;
    color: var(--text-muted);
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sys-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sys-row strong {
    color: var(--text-main);
    font-size: 1.1rem;
}

/* Contrôles des ampoules */
.light-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-btn {
    flex: 1;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.modal-btn.btn-on {
    background-color: var(--accent);
    color: var(--text-main);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.modal-btn.btn-on:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.modal-btn.secondary {
    background-color: rgba(255, 255, 255, 0.07);
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

.modal-btn.secondary:hover {
    background-color: rgba(255, 255, 255, 0.14);
}

/* Notifications Toast */
.toast-container {
    position: fixed;
    bottom: 2vh;
    right: 2vw;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 100;
}

.toast {
    background-color: #1e293b;
    border-left: 5px solid var(--accent);
    color: var(--text-main);
    padding: 1rem 1.4rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 1.05rem;
    animation: fadeInScale 0.25s ease forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.warning { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--danger); }