/* assets/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Plus+Jakarta+Sans:wght@400;500;700&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --bg-dark: #030014;
    --surface: #0F0728;
    --surface-light: #1A103C;
    --primary: #7000FF;
    --primary-glow: rgba(112, 0, 255, 0.5);
    --secondary: #00C2FF;
    --text-main: #FFFFFF;
    --text-muted: #94A3B8;
    --border: rgba(255, 255, 255, 0.08);
    --font-main: 'Plus Jakarta Sans', 'Tajawal', sans-serif;
    --font-display: 'Outfit', 'Tajawal', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
}

/* --- ANIMATIONS --- */
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-15px); } }
@keyframes pulseGlow { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.animate-up { animation: slideUp 0.5s ease-out forwards; }
.animate-fade { animation: fadeIn 0.3s ease-out forwards; }

/* --- BACKGROUND FX --- */
.bg-orb {
    position: fixed; border-radius: 50%; filter: blur(100px); z-index: -1; opacity: 0.4;
    animation: float 10s infinite ease-in-out;
}
.orb-1 { top: -10%; left: -10%; width: 500px; height: 500px; background: var(--primary); }
.orb-2 { bottom: -10%; right: -10%; width: 600px; height: 600px; background: var(--secondary); animation-delay: -2s; }

/* --- GLASSMORPHISM --- */
.glass {
    background: rgba(15, 7, 40, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* --- LAYOUT GLOBAL --- */
.app-container { display: flex; height: 100vh; position: relative; }
.main-content { flex: 1; overflow-y: auto; position: relative; display: flex; flex-direction: column; }

/* --- SIDEBAR --- */
.sidebar {
    width: 280px; background: rgba(3, 0, 20, 0.95); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 50; transition: transform 0.3s ease;
}
.sidebar-header { height: 80px; display: flex; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--border); }
.logo-text { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -0.5px; }
.nav-links { padding: 20px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-muted);
    text-decoration: none; border-radius: 12px; transition: all 0.2s; margin-bottom: 5px; font-weight: 500;
}
.nav-item:hover, .nav-item.active { background: rgba(112, 0, 255, 0.15); color: #fff; border: 1px solid rgba(112, 0, 255, 0.3); }
.nav-item svg { width: 20px; height: 20px; }

/* --- RESPONSIVE SIDEBAR --- */
.mobile-toggle { display: none; position: fixed; top: 20px; right: 20px; z-index: 60; background: var(--surface); border: 1px solid var(--border); color: white; padding: 10px; border-radius: 8px; cursor: pointer; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 40; display: none; backdrop-filter: blur(5px); }

@media (max-width: 1024px) {
    .sidebar { position: fixed; height: 100%; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .mobile-toggle { display: block; }
    .overlay.open { display: block; }
}

/* --- CHAT STYLES (Le cœur du sujet) --- */
.chat-container { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; padding-bottom: 100px; }
.message-row { display: flex; width: 100%; margin-bottom: 15px; }
.message-row.user { justify-content: flex-end; }
.message-row.ai { justify-content: flex-start; }

.bubble {
    max-width: 85%; /* Largeur augmentée pour l'IA */
    padding: 20px 25px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* User Bubble */
.bubble.user {
    background: linear-gradient(135deg, var(--primary), #5000cc);
    color: white;
    border-bottom-right-radius: 4px;
}

/* AI Bubble (Glass style) */
.bubble.ai {
    background: rgba(30, 25, 60, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(10px);
    width: fit-content;
    min-width: 50%; /* Minimum width pour pas faire rikiki */
}

/* Markdown Styling inside bubbles */
.bubble h1, .bubble h2, .bubble h3 { font-family: var(--font-display); margin-top: 15px; margin-bottom: 10px; color: white; }
.bubble h1 { font-size: 1.5em; } 
.bubble h2 { font-size: 1.3em; color: var(--secondary); }
.bubble ul, .bubble ol { margin-left: 20px; margin-bottom: 10px; }
.bubble p { margin-bottom: 10px; }
.bubble strong { color: var(--secondary); font-weight: 700; }

/* Input Area Fixed Bottom */
.input-area {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(3, 0, 20, 0.8); backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 20px; z-index: 10;
}
.input-wrapper {
    max-width: 1000px; margin: 0 auto; position: relative;
    display: flex; gap: 10px; align-items: center;
}
.chat-input {
    width: 100%; background: var(--surface); border: 1px solid var(--border);
    color: white; padding: 16px 20px; border-radius: 14px; font-size: 16px;
    transition: all 0.3s;
}
.chat-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(112, 0, 255, 0.2); }
.send-btn {
    background: var(--primary); color: white; border: none; padding: 16px 24px;
    border-radius: 12px; font-weight: 700; cursor: pointer; transition: transform 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.send-btn:hover { background: #8533ff; transform: scale(1.05); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- CARTE JSON (Technique) --- */
.json-card {
    background: #050508; border: 1px solid rgba(0, 255, 128, 0.2);
    border-radius: 12px; overflow: hidden; margin-top: 15px;
    box-shadow: 0 0 20px rgba(0, 255, 128, 0.05);
}
.json-header {
    background: rgba(0, 255, 128, 0.05); padding: 10px 15px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(0, 255, 128, 0.1);
}
.json-content {
    padding: 15px; color: #a3b3bc; font-family: monospace; font-size: 12px;
    overflow-x: auto; max-height: 150px;
}
.json-actions { padding: 15px; border-top: 1px solid rgba(255,255,255,0.05); }

/* --- GRID DASHBOARD --- */
.grid-projects {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding: 20px;
}
.project-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 20px; transition: all 0.3s; position: relative; overflow: hidden;
}
.project-card:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.status-badge {
    padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: bold; text-transform: uppercase;
}
.status-generated { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.status-draft { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }

/* RTL OVERRIDES */
html[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
html[dir="rtl"] .message-row.user { justify-content: flex-start; } /* User à gauche en Arabe ? Non, standard chat reste user à droite souvent, mais on peut inverser si tu préfères */
html[dir="rtl"] .bubble { text-align: right; }
html[dir="rtl"] .sidebar { transform: translateX(100%); } /* Mobile sidebar from right */
html[dir="rtl"] .sidebar.open { transform: translateX(0); }