/* ============ TOKENS — thème Dark Red ============ */
:root {
  --bg-main: #050304;
  --bg-sidebar: rgba(8, 3, 4, 0.88);
  --bg-card: #120709;
  --bg-card-hover: #1c0b0f;
  --bg-user-msg: linear-gradient(135deg, #8a1020, #2b070d);
  --border-color: rgba(255, 70, 85, 0.16);
  --border-focus: #ff3b4a;
  --text-primary: #fff3f3;
  --text-secondary: #c9a3a8;
  --text-muted: #7e5a60;
  --accent: #e11d2e;
  --accent-glow: rgba(225, 29, 46, 0.45);
  --red: #ff3b4a;
  --crimson: #a30f22;
  --cyan: var(--red);      /* alias de compatibilité */
  --violet: var(--crimson);/* alias de compatibilité */
  --rgb: 255, 59, 74;
  --amber: #ff9f43;
  --danger: #ef4444;
  --success: #34d399;
  --grad: linear-gradient(135deg, #ff3b4a, #e11d2e 55%, #8f0a1a);
  --font-display: 'Sora', 'Inter', sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg-main); color: var(--text-primary); overflow: hidden; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .brand { font-family: var(--font-display); }
button { font-family: inherit; }
::selection { background: rgba(var(--rgb), 0.45); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(var(--rgb), 0.25); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--rgb), 0.5); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* Flou de verre partagé */
.sidebar, .topbar, .code-window, .input-box, .auth-card, .toast, .suggestion,
.message.assistant .message-content, .sidebar-overlay.active { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }

/* Scanlines + vignette (ambiance terminal) */
body::before { content: ''; position: fixed; inset: 0; z-index: 9998; pointer-events: none; opacity: 0.5;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px); }
body::after { content: ''; position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.65)); }

.app { display: flex; height: 100vh; height: 100dvh; width: 100vw; position: relative; }

/* ============ AURORA + BRAISES ============ */
.aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; transition: opacity 0.6s; }
.aurora i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(100px); animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: var(--red); top: -24vmax; left: 4%; opacity: 0.2; }
.aurora i:nth-child(2) { background: var(--accent); top: -14vmax; right: -14vmax; opacity: 0.3; animation-delay: -8s; }
.aurora i:nth-child(3) { background: var(--crimson); bottom: -30vmax; left: 28%; opacity: 0.28; animation-delay: -15s; }
.aurora::after { content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(var(--rgb), 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--rgb), 0.07) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000, transparent 72%); mask-image: radial-gradient(ellipse at 50% 0%, #000, transparent 72%); }
.aurora::before { content: ''; position: absolute; inset: 0; opacity: 0.55; animation: embers 16s linear infinite;
  background-image: radial-gradient(2px 2px at 20px 30px, #ff3b4a, transparent), radial-gradient(1.5px 1.5px at 90px 120px, #ff7a5c, transparent), radial-gradient(2px 2px at 160px 60px, #ff3b4a, transparent), radial-gradient(1.5px 1.5px at 60px 170px, #ff9f43, transparent);
  background-size: 200px 200px; }
.main:has(#view-workspace:not(.hidden)) .aurora { opacity: 0.55; }

/* ============ SIDEBAR ============ */
.sidebar { width: 280px; background: var(--bg-sidebar); border-right: 1px solid var(--border-color); padding: 20px 16px; display: flex; flex-direction: column; flex-shrink: 0; transition: transform 0.35s var(--ease); z-index: 30; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 700; letter-spacing: -0.4px; }
.brand-icon { background: var(--grad); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; box-shadow: 0 4px 18px var(--accent-glow); animation: heartbeat 3s ease-in-out infinite; }
.brand-icon svg { width: 19px; height: 19px; color: #fff; }

.sidebar-nav-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.sidebar-nav-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: transparent; border: 1px solid transparent; border-radius: 11px; color: var(--text-secondary); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: background 0.2s, color 0.2s, transform 0.2s; width: 100%; text-align: left; }
.sidebar-nav-item:hover { background: rgba(var(--rgb), 0.08); color: var(--text-primary); transform: translateX(3px); }
.sidebar-nav-item.active { background: rgba(var(--rgb), 0.14); color: #ffb4ba; border-color: rgba(var(--rgb), 0.35); }
.sidebar-nav-item.active::before { content: ''; position: absolute; left: -17px; top: 20%; bottom: 20%; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); box-shadow: 0 0 14px var(--red); }
.sidebar-nav-item svg { width: 17px; height: 17px; }

.new-chat, .btn-primary-glow { position: relative; overflow: hidden; background: var(--grad); color: #fff; border: none; cursor: pointer; transition: transform 0.25s var(--ease), box-shadow 0.25s; }
.new-chat::after, .btn-primary-glow::after { content: ''; position: absolute; inset: 0; transform: translateX(-120%); background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.32), transparent 70%); transition: transform 0.7s var(--ease); }
.new-chat:hover::after, .btn-primary-glow:hover::after { transform: translateX(120%); }
.new-chat:active, .btn-primary-glow:active { transform: scale(0.98); }
.new-chat { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 22px rgba(225, 29, 46, 0.35); }
.new-chat:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(225, 29, 46, 0.55); }
.new-chat svg { width: 18px; height: 18px; }

.sidebar-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; margin-top: 18px; }
.sidebar-label { color: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; margin-bottom: 8px; padding-left: 6px; text-transform: uppercase; }
.history-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; }
.history-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; color: var(--text-secondary); font-size: 13.5px; cursor: pointer; transition: all 0.18s; border: 1px solid transparent; }
.history-item:hover { background: rgba(var(--rgb), 0.08); color: var(--text-primary); transform: translateX(3px); }
.history-item.active { background: var(--bg-card); color: var(--text-primary); border-color: rgba(var(--rgb), 0.3); font-weight: 500; box-shadow: inset 2px 0 0 var(--red); }
.history-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; padding-right: 8px; }
.delete-chat-btn { opacity: 0; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; place-items: center; transition: all 0.15s; }
.history-item:hover .delete-chat-btn { opacity: 1; }
.delete-chat-btn:hover { color: var(--danger); background: rgba(239, 68, 68, 0.15); }
.delete-chat-btn svg { width: 14px; height: 14px; }

