:root {
    --bg-body: #0a0c10;
    --bg-card: #151921;
    --text-main: #f0f6fc;
    --text-dim: #8b949e;
    --accent: #ff4757;
    --accent-hover: #ff6b81;
    --border: #21262d;
    --nav-bg: #11141b;
    --status-online: #2ecc71;
    --status-offline: #ff4757;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0; padding: 0;
    display: flex; flex-direction: column; min-height: 100vh;
}

header { background-color: var(--nav-bg); border-bottom: 1px solid var(--border); padding: 15px 40px; display: flex; justify-content: space-between; align-items: center; }
header h1 { margin: 0; font-size: 1.3rem; }
header .domain { color: var(--text-dim); font-weight: 300; }
.header-admin-link { color: var(--accent); text-decoration: none; font-size: 0.95rem; padding: 8px 12px; border-radius: 10px; border: 1px solid transparent; transition: border-color 0.2s, background 0.2s; }
.header-admin-link:hover { background: rgba(255, 71, 87, 0.12); border-color: var(--accent); }

.maintenance-alert {
    display: flex;
    align-items: center;
    gap: 16px;
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 14px 22px;
    border-radius: 0 0 12px 12px;
    color: #fdf2d2;
    border: 1px solid rgba(245, 173, 50, 0.18);
    border-top: 3px solid #f4c85b;
    background: rgba(28, 20, 9, 0.97);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(4px);
}
.maintenance-alert.hidden {
    display: none;
}
.maintenance-alert .alert-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    border-radius: 50%;
    background: rgba(244, 200, 91, 0.18);
    color: #f4c85b;
}
.maintenance-alert strong {
    display: block;
    font-size: 1rem;
    color: #f8db9a;
    letter-spacing: 0.3px;
}
.maintenance-alert p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #f1e4c7;
}
.maintenance-alert.avis {
    border-top-color: #f4c85b;
}
.maintenance-alert.imminente {
    border-top-color: #f35f47;
}
.maintenance-alert.programmee {
    border-top-color: #68c779;
}

.hero-section { padding: 60px 20px; display: flex; justify-content: center; align-items: center; background-image: linear-gradient(to bottom, var(--nav-bg), var(--bg-body)); border-bottom: 1px solid var(--border); }
.hero-content { display: flex; align-items: center; gap: 30px; max-width: 900px; }
.javelinator-logo { width: 150px; border-radius: 50%; box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3); border: 3px solid rgba(255, 71, 87, 0.5); }
.hero-text h2 { margin: 0; font-size: 2.2rem; color: var(--accent); }
.hero-text p { color: var(--text-dim); margin-top: 10px; }

main { flex: 1; padding: 40px 20px; display: flex; justify-content: center; }
.grid-container { width: 100%; max-width: 1200px; }
.section-title { border-left: 3px solid var(--accent); padding-left: 10px; margin-bottom: 25px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

.card {
    background-color: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 25px;
    text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: all 0.2s; position: relative;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); background-color: #1a1f29; }

.maintenance-ribbon {
    position: absolute;
    top: 10px;
    right: -5px;
    background-color: #f1c40f;
    color: #000;
    padding: 6px 12px;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    transform: rotate(12deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 10;
    border-radius: 3px;
}

.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background-color: #555;
    position: absolute; top: 20px; right: 20px;
    transition: all 0.3s;
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.35; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.15); }
}

.status-dot.loading {
    animation: dotPulse 1.1s ease-in-out infinite;
}

.card h3 { margin: 0 0 10px 0; color: var(--accent); }
.card-type { font-size: 0.8rem; color: var(--accent); text-transform: uppercase; margin-bottom: 8px; font-weight: bold; }
.card-url { font-size: 0.8rem; opacity: 0.5; margin-top: 15px; }

.truenas-choice-card {
    overflow: hidden;
    cursor: pointer;
}

.truenas-choice-card.choice-active:hover {
    transform: none;
    border-color: var(--border);
    background-color: var(--bg-card);
}

.truenas-choice-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    border-radius: 12px;
    transition: background 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.truenas-split-halves {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1), transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.38s;
    z-index: 3;
}

.truenas-choice-card.choice-active::after {
    background: rgba(0, 0, 0, 0.55);
}

.truenas-choice-card.choice-active .card-type,
.truenas-choice-card.choice-active h3,
.truenas-choice-card.choice-active p,
.truenas-choice-card.choice-active .card-url,
.truenas-choice-card.choice-active .status-dot {
    opacity: 0.15;
    filter: blur(2px) saturate(0.4);
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.truenas-choice-card.choice-active .truenas-split-halves {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

@keyframes glowPulseGreen {
    0%, 100% { box-shadow: 0 0 16px rgba(46, 204, 113, 0.5), 0 0 32px rgba(46, 204, 113, 0.25), inset 0 1px 0 rgba(255,255,255,0.15); }
    50%       { box-shadow: 0 0 26px rgba(46, 204, 113, 0.75), 0 0 52px rgba(46, 204, 113, 0.35), inset 0 1px 0 rgba(255,255,255,0.2); }
}

@keyframes glowPulseRed {
    0%, 100% { box-shadow: 0 0 16px rgba(255, 71, 87, 0.5), 0 0 32px rgba(255, 71, 87, 0.25), inset 0 1px 0 rgba(255,255,255,0.15); }
    50%       { box-shadow: 0 0 26px rgba(255, 71, 87, 0.75), 0 0 52px rgba(255, 71, 87, 0.35), inset 0 1px 0 rgba(255,255,255,0.2); }
}

.truenas-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: #ffffff;
    border-radius: 14px;
    padding: 18px 10px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: none;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.22s ease, box-shadow 0.22s ease;
    position: relative;
    overflow: hidden;
}

.truenas-half::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 60%);
    border-radius: 14px;
    pointer-events: none;
}

