/* =========================================
   PORTAIL PRINCIPAL VDS — DESIGN SYSTEM & TOKENS
   ========================================= */
:root {
    --bg-black: #05070a;
    --bg-darker: #080c12;
    --bg-surface: #0e141f;
    --font-main: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Couleurs des 4 Univers */
    --color-portfolio: #0ea5e9;
    --color-portfolio-glow: rgba(14, 165, 233, 0.35);
    
    --color-ia: #a855f7;
    --color-ia-glow: rgba(168, 85, 247, 0.35);
    
    --color-sim: #10b981;
    --color-sim-glow: rgba(16, 185, 129, 0.35);
    
    --color-music: #ec4899;
    --color-music-glow: rgba(236, 72, 153, 0.35);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-black);
    color: #f1f5f9;
    font-family: var(--font-main);
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   INTRO LOADER CINÉMATIQUE
   ========================================= */
#intro-overlay {
    position: fixed;
    inset: 0;
    background: #040609;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s ease;
}
#intro-overlay.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.intro-logo-box {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
}

.intro-ring {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(56, 189, 248, 0.2);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spinRing 1.2s linear infinite;
}

.intro-ring-2 {
    position: absolute;
    inset: -8px;
    border: 1px dashed rgba(168, 85, 247, 0.3);
    border-radius: 50%;
    animation: spinRingReverse 4s linear infinite;
}

.intro-vds {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: #e2e8f0;
    margin-bottom: 8px;
}

.intro-sub {
    font-size: 0.8rem;
    color: #64748b;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.intro-bar-track {
    width: 180px;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin-top: 25px;
    overflow: hidden;
    position: relative;
}

.intro-bar-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9, #a855f7);
    animation: loadFill 1.3s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes spinRing { to { transform: rotate(360deg); } }
@keyframes spinRingReverse { to { transform: rotate(-360deg); } }
@keyframes loadFill { to { width: 100%; } }

/* =========================================
   HEADER PORTAIL DISCRET
   ========================================= */
.portal-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    padding: 0 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: rgba(5, 7, 10, 0.65);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.brand-monogram {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
}

.brand-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #34d399;
    text-transform: uppercase;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #34d399;
    border-radius: 50%;
    box-shadow: 0 0 8px #34d399;
    animation: statusPulse 2s infinite;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.portal-nav-info {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #94a3b8;
}

.portal-quick-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #38bdf8;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    background: rgba(56, 189, 248, 0.05);
    transition: all 0.3s ease;
}
.portal-quick-link:hover {
    background: #38bdf8;
    color: #05070a;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}

/* =========================================
   GRILLE CENTRALE 2x2 DES UNIVERS
   ========================================= */
.portal-main {
    position: relative;
    width: 100vw;
    height: 100vh;
    padding-top: 60px;
}

.portal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: calc(100vh - 60px);
    position: relative;
}