.sidebar-footer { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 10px; }
.roblox-token-btn { background: rgba(143, 10, 26, 0.25) !important; border-color: rgba(var(--rgb), 0.35) !important; color: #ffc2c7 !important; width: 100%; }
.roblox-token-btn:hover { background: rgba(var(--rgb), 0.3) !important; color: #fff !important; box-shadow: 0 0 20px rgba(var(--rgb), 0.3); }
.sidebar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.footer-btn { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 9px; color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: 0.2s; }
.footer-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); transform: translateY(-1px); border-color: rgba(var(--rgb), 0.35); }
.footer-btn.danger:hover { border-color: rgba(239, 68, 68, 0.6); color: #fca5a5; }
.footer-btn svg { width: 14px; height: 14px; }

.account-box { background: rgba(var(--rgb), 0.04); border: 1px solid var(--border-color); border-radius: 13px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.credits-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; }
.credits-label { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.credits-label svg { width: 14px; height: 14px; color: var(--amber); }
.plan-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: rgba(var(--rgb), 0.16); color: #ffb4ba; letter-spacing: 0.04em; }
.credits-count { font-weight: 700; color: var(--amber); font-size: 12px; }
.credits-bar-bg { width: 100%; height: 6px; background: rgba(var(--rgb), 0.12); border-radius: 10px; overflow: hidden; }
.credits-bar-fill { height: 100%; border-radius: 10px; background: linear-gradient(90deg, #8f0a1a, var(--red), var(--amber), var(--red), #8f0a1a); background-size: 200% 100%; animation: flow 4s linear infinite; transition: width 0.5s var(--ease); box-shadow: 0 0 10px rgba(var(--rgb), 0.6); }
.credits-bar-fill.empty { background: var(--danger); animation: none; }
.user-email-row { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; border-top: 1px solid var(--border-color); }
.user-email-text { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 185px; }
.logout-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px; border-radius: 6px; display: grid; place-items: center; transition: 0.2s; }
.logout-btn:hover { color: var(--danger); background: rgba(239, 68, 68, 0.15); }
.logout-btn svg { width: 15px; height: 15px; }

/* ============ MAIN ============ */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; overflow: hidden; }
.main > section { position: relative; z-index: 1; }
.topbar { height: 64px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: rgba(5, 3, 4, 0.65); z-index: 10; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.persona-selector, .temp-control { display: flex; align-items: center; gap: 8px; background: rgba(var(--rgb), 0.05); border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 11px; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; }
.persona-selector:hover, .temp-control:hover { border-color: rgba(var(--rgb), 0.55); background: rgba(var(--rgb), 0.09); box-shadow: 0 0 18px rgba(var(--rgb), 0.15); }
.persona-icon { width: 16px; height: 16px; color: var(--red); }
.persona-selector select { background: transparent; color: var(--text-primary); border: none; outline: none; font-family: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.persona-selector select option { background: #0c0507; color: var(--text-primary); }
.temp-control { font-size: 12px; color: var(--text-secondary); }
.temp-control svg { width: 14px; height: 14px; color: #fb923c; }
.temp-control input[type="range"] { width: 65px; accent-color: var(--red); cursor: pointer; }
.icon-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; transition: 0.2s; }
.icon-btn:hover { background: rgba(var(--rgb), 0.14); color: #fff; }
.mobile-only { display: none; }

/* ============ ACCUEIL ============ */
.home-view { flex: 1; overflow-y: auto; padding: 48px 28px 56px; display: flex; flex-direction: column; }
.home-view.hidden, .workspace-view.hidden { display: none !important; }
.home-container { max-width: 1040px; margin: 0 auto; width: 100%; }
.home-hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 44px; align-items: center; margin-bottom: 72px; }
.badge-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(var(--rgb), 0.09); border: 1px solid rgba(var(--rgb), 0.35); color: #ff9aa3; padding: 6px 14px; border-radius: 20px; font-size: 12.5px; font-weight: 600; margin-bottom: 20px; box-shadow: 0 0 20px rgba(var(--rgb), 0.12); }
.badge-pill svg { width: 14px; height: 14px; }
.home-hero h1, .welcome h1 { background: linear-gradient(180deg, #fff 25%, #ff6b78 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 0 22px rgba(var(--rgb), 0.35)); }
.home-hero h1 { font-size: clamp(30px, 4.4vw, 50px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.1; margin-bottom: 18px; }
.home-hero p { color: var(--text-secondary); font-size: 16px; line-height: 1.65; margin-bottom: 30px; max-width: 480px; }
.btn-primary-glow { padding: 15px 30px; border-radius: 14px; font-size: 15px; font-weight: 600; box-shadow: 0 12px 30px rgba(225, 29, 46, 0.45); animation: pulseGlow 3s ease-in-out infinite; }
.btn-primary-glow:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(225, 29, 46, 0.65); }

.code-window { background: rgba(10, 4, 6, 0.8); border: 1px solid rgba(var(--rgb), 0.28); border-radius: 16px; overflow: hidden; position: relative; box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7), 0 0 60px rgba(225, 29, 46, 0.22); transform: rotate(1.2deg); transition: transform 0.5s var(--ease); }
.code-window::after { content: ''; position: absolute; left: 0; right: 0; height: 40px; top: 0; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(var(--rgb), 0.12), transparent); animation: scan 5s linear infinite; }
.code-window:hover { transform: rotate(0deg) translateY(-4px); }
.cw-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--border-color); background: rgba(var(--rgb), 0.05); }
.cw-bar b { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; }
.cw-bar b:nth-child(2) { background: #ff9f43; }
.cw-bar b:nth-child(3) { background: #7e5a60; }
.cw-bar span { margin-left: 10px; font: 12px 'JetBrains Mono', monospace; color: var(--text-muted); }
.code-window pre { padding: 18px 20px 22px; font: 12.5px/1.75 'JetBrains Mono', monospace; color: #e8c9cc; overflow: hidden; }
.ln { display: block; opacity: 0; animation: typeIn 0.5s var(--ease) forwards; animation-delay: calc(0.9s + var(--i) * 0.22s); }
.ln.cur::after { content: ''; display: inline-block; width: 7px; height: 14px; margin-left: 3px; vertical-align: -2px; background: var(--red); animation: blink 1s steps(1) infinite; }
.k { color: #ff6b78; } .s { color: #ffb86b; } .f { color: #ff9aa3; } .c { color: #7e5a60; font-style: italic; }

/* Tarifs */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 40px; }
.pricing-card, .suggestion { position: relative; }
.pricing-card::after, .suggestion::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.3s; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--rgb), 0.2), transparent 70%); }
.pricing-card:hover::after, .suggestion:hover::after { opacity: 1; }
.pricing-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 22px; padding: 30px 26px; display: flex; flex-direction: column; transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s; }
.pricing-card:hover { transform: translateY(-6px); border-color: rgba(var(--rgb), 0.4); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(var(--rgb), 0.12); }
.pricing-card.popular { background: linear-gradient(180deg, rgba(225, 29, 46, 0.18), var(--bg-card) 60%); border-color: transparent; box-shadow: 0 20px 50px rgba(225, 29, 46, 0.25); }
.pricing-card.popular::before { content: ''; position: absolute; inset: -1px; border-radius: 23px; padding: 1.5px; pointer-events: none; background: conic-gradient(from var(--ang), transparent 0 55%, #ff3b4a, #e11d2e, #ff9f43, transparent); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); animation: spin 5s linear infinite; }
.pricing-card.ultra { border-color: rgba(163, 15, 34, 0.6); background: linear-gradient(180deg, rgba(143, 10, 26, 0.2), var(--bg-card) 60%); }
.pricing-card.ultra:hover { box-shadow: 0 24px 50px rgba(163, 15, 34, 0.35); }
.popular-tag { position: absolute; top: -12px; right: 24px; background: var(--grad); color: #fff; font-size: 10.5px; font-weight: 700; padding: 4px 11px; border-radius: 20px; letter-spacing: 0.04em; box-shadow: 0 4px 14px var(--accent-glow); z-index: 2; }
.pricing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.pricing-header h3 { font-size: 18px; font-weight: 700; color: #fff; }
.pricing-header h3.t-pro { color: #ff7b86; }
.pricing-header h3.t-ultra { color: #ff9aa3; }
.pricing-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: rgba(var(--rgb), 0.1); color: var(--text-secondary); }
.pricing-badge.pro { background: rgba(var(--rgb), 0.16); color: #ff9aa3; }
.pricing-badge.ultra { background: rgba(163, 15, 34, 0.3); color: #ffc2c7; }
.pricing-price { font-family: var(--font-display); font-size: 36px; font-weight: 800; letter-spacing: -0.03em; color: #fff; margin-bottom: 10px; }
.pricing-price .period { font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--text-muted); }
.pricing-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 22px; min-height: 40px; }
.pricing-features { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; flex: 1; font-size: 13.5px; color: #e8c9cc; }
.pricing-features li { display: flex; align-items: center; gap: 10px; }
.pricing-features li svg { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }
.pricing-btn { width: 100%; padding: 13px; border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, background 0.2s; border: none; color: #fff; }
.pricing-btn:hover:not(:disabled) { transform: translateY(-2px); }
.pricing-btn:active:not(:disabled) { transform: scale(0.98); }
.pricing-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pricing-btn.secondary { background: rgba(var(--rgb), 0.09); border: 1px solid var(--border-color); }
.pricing-btn.secondary:hover { background: rgba(var(--rgb), 0.18); border-color: rgba(var(--rgb), 0.45); }
.pricing-btn.primary { background: linear-gradient(135deg, #ff3b4a, #e11d2e); box-shadow: 0 8px 22px rgba(225, 29, 46, 0.4); }
.pricing-btn.ultra-glow { background: linear-gradient(135deg, #a30f22, #5c0713); box-shadow: 0 8px 22px rgba(163, 15, 34, 0.4); }

/* Entrée orchestrée */
.home-view:not(.hidden) .hero-copy > *, .home-view:not(.hidden) .code-window, .home-view:not(.hidden) .pricing-card { animation: rise 0.8s var(--ease) backwards; }
.hero-copy > :nth-child(2) { animation-delay: 0.08s !important; }
.hero-copy > :nth-child(3) { animation-delay: 0.16s !important; }
.hero-copy > :nth-child(4) { animation-delay: 0.24s !important; }
.home-view:not(.hidden) .code-window { animation-delay: 0.2s; }
.pricing-card:nth-child(1) { animation-delay: 0.35s !important; }
.pricing-card:nth-child(2) { animation-delay: 0.45s !important; }
.pricing-card:nth-child(3) { animation-delay: 0.55s !important; }

/* ============ WORKSPACE ============ */
.workspace-view { flex: 1; display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: hidden; }
.chat-container { flex: 1; overflow-y: auto; padding: 24px 20px; scroll-behavior: smooth; }
.welcome { max-width: 720px; margin: 4vh auto 0; text-align: center; position: relative; animation: fadeIn 0.6s var(--ease); }
.welcome-icon { width: 68px; height: 68px; margin: 0 auto 24px; background: linear-gradient(135deg, rgba(var(--rgb), 0.2), rgba(143, 10, 26, 0.3)); border: 1px solid rgba(var(--rgb), 0.45); border-radius: 22px; display: grid; place-items: center; color: #ff9aa3; box-shadow: 0 14px 40px rgba(225, 29, 46, 0.4); animation: float 5s ease-in-out infinite, pulseGlow 3s ease-in-out infinite; }
.welcome-icon svg { width: 32px; height: 32px; }
.welcome h1 { font-size: clamp(24px, 3.5vw, 36px); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 12px; }
.welcome p { color: var(--text-secondary); font-size: 15.5px; line-height: 1.6; max-width: 540px; margin: 0 auto; }
.suggestions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 36px; }
.suggestion { display: flex; align-items: center; gap: 14px; background: rgba(18, 7, 9, 0.75); border: 1px solid var(--border-color); padding: 16px; border-radius: 15px; cursor: pointer; text-align: left; color: inherit; transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s; }
.suggestion:hover { border-color: rgba(var(--rgb), 0.55); transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(var(--rgb), 0.15); }
.sug-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(var(--rgb), 0.16); color: #ff8a93; display: grid; place-items: center; flex-shrink: 0; transition: 0.25s; }
.suggestion:hover .sug-icon { background: var(--grad); color: #fff; }
.sug-text { display: flex; flex-direction: column; gap: 3px; }
.sug-text strong { color: var(--text-primary); font-size: 14px; }
.sug-text span { color: var(--text-secondary); font-size: 12.5px; }

/* Messages */
.messages { max-width: 820px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 24px; }
.message { display: flex; flex-direction: column; animation: slideUp 0.35s var(--ease); }
.message-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.message.user { align-items: flex-end; }
.message.user .message-header { flex-direction: row-reverse; }
.message.user .message-content { background: var(--bg-user-msg); color: #fff; padding: 14px 18px; border-radius: 18px 18px 4px 18px; max-width: 80%; white-space: pre-wrap; line-height: 1.6; font-size: 15px; border: 1px solid rgba(var(--rgb), 0.3); box-shadow: 0 8px 28px rgba(225, 29, 46, 0.3); }
.message.assistant .message-content { background: rgba(18, 7, 9, 0.78); border: 1px solid var(--border-color); border-left: 2px solid var(--red); padding: 18px 22px; border-radius: 4px 18px 18px 18px; line-height: 1.75; font-size: 15px; color: #f5dede; overflow-wrap: anywhere; }
.message.assistant .message-content p { margin-bottom: 12px; }
.message.assistant .message-content p:last-child { margin-bottom: 0; }
.message.assistant .message-content ul, .message.assistant .message-content ol { margin: 10px 0 14px 22px; }
.message.assistant .message-content li { margin-bottom: 6px; }
.message.assistant .message-content code:not(pre code) { background: rgba(var(--rgb), 0.15); padding: 2px 6px; border-radius: 5px; font-family: 'JetBrains Mono', monospace; font-size: 13.5px; color: #ff9aa3; }

.code-block-wrapper { margin: 14px 0; border-radius: 13px; overflow: hidden; border: 1px solid rgba(var(--rgb), 0.22); background: #0a0405; }
.code-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: rgba(var(--rgb), 0.07); font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); }
.copy-code-btn { display: flex; align-items: center; gap: 5px; background: rgba(var(--rgb), 0.12); border: none; color: #ffb4ba; padding: 4px 10px; border-radius: 6px; font-size: 11.5px; cursor: pointer; transition: 0.2s; }
.copy-code-btn:hover { background: var(--accent); color: #fff; }
.code-block-wrapper pre { margin: 0; padding: 14px; overflow-x: auto; font-family: 'JetBrains Mono', monospace; font-size: 13.5px; line-height: 1.55; }
.code-block-wrapper pre code.hljs { background: transparent; padding: 0; }

.message-actions { display: flex; gap: 8px; margin-top: 8px; }
.msg-action-btn { display: flex; align-items: center; gap: 5px; background: transparent; border: 1px solid transparent; color: var(--text-muted); font-size: 12px; padding: 4px 8px; border-radius: 7px; cursor: pointer; transition: 0.18s; }
.msg-action-btn:hover { background: rgba(var(--rgb), 0.1); color: var(--text-primary); border-color: var(--border-color); }
.msg-action-btn svg { width: 13px; height: 13px; }

.typing-indicator { display: flex; align-items: center; gap: 5px; padding: 6px 4px; }
.typing-indicator span { width: 7px; height: 7px; background: var(--red); border-radius: 50%; box-shadow: 0 0 12px var(--red); animation: bounce 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.error-box { border-color: rgba(239, 68, 68, 0.5) !important; background: rgba(239, 68, 68, 0.12) !important; color: #fca5a5 !important; }

/* Saisie */
.input-area { width: 100%; max-width: 860px; padding: 12px 20px 18px; margin: 0 auto; }
.input-box { background: rgba(18, 7, 9, 0.88); border: 1px solid rgba(var(--rgb), 0.22); border-radius: 20px; display: flex; flex-direction: column; padding: 12px 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55); transition: border-color 0.25s, box-shadow 0.25s; }
.input-box:focus-within { border-color: var(--red); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(var(--rgb), 0.12), 0 0 44px rgba(225, 29, 46, 0.3); }
textarea { width: 100%; resize: none; max-height: 180px; background: transparent; color: var(--text-primary); border: none; outline: none; font-family: inherit; font-size: 15px; line-height: 1.5; padding: 4px; }
textarea::placeholder { color: var(--text-muted); }
.input-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-color); }
.char-count { font-size: 11.5px; color: var(--text-muted); }
#send-btn { width: 38px; height: 38px; background: var(--grad); color: #fff; border: none; border-radius: 12px; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px var(--accent-glow); transition: transform 0.2s var(--ease), box-shadow 0.2s; }
#send-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.08); box-shadow: 0 10px 28px rgba(225, 29, 46, 0.7); }
#send-btn:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.disclaimer { text-align: center; color: var(--text-muted); font-size: 11.5px; margin-top: 10px; }

.toast { position: fixed; bottom: 24px; right: 24px; background: rgba(18, 7, 9, 0.96); color: #fff; border: 1px solid rgba(var(--rgb), 0.5); padding: 11px 18px; border-radius: 12px; font-size: 13px; font-weight: 500; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.7), 0 0 24px rgba(var(--rgb), 0.2); transform: translateY(100px); opacity: 0; transition: all 0.4s var(--ease); z-index: 10000; }
.toast.show { transform: translateY(0); opacity: 1; }

/* ============ AUTH ============ */
.auth-screen { position: fixed; inset: 0; background: var(--bg-main); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 200; overflow: hidden; }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 410px; background: rgba(18, 7, 9, 0.8); border: 1px solid rgba(var(--rgb), 0.28); border-radius: 22px; padding: 34px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75), 0 0 80px rgba(225, 29, 46, 0.22); animation: rise 0.8s var(--ease) backwards; }
.auth-card::before { content: ''; position: absolute; top: 0; left: 18%; right: 18%; height: 1px; background: linear-gradient(90deg, transparent, var(--red), transparent); }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.auth-logo h2 { font-size: 20px; letter-spacing: -0.02em; }
.auth-subtitle { text-align: center; font-size: 13.5px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }
.auth-subtitle strong { color: var(--amber); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: rgba(5, 3, 4, 0.75); padding: 4px; border-radius: 13px; margin-bottom: 20px; border: 1px solid var(--border-color); }
.auth-tab { background: transparent; border: none; color: var(--text-secondary); padding: 9px; border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: 0.25s; }
.auth-tab:hover { color: #fff; }
.auth-tab.active { background: var(--bg-card-hover); color: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(var(--rgb), 0.3); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-providers { display: grid; gap: 10px; }
.provider-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; border: 1px solid var(--border-color); border-radius: 11px; background: rgba(5,3,4,.7); color: var(--text-primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: .2s; }
.provider-btn:hover { border-color: rgba(var(--rgb),.6); background: var(--bg-card-hover); }
.provider-btn:disabled { opacity: .55; cursor: wait; }
.provider-btn svg { width: 17px; height: 17px; }
.google-mark { font: 700 17px Arial,sans-serif; color: #4285f4; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--text-muted); font-size: 11px; }
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; flex: 1; background: var(--border-color); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.form-group input:not([type="checkbox"]) { background: rgba(5, 3, 4, 0.75); border: 1px solid var(--border-color); border-radius: 11px; padding: 12px 14px; color: #fff; font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:not([type="checkbox"]):focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(var(--rgb), 0.12), 0 0 20px rgba(var(--rgb), 0.2); }
.auth-feedback { font-size: 13px; line-height: 1.4; padding: 10px 12px; border-radius: 10px; display: none; }
.auth-feedback.error { display: block; background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; }
.auth-feedback.success { display: block; background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35); color: #6ee7b7; }
.auth-submit-btn { background: var(--grad); color: #fff; border: none; border-radius: 12px; padding: 13px; font-size: 14.5px; font-weight: 600; cursor: pointer; box-shadow: 0 10px 26px rgba(225, 29, 46, 0.42); transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s; }
.auth-submit-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(225, 29, 46, 0.65); }
.auth-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* CGU */
.checkbox-group { margin-top: 4px; }
.checkbox-label { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px; font-size: 12px !important; color: var(--text-secondary); cursor: pointer; line-height: 1.4; }
.checkbox-label input[type="checkbox"] { accent-color: var(--red); width: 16px; height: 16px; margin-top: 1px; cursor: pointer; flex-shrink: 0; }
.checkbox-label a { color: var(--red); text-decoration: underline; }
.checkbox-label a:hover { color: #fff; }

/* ============ ANIMATIONS ============ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes typeIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
@keyframes drift { to { transform: translate3d(7vmax, 5vmax, 0) scale(1.18); } }
@keyframes spin { to { --ang: 360deg; } }
@keyframes flow { to { background-position: 200% 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes embers { from { background-position: 0 0; } to { background-position: 40px -400px; } }
@keyframes scan { from { top: -40px; } to { top: 100%; } }
@keyframes heartbeat { 0%, 100% { box-shadow: 0 4px 18px var(--accent-glow); } 50% { box-shadow: 0 4px 30px rgba(255, 59, 74, 0.85); } }
@keyframes pulseGlow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; gap: 34px; margin-bottom: 52px; }
  .code-window { transform: none; }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); background: rgba(8, 3, 4, 0.97); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 20; }
  .mobile-only { display: grid; }
  .temp-control { display: none; }
  .topbar { padding: 0 14px; }
  .topbar-right { gap: 8px; }
  .home-view { padding: 32px 18px 44px; }
  .pricing-grid, .suggestions { grid-template-columns: 1fr; }
  .message.user .message-content { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .ln { opacity: 1; }
}

/* Auth providers and image attachments */
.input-tools { display:flex; align-items:center; gap:14px; }
.attach-image-btn { display:inline-flex; align-items:center; gap:6px; padding:7px 10px; border:1px solid var(--border-color); border-radius:9px; color:var(--text-secondary); cursor:pointer; font-size:12px; }
.attach-image-btn:hover { color:white; border-color:rgba(var(--rgb),.55); }
.attach-image-btn svg { width:16px; height:16px; }
.image-preview-list, .message-image-gallery { display:flex; flex-wrap:wrap; gap:8px; }
.image-preview-list:not(:empty) { margin-top:10px; }
.image-preview-item { position:relative; width:66px; height:66px; }
.image-preview-item img, .message-image-gallery img { width:100%; height:100%; object-fit:cover; border-radius:9px; border:1px solid var(--border-color); }
.image-preview-item button { position:absolute; top:-6px; right:-6px; width:22px; height:22px; border:0; border-radius:50%; background:var(--red); color:white; cursor:pointer; font-size:17px; line-height:1; }
.message-image-gallery { margin-top:8px; }
.message-image-gallery img { width:min(220px, 42vw); height:160px; }
