/* ============================================================
   SHIRKA — Design System Spatial
   Inspire du cockpit de l'Odysseus (Ulysse 31)
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Palette spatiale */
    --bg-deep:       #060a1a;
    --bg-space:      #0a0e27;
    --bg-surface:    #111638;
    --bg-panel:      #161b45;
    --bg-panel-hover:#1c2255;
    --border-dim:    rgba(0, 212, 255, 0.1);
    --border-glow:   rgba(0, 212, 255, 0.3);

    /* Cyan electrique */
    --cyan:          #00d4ff;
    --cyan-bright:   #40e0ff;
    --cyan-dim:      #0088aa;
    --cyan-glow:     rgba(0, 212, 255, 0.15);
    --cyan-glow-strong: rgba(0, 212, 255, 0.4);

    /* Texte */
    --text:          #e0e6ff;
    --text-dim:      #6b7394;
    --text-bright:   #ffffff;

    /* Statuts */
    --success:       #00ff88;
    --warning:       #ffaa00;
    --error:         #ff4466;

    /* Typographie */
    --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:     'JetBrains Mono', 'SF Mono', monospace;

    /* Espacements */
    --radius:        12px;
    --radius-sm:     8px;
    --radius-lg:     20px;

    /* Ombres */
    --shadow-glow:   0 0 20px rgba(0, 212, 255, 0.1), 0 0 60px rgba(0, 212, 255, 0.05);
    --shadow-panel:  0 4px 24px rgba(0, 0, 0, 0.4), 0 0 1px rgba(0, 212, 255, 0.1);
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* --- Etoiles animees en fond --- */
.stars-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.8) 0%, transparent 100%),
        radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 60% 40%, rgba(255,255,255,0.7) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 60%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(2px 2px at 10% 80%, rgba(0, 212, 255, 0.4) 0%, transparent 100%),
        radial-gradient(2px 2px at 90% 20%, rgba(0, 212, 255, 0.3) 0%, transparent 100%);
    background-size: 300px 300px, 400px 400px, 350px 350px, 250px 250px, 500px 500px, 450px 450px;
    animation: starsDrift 120s linear infinite;
}

@keyframes starsDrift {
    0%   { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 300px 300px, -400px 400px, 350px -350px, -250px 250px, 500px 500px, -450px 450px; }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    padding: 20px;
}

.login-card {
    background: rgba(17, 22, 56, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-glow), var(--shadow-panel);
    text-align: center;
}

.login-title {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--cyan);
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 36px;
}

.login-face-mini {
    width: 120px;
    height: 120px;
    margin: 0 auto 32px;
    border-radius: 50%;
    border: 2px solid var(--cyan);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
    overflow: hidden;
}

/* --- Inputs --- */
.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    background: rgba(6, 10, 26, 0.6);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
}

.input-field:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

.input-field::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

/* --- Boutons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--cyan-dim), var(--cyan));
    color: var(--bg-deep);
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--cyan), var(--cyan-bright));
    box-shadow: 0 4px 30px rgba(0, 212, 255, 0.5);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-glow);
    color: var(--cyan);
}

.btn-ghost:hover {
    background: var(--cyan-glow);
    border-color: var(--cyan);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--border-dim);
    color: var(--cyan);
    font-size: 1.1rem;
}

.btn-icon:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

/* ============================================================
   COCKPIT LAYOUT
   ============================================================ */
.cockpit {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    grid-template-rows: 56px 1fr;
    height: 100vh;
    gap: 0;
}

/* --- Top Bar --- */
.topbar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(11, 15, 40, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-dim);
}

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

