/* ═══════════════════════════════════════════
   OSNum Portail — Styles Spectaculaires
   ═══════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: #0f0c29; }

/* ── Container principal ── */
.portail-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 40%, #24243e 100%);
    position: relative;
    overflow-x: hidden;
    color: #fff;
}
.portail-content {
    position: relative;
    z-index: 2;
    padding-bottom: 60px;
}

/* ── Particules CSS (remplace particles-bg) ── */
.particles {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    overflow: hidden;
}
.particles::before, .particles::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    animation: float-particle 20s ease-in-out infinite;
}
.particles::before {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(102,126,234,0.15) 0%, transparent 70%);
    top: -100px; left: -100px;
}
.particles::after {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(118,75,162,0.12) 0%, transparent 70%);
    bottom: -150px; right: -150px;
    animation-delay: -10s;
    animation-duration: 25s;
}
@keyframes float-particle {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(80px, 60px) scale(1.1); }
    50% { transform: translate(-40px, 120px) scale(0.95); }
    75% { transform: translate(60px, -40px) scale(1.05); }
}
/* Extra floating dots */
.portail-container::before {
    content: '';
    position: fixed; top: 20%; left: 60%;
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255,215,0,0.4);
    box-shadow:
        -200px 50px 0 rgba(102,126,234,0.3),
        100px -120px 0 rgba(118,75,162,0.3),
        300px 200px 0 rgba(255,215,0,0.2),
        -100px 300px 0 rgba(102,126,234,0.2),
        250px -80px 0 rgba(16,185,129,0.3),
        -300px -100px 0 rgba(245,158,11,0.2),
        50px 400px 0 rgba(168,85,247,0.2);
    animation: twinkle 4s ease-in-out infinite alternate;
    z-index: 1; pointer-events: none;
}
@keyframes twinkle { 0% { opacity: 0.4; } 100% { opacity: 1; } }