/* Éléments de tuiles */
.tile-item {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 45px 50px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: var(--bg-darker);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Positionnement des bordures de la grille */
.tile-portfolio { border-right: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.tile-ia { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.tile-sim { border-right: 1px solid rgba(255, 255, 255, 0.08); }
.tile-music { }

/* Toile de fond Canvas animée */
.tile-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.65;
    transition: opacity 0.4s ease;
}

/* Dégradé radial de focus / spot au survol */
.tile-spotlight {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Contenu de la tuile */
.tile-top-bar {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.tile-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.tile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.badge-active {
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid #0ea5e9;
    color: #38bdf8;
    box-shadow: 0 0 12px rgba(14, 165, 233, 0.3);
}

.badge-locked {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
}

.tile-center-content {
    position: relative;
    z-index: 3;
    margin: auto 0;
}

.tile-subtitle {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tile-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.1;
    color: #ffffff;
    margin-bottom: 14px;
    text-transform: uppercase;
    transition: transform 0.3s ease;
}

.tile-desc {
    font-size: 0.95rem;
    color: #94a3b8;
    line-height: 1.5;
    max-width: 480px;
    margin-bottom: 18px;
}

.tile-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tile-tag {
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.74rem;
    font-weight: 600;
    color: #cbd5e1;
    letter-spacing: 0.4px;
}

.tile-bottom-bar {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.tile-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 9px 20px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.tile-coord {
    font-family: monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 2px;
}

/* =========================================
   THÉMATISATIONS PAR TUILE
   ========================================= */

/* 1. PORTFOLIO */
.tile-portfolio .tile-icon-box {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #38bdf8;
}
.tile-portfolio .tile-subtitle { color: #38bdf8; }
.tile-portfolio .tile-action-btn {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid #0ea5e9;
    color: #38bdf8;
}

.tile-portfolio:hover {
    background: #09121d;
    border-color: rgba(14, 165, 233, 0.4);
}
.tile-portfolio:hover .tile-canvas { opacity: 0.95; }
.tile-portfolio:hover .tile-icon-box {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 25px rgba(14, 165, 233, 0.5);
    background: #0ea5e9;
    color: #05070a;
}
.tile-portfolio:hover .tile-action-btn {
    background: #0ea5e9;
    color: #05070a;
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
    transform: translateX(4px);
}

/* 2. I.A. */
.tile-ia .tile-icon-box {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #c084fc;
}
.tile-ia .tile-subtitle { color: #c084fc; }
.tile-ia .tile-action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.tile-ia:hover {
    background: #110d1c;
    border-color: rgba(168, 85, 247, 0.4);
}
.tile-ia:hover .tile-canvas { opacity: 0.95; }
.tile-ia:hover .tile-icon-box {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.5);
    background: #a855f7;
    color: #05070a;
}
.tile-ia:hover .tile-action-btn {
    border-color: #a855f7;
    color: #c084fc;
    background: rgba(168, 85, 247, 0.15);
}

/* 3. SIMULATION */
.tile-sim .tile-icon-box {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}
.tile-sim .tile-subtitle { color: #34d399; }
.tile-sim .tile-action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.tile-sim:hover {
    background: #0a1612;
    border-color: rgba(16, 185, 129, 0.4);
}
.tile-sim:hover .tile-canvas { opacity: 0.95; }
.tile-sim:hover .tile-icon-box {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.5);
    background: #10b981;
    color: #05070a;
}
.tile-sim:hover .tile-action-btn {
    border-color: #10b981;
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
}

/* 4. MUSIQUE */
.tile-music .tile-icon-box {
    background: rgba(236, 72, 153, 0.12);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: #f472b6;
}
.tile-music .tile-subtitle { color: #f472b6; }
.tile-music .tile-action-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.tile-music:hover {
    background: #190b14;
    border-color: rgba(236, 72, 153, 0.4);
}
.tile-music:hover .tile-canvas { opacity: 0.95; }
.tile-music:hover .tile-icon-box {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 0 25px rgba(236, 72, 153, 0.5);
    background: #ec4899;
    color: #05070a;
}
.tile-music:hover .tile-action-btn {
    border-color: #ec4899;
    color: #f472b6;
    background: rgba(236, 72, 153, 0.15);
}

/* Nœud Central Nexus */
.portal-center-cross {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #080c12;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.center-core {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px #fff;
    animation: corePulse 3s infinite alternate;
}
@keyframes corePulse {
    0% { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 15px #38bdf8; }
}

/* =========================================
   MODAL / TOAST DE NOTIFICATION ÉLÉGANTE
   ========================================= */
.portal-toast-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.portal-toast-overlay.active {
    opacity: 1;
    visibility: visible;
}

.portal-toast-card {
    position: relative;
    width: 90%;
    max-width: 460px;
    background: #0d121c;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 35px var(--toast-glow, rgba(56, 189, 248, 0.2));
    transform: scale(0.92) translateY(15px);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.portal-toast-overlay.active .portal-toast-card {
    transform: scale(1) translateY(0);
}

.toast-close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.toast-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: rotate(90deg);
}

.toast-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.toast-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.35rem;
    background: var(--toast-icon-bg, rgba(56, 189, 248, 0.15));
    color: var(--toast-color, #38bdf8);
    border: 1px solid var(--toast-color, #38bdf8);
}

.toast-title-box h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 2px;
}
.toast-title-box span {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--toast-color, #38bdf8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toast-body {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #cbd5e1;
    margin-bottom: 24px;
}

.toast-footer {
    display: flex;
    justify-content: flex-end;
}

.toast-confirm-btn {
    padding: 10px 24px;
    border-radius: 8px;
    background: var(--toast-color, #38bdf8);
    color: #05070a;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
}
.toast-confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--toast-glow, rgba(56, 189, 248, 0.4));
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--toast-color, #38bdf8);
    width: 100%;
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 1024px) {
    .tile-title { font-size: 2.2rem; }
    .tile-item { padding: 30px; }
}

@media (max-width: 768px) {
    html, body {
        overflow-y: auto;
        height: auto;
    }
    .portal-main {
        height: auto;
        padding-top: 60px;
    }
    .portal-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }
    .tile-item {
        min-height: 280px;
        padding: 35px 25px;
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }
    .tile-title { font-size: 2rem; }
    .portal-center-cross { display: none; }
    .portal-header { padding: 0 15px; }
    .portal-nav-info { display: none; }
}