.topbar-brand h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--cyan);
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.error { background: var(--error); box-shadow: 0 0 8px rgba(255,68,102,0.5); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 8px rgba(255,170,0,0.5); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-mode {
    display: flex;
    gap: 4px;
}

.mode-btn {
    padding: 6px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn.active {
    background: var(--cyan-glow);
    border-color: var(--cyan);
    color: var(--cyan);
}

/* --- Side Panels (Widgets) --- */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 12px;
    overflow-y: auto;
    background: rgba(6, 10, 26, 0.5);
    scrollbar-width: thin;
    scrollbar-color: var(--border-glow) transparent;
}

.side-panel-left {
    border-right: 1px solid var(--border-dim);
}

.side-panel-right {
    border-left: 1px solid var(--border-dim);
}

/* --- Widget Cards --- */
.widget {
    background: rgba(17, 22, 56, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius);
    padding: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.widget:hover {
    border-color: var(--border-glow);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.05);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.widget-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--cyan);
}

.widget-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--cyan-glow);
    color: var(--cyan);
    font-weight: 600;
}

.widget-content {
    font-size: 0.85rem;
    color: var(--text);
}

.widget-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-item:last-child { border-bottom: none; }

.widget-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--cyan-glow);
    color: var(--cyan);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.widget-item-text {
    flex: 1;
    min-width: 0;
}

.widget-item-title {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-item-meta {
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* ============================================================
   CENTRE — SHIRKA FACE + CHAT
   ============================================================ */
.center-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Zone du visage — prend tout l'espace disponible */
.face-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at center, rgba(0, 212, 255, 0.08) 0%, rgba(0, 100, 180, 0.03) 40%, transparent 70%);
}

.face-canvas {
    width: 100%;
    height: 100%;
}

/* Cercle holographique autour du visage */
.face-ring {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.1), inset 0 0 40px rgba(0, 212, 255, 0.05);
    pointer-events: none;
    animation: ringPulse 4s ease-in-out infinite;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* Barre micro flottante */
.voice-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(11, 15, 40, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-dim);
}

.mic-btn-large {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--cyan);
    background: rgba(0, 212, 255, 0.1);
    color: var(--cyan);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mic-btn-large:hover {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.3);
}

.mic-btn-large:active,
.mic-btn-large.listening {
    border-color: var(--error);
    color: var(--error);
    background: rgba(255, 68, 102, 0.15);
    box-shadow: 0 0 30px rgba(255, 68, 102, 0.3);
    animation: micPulse 1s ease-in-out infinite;
}

.voice-status {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    min-width: 160px;
    text-align: center;
}

.chat-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-dim);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-toggle-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.chat-toggle-btn.active {
    background: var(--cyan-glow);
    border-color: var(--cyan);
    color: var(--cyan);
}

/* Zone du chat (masquable) */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-dim);
    background: rgba(6, 10, 26, 0.4);
    max-height: 40vh;
    transition: max-height 0.3s, opacity 0.3s;
    overflow: hidden;
}

.chat-area.chat-hidden {
    max-height: 0;
    opacity: 0;
    border: none;
    pointer-events: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glow) transparent;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    align-self: flex-end;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.2);
    color: var(--text);
}

.chat-message.assistant {
    align-self: flex-start;
    background: rgba(17, 22, 56, 0.8);
    border: 1px solid var(--border-dim);
    color: var(--text);
}

.chat-message.assistant .msg-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--cyan);
    margin-bottom: 6px;
    font-weight: 600;
}

/* Zone de saisie */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-dim);
    background: rgba(11, 15, 40, 0.8);
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(6, 10, 26, 0.6);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: var(--cyan);
}

.chat-input::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

/* Bouton micro */
.mic-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border-dim);
    background: transparent;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

.mic-btn.listening {
    border-color: var(--error);
    color: var(--error);
    animation: micPulse 1s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 68, 102, 0.3);
}

@keyframes micPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Bouton envoyer */
.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--cyan-dim), var(--cyan));
    color: var(--bg-deep);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    background: linear-gradient(135deg, var(--cyan), var(--cyan-bright));
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   TYPING INDICATOR
   ============================================================ */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .cockpit {
        grid-template-columns: 1fr;
    }
    .side-panel { display: none; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.4);
}

/* ============================================================
   UTILITAIRES
   ============================================================ */
.hidden { display: none !important; }
.text-cyan { color: var(--cyan); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.glow { text-shadow: 0 0 10px rgba(0, 212, 255, 0.5); }