/* ── Header spectaculaire ── */
.portail-header {
    padding: 50px 20px 30px;
    text-align: center;
    position: relative; z-index: 10;
}
.header-content { display: inline-block; }
.logo-container {
    display: inline-flex; align-items: center; gap: 18px; cursor: pointer;
}
.logo-sparkle {
    color: #FFD700;
    filter: drop-shadow(0 0 18px rgba(255,215,0,0.5));
    animation: float-icon 3s ease-in-out infinite;
}
@keyframes float-icon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.logo-text {
    display: flex; flex-direction: column; align-items: flex-start;
}
.gradient-text-anim {
    font-size: 3.2rem; font-weight: 900;
    background: linear-gradient(90deg, #fff 0%, #e0e7ff 50%, #fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }
.logo-subtitle {
    font-size: 1.1rem; color: rgba(255,255,255,0.7); font-weight: 300; letter-spacing: 4px; text-transform: uppercase;
}
.tagline {
    color: rgba(255,255,255,0.8); font-size: 1.15rem; margin-top: 16px; font-weight: 300;
}

/* ── Glassmorphism ── */
.glass-card {
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

/* ── User Greeting ── */
.user-greeting {
    display: flex; align-items: center; gap: 20px;
    padding: 28px 36px;
    margin: 30px auto; max-width: 640px;
}
.greeting-icon-wrap {
    color: #FFD700; flex-shrink: 0;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,215,0,0.1);
    border-radius: 16px;
}
.greeting-text h2 {
    font-size: 1.7rem; font-weight: 700; color: #fff; margin: 0;
}
.user-role {
    color: rgba(255,255,255,0.7); margin: 6px 0 0; font-size: 0.95rem;
}

/* ── Modules Grid ── */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 30px 40px;
    max-width: 1300px;
    margin: 0 auto;
}
.modules-loading {
    text-align: center; padding: 80px 20px;
    color: rgba(255,255,255,0.7); font-size: 1.1rem;
}
.loader {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #667eea;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Module Card 3D ── */
.module-card-wrapper { perspective: 1000px; }
.module-card {
    position: relative;
    padding: 36px 28px 28px;
    border-radius: 20px; cursor: pointer;
    transition: all 0.3s ease;
    border: 1.5px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    min-height: 260px;
    display: flex; flex-direction: column; align-items: center;
    gap: 8px;
}
.module-card.accessible {
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.module-card.accessible:hover {
    border-color: rgba(255,255,255,0.3);
}
.module-card.locked {
    opacity: 0.55; filter: grayscale(25%);
}
.card-border-glow {
    position: absolute; inset: -2px;
    border-radius: 20px; z-index: -1;
    opacity: 0; transition: opacity 0.3s ease;
}
.module-card:hover .card-border-glow { opacity: 1; }

/* ── Module icon ── */
.module-icon { font-size: 3rem; margin: 8px 0 4px; line-height: 1; }

/* ── Module name ── */
.module-name {
    font-size: 1.3rem; font-weight: 700; text-align: center; margin: 4px 0;
    color: #e0e7ff;
}

/* ── Module description ── */
.module-description {
    color: rgba(255,255,255,0.65); text-align: center; font-size: 0.9rem; line-height: 1.4;
    flex: 1;
}

/* ── Access Badge ── */
.access-badge {
    position: absolute; top: 14px; right: 14px;
    display: flex; align-items: center; gap: 5px;
    padding: 6px 12px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 600;
    backdrop-filter: blur(8px);
}
.access-badge.granted {
    background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3);
}
.access-badge.denied {
    background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3);
}

/* ── Module Action Buttons ── */
.module-action { margin-top: auto; width: 100%; padding-top: 12px; }
.access-button, .locked-button {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 12px; font-weight: 600;
    font-size: 0.9rem; transition: all 0.3s ease;
}
.access-button {
    background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2);
}
.access-button:hover { background: rgba(255,255,255,0.18); }
.locked-button {
    background: rgba(239,68,68,0.08); color: #f87171; border: 1px solid rgba(239,68,68,0.2);
    cursor: not-allowed;
}

/* ── Modal Accès Refusé ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(4px);
}
.access-denied-modal {
    background: #fff; border-radius: 24px;
    max-width: 460px; width: 92%; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4); color: #1f2937;
}
.modal-header-red {
    position: relative; padding: 36px 24px 20px;
    background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; text-align: center;
}
.modal-icon-lock {
    display: inline-flex; padding: 16px; background: rgba(255,255,255,0.2); border-radius: 50%;
}
.modal-close {
    position: absolute; top: 12px; right: 12px;
    background: rgba(255,255,255,0.2); border: none; color: #fff;
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.3s;
}
.modal-close:hover { background: rgba(255,255,255,0.35); transform: rotate(90deg); }
.modal-body { padding: 28px; text-align: center; }
.modal-body h2 { font-size: 1.5rem; margin-bottom: 16px; }
.modal-module-name {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 1.1rem; color: #6b7280; margin-bottom: 16px;
}
.denial-reason {
    background: #fee2e2; border-left: 4px solid #ef4444;
    padding: 14px; border-radius: 8px; margin: 16px 0;
}
.denial-reason p { color: #dc2626; margin: 0; font-weight: 500; }
.help-text { color: #6b7280; font-size: 0.9rem; margin-top: 12px; }
.modal-footer {
    padding: 18px 28px; background: #f9fafb;
    display: flex; gap: 12px; justify-content: flex-end;
}
.btn-secondary, .btn-primary {
    padding: 10px 20px; border-radius: 10px; font-weight: 600;
    cursor: pointer; border: none; font-size: 0.9rem;
    display: flex; align-items: center; gap: 6px; text-decoration: none;
    transition: all 0.2s;
}
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }

/* ── Login Invite (non connecté) ── */
.login-invite {
    text-align: center; padding: 60px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    min-height: 100vh; justify-content: center;
}
.login-logo { margin-bottom: 8px; }
.login-title {
    display: flex; flex-direction: column; align-items: center; line-height: 1;
}
.login-subtitle { font-size: 1rem; color: rgba(255,255,255,0.6); letter-spacing: 4px; font-weight: 300; text-transform: uppercase; }
.login-tagline { color: rgba(255,255,255,0.7); font-size: 1.1rem; font-weight: 300; }
.login-card {
    max-width: 440px; width: 100%; padding: 40px 32px;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.login-shield-icon { color: rgba(255,255,255,0.5); }
.login-card h2 { font-size: 1.4rem; font-weight: 700; color: #fff; margin: 0; }
.login-card p { color: rgba(255,255,255,0.7); font-size: 0.95rem; line-height: 1.5; margin: 0; }
.login-btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 36px; border-radius: 14px; font-size: 1.05rem; font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; text-decoration: none;
    box-shadow: 0 6px 20px rgba(102,126,234,0.4);
    transition: all 0.3s;
    margin-top: 8px;
}
.login-btn:hover { box-shadow: 0 8px 30px rgba(102,126,234,0.6); }

/* ── Chatbot Button ── */
.chatbot-button {
    position: fixed; bottom: 28px; right: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; border: none; border-radius: 50px;
    padding: 14px 22px; display: flex; align-items: center; gap: 10px;
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    box-shadow: 0 6px 24px rgba(102,126,234,0.45);
    z-index: 999; font-family: inherit;
}
.chatbot-label { display: inline; }

/* ── Chatbot Overlay & Modal ── */
.chatbot-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: flex-end; justify-content: flex-end;
    z-index: 1000; padding: 16px;
}
.chatbot-modal {
    width: 400px; max-width: 96vw; height: 560px; max-height: 80vh;
    background: #fff; border-radius: 20px;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    overflow: hidden; color: #1f2937;
}
.chatbot-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; padding: 16px 18px;
    display: flex; align-items: center; gap: 12px;
    flex-shrink: 0;
}
.chatbot-avatar {
    font-size: 1.6rem;
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.2); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chatbot-info h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.status-online { font-size: 0.8rem; opacity: 0.85; color: #a7f3d0; }
.chatbot-close {
    margin-left: auto; background: rgba(255,255,255,0.18); border: none;
    color: #fff; width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.2s;
}
.chatbot-close:hover { background: rgba(255,255,255,0.3); }

/* ── Messages ── */
.chatbot-messages {
    flex: 1; overflow-y: auto; padding: 16px; background: #f4f5f7;
}
.msg-row { display: flex; gap: 8px; margin-bottom: 14px; }
.msg-row.user { justify-content: flex-end; }
.msg-avatar {
    font-size: 1.3rem; width: 32px; height: 32px;
    background: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.msg-bubble {
    background: #fff; padding: 10px 14px; border-radius: 16px;
    max-width: 75%; box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    font-size: 0.9rem; line-height: 1.5;
}
.msg-row.user .msg-bubble {
    background: linear-gradient(135deg, #667eea, #764ba2); color: #fff;
}
.msg-text { margin: 0; white-space: pre-line; }
.msg-time { font-size: 0.7rem; opacity: 0.5; margin-top: 4px; display: block; }

/* Data items */
.msg-data { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.data-item {
    background: #f0f4ff; border-radius: 8px; padding: 8px 10px;
    display: flex; flex-direction: column; gap: 2px;
}
.data-item strong { font-size: 0.88rem; color: #1e40af; }
.data-tags { font-size: 0.78rem; color: #6366f1; }
.data-email { font-size: 0.78rem; color: #6b7280; }

/* Actions */
.msg-actions { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.action-link {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px; background: rgba(59,130,246,0.08);
    border-radius: 8px; color: #3b82f6; text-decoration: none;
    font-size: 0.82rem; transition: background 0.2s;
}
.action-link:hover { background: rgba(59,130,246,0.15); }

/* Suggestions */
.msg-suggestions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.suggestion-chip {
    padding: 5px 10px; border-radius: 16px;
    background: #e0e7ff; color: #4338ca; border: none;
    font-size: 0.78rem; cursor: pointer; font-family: inherit;
    transition: background 0.2s;
}
.suggestion-chip:hover { background: #c7d2fe; }

/* Quick suggestions */
.quick-suggestions {
    padding: 8px 16px; background: #fff;
    display: flex; flex-wrap: wrap; gap: 6px;
    border-top: 1px solid #e5e7eb;
}
.quick-chip {
    padding: 6px 12px; border-radius: 16px;
    background: linear-gradient(135deg, #e0e7ff, #ede9fe); color: #4338ca;
    border: 1px solid #c7d2fe; font-size: 0.8rem; cursor: pointer;
    font-family: inherit; transition: all 0.2s;
}
.quick-chip:hover { background: #c7d2fe; }

/* Typing dots */
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
    width: 7px; height: 7px; border-radius: 50%; background: #9ca3af;
    animation: bounce-dot 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce-dot {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Input bar */
.chat-input-bar {
    padding: 14px 16px; background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex; gap: 8px; flex-shrink: 0;
}
.chat-input-bar input {
    flex: 1; padding: 10px 16px;
    border: 2px solid #e5e7eb; border-radius: 24px;
    font-size: 0.9rem; outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}
.chat-input-bar input:focus { border-color: #667eea; }
.send-btn {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; border: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; flex-shrink: 0;
}
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.send-btn:not(:disabled):hover { transform: scale(1.08); }

/* ── Footer ── */
.portail-footer {
    text-align: center; padding: 40px 20px 20px;
    color: rgba(255,255,255,0.3); font-size: 0.85rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .gradient-text-anim { font-size: 2.4rem; }
    .user-greeting { margin: 20px 16px; padding: 20px; flex-direction: column; text-align: center; }
    .greeting-text h2 { font-size: 1.3rem; }
    .modules-grid { padding: 20px 16px; gap: 16px; grid-template-columns: 1fr; }
    .module-card { min-height: 200px; padding: 28px 20px 20px; }
    .chatbot-modal { width: 100%; height: 70vh; }
    .chatbot-button { bottom: 16px; right: 16px; padding: 12px 16px; }
    .chatbot-label { display: none; }
    .login-card { margin: 0 16px; padding: 32px 20px; }
}
@media (max-width: 480px) {
    .gradient-text-anim { font-size: 2rem; }
    .modules-grid { padding: 16px 12px; }
}