.truenas-half span {
    position: relative;
    z-index: 1;
}

.truenas-half-kerminator {
    background: transparent;
    border: 2px solid #2ecc71;
    color: #2ecc71;
    animation: glowPulseGreen 2.6s ease-in-out infinite;
}

.truenas-half-kerminator:hover {
    transform: translateY(-3px) scale(1.03);
    background: rgba(46, 204, 113, 0.12);
    box-shadow: 0 6px 24px rgba(46, 204, 113, 0.7), 0 0 50px rgba(46, 204, 113, 0.4) !important;
}

.truenas-half-odjavel {
    background: transparent;
    border: 2px solid #ff4757;
    color: #ff4757;
    animation: glowPulseRed 2.6s ease-in-out infinite;
}

.truenas-half-odjavel:hover {
    transform: translateY(-3px) scale(1.03);
    background: rgba(255, 71, 87, 0.12);
    box-shadow: 0 6px 24px rgba(255, 71, 87, 0.7), 0 0 50px rgba(255, 71, 87, 0.4) !important;
}

.chatbot-container { position: fixed; bottom: 25px; right: 25px; z-index: 9999; display: flex; flex-direction: column; align-items: flex-end; pointer-events: none; }
.chat-window, .chat-trigger { pointer-events: auto; }
.chat-window {
    background-color: var(--bg-card); border: 1px solid var(--accent); border-radius: 15px;
    width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); margin-bottom: 15px;
    opacity: 0; visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.chat-window.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.chat-header { background-color: var(--nav-bg); padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); border-radius: 15px 15px 0 0; }
.chat-name { font-weight: 600; color: var(--accent); }
.chat-close { background: none; border: none; color: var(--text-dim); font-size: 1.5rem; cursor: pointer; }
.chat-body { padding: 18px; color: var(--text-main); font-size: 0.9rem; line-height: 1.5; max-height: 60vh; overflow-y: auto; }
.chat-body p { margin-bottom: 12px; }
.chat-btn-action { background: rgba(255, 71, 87, 0.1); border: 1px solid var(--accent); color: var(--accent); padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: bold; margin-top: 10px; transition: 0.2s; }
.chat-btn-action:hover { background: var(--accent); color: white; }
#typing-indicator { font-style: italic; color: var(--text-dim); display: none; margin-top: 10px; }
#hidden-drawing { display: none; margin-top: 15px; width: 100%; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; transition: transform 0.2s; }
#hidden-drawing:hover { transform: scale(1.02); }

.lightbox-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); display: none; justify-content: center; align-items: center; z-index: 10000; cursor: zoom-out; }
.lightbox-overlay img { max-width: 90%; max-height: 90%; border-radius: 10px; box-shadow: 0 0 30px rgba(255, 71, 87, 0.4); border: 2px solid var(--accent); }

/* Note: Si ton logo est à la racine, on remonte de deux dossiers */
.chat-trigger { width: 85px; height: 85px; border-radius: 50%; border: 4px solid var(--accent); background-image: url('../image/logo.png'); background-size: cover; background-position: center; cursor: pointer; position: relative; transition: 0.2s; }
.notif-badge { position: absolute; top: -2px; left: -2px; background-color: var(--accent); color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; justify-content: center; align-items: center; opacity: 0; transform: scale(0); transition: 0.3s; font-weight: bold; font-size: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.5); z-index: 10; }

@keyframes badgeBounce { 0%, 100% { transform: scale(1) translateY(0); } 50% { transform: scale(1.3) translateY(-6px); } }
.notif-badge.show { opacity: 1; transform: scale(1); animation: badgeBounce 0.8s infinite; }

@keyframes intenseWigglePulse { 0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.9); transform: scale(1); } 10% { transform: scale(1.15) rotate(-10deg); } 20% { transform: scale(1.15) rotate(10deg); } 30% { transform: scale(1.15) rotate(-10deg); } 40% { transform: scale(1.15) rotate(10deg); } 50% { transform: scale(1.1) rotate(0deg); box-shadow: 0 0 0 35px rgba(255, 71, 87, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); transform: scale(1); } }
.chat-trigger.attention { animation: intenseWigglePulse 1.2s infinite; }

@media (min-width: 1024px) {
    header { padding: 22px 60px; }
    header h1 { font-size: 1.6rem; }
    .header-admin-link { font-size: 1rem; padding: 10px 14px; }
    .hero-section { padding: 80px 30px; }
    .hero-content { gap: 40px; max-width: 1100px; }
    .javelinator-logo { width: 180px; }
    .hero-text h2 { font-size: 3rem; }
    .hero-text p { font-size: 1.1rem; }
    .section-title { font-size: 1.4rem; margin-bottom: 30px; }
    .grid { grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 28px; }
    .card { padding: 32px; }
    .maintenance-ribbon { top: 16px; right: -8px; padding: 8px 14px; font-size: 1rem; }
    .card-type { font-size: 0.95rem; }
    .card h3 { font-size: 1.5rem; }
    .card-url { font-size: 0.9rem; }
    .status-dot { top: 24px; right: 22px; width: 10px; height: 10px; }
    .chat-window { width: 440px; }
    .chat-body { font-size: 1rem; }
}

@media (max-width: 768px) { .chat-window { width: calc(100vw - 40px); } .chat-trigger { width: 70px; height: 70px; } }
