/* Style Futuriste & Cyberpunk / Sombre - IBI GROUP AI */
:root {
    --bg-dark: #090c10;
    --sidebar-bg: #0d1117;
    --card-bg: #161b22;
    --input-bg: #21262d;
    --border-color: #30363d;
    --primary-blue: #0088ff;
    --primary-hover: #0066cc;
    --accent-glow: rgba(0, 136, 255, 0.4);
    --text-main: #c9d1d9;
    --text-white: #ffffff;
    --text-muted: #8b949e;
    --user-msg-bg: #1f242d;
    --ai-msg-bg: #161b22;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Page d'Authentification */
.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #111827 0%, #090c10 100%);
    min-height: 100vh;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.auth-header {
    text-align: center;
    margin-bottom: 25px;
}

.brand-logo {
    font-size: 40px;
    color: var(--primary-blue);
    margin-bottom: 10px;
}

.auth-header h2 {
    color: var(--text-white);
    font-size: 22px;
    margin-bottom: 5px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 13px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 14px;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-blue);
}

.btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: 0.2s;
}

.btn-primary {
    background: var(--primary-blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.w-100 { width: 100%; }

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 15px;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #f87171;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
}
.auth-footer a {
    color: var(--primary-blue);
    text-decoration: none;
}

/* Layout Principal */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

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

.brand-icon {
    background: var(--primary-blue);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
}

.brand-title {
    font-weight: 700;
    color: var(--text-white);
    font-size: 16px;
}

.mobile-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.action-btn-container {
    padding: 15px;
}

.btn-new-chat {
    width: 100%;
    background: var(--primary-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.sidebar-section {
    padding: 10px 15px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.module-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: 0.2s;
}

.module-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.module-item.active {
    background: var(--primary-blue);
    color: #fff;
}

.module-title {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.module-desc {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

.history-section {
    flex: 1;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 4px;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-item.active {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-white);
}

.delete-hist {
    opacity: 0;
    color: var(--text-muted);
}

.history-item:hover .delete-hist {
    opacity: 1;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: var(--sidebar-bg);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #374151;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-white);
}

.user-email {
    font-size: 11px;
    color: var(--text-muted);
}

.footer-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.footer-link {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.footer-link:hover { color: var(--text-white); }
.logout-link:hover { color: #f87171; }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
}

.top-header {
    height: 55px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--sidebar-bg);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.header-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-white);
}

.header-status {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-indicator.online { background: #10b981; }

.api-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Chat Section */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.welcome-screen {
    text-align: center;
    margin: auto;
    max-width: 400px;
}

.welcome-icon {
    font-size: 50px;
    color: var(--primary-blue);
    margin-bottom: 15px;
}

.welcome-screen h3 {
    color: var(--text-white);
    margin-bottom: 8px;
}

.welcome-screen p {
    color: var(--text-muted);
    font-size: 13px;
}

.msg-row {
    display: flex;
    max-width: 80%;
}

.msg-row.user {
    margin-left: auto;
}

.msg-row.ai {
    margin-right: auto;
}

.msg-bubble {
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
}

.msg-row.user .msg-bubble {
    background: var(--user-msg-bg);
    border: 1px solid var(--border-color);
    color: var(--text-white);
    border-bottom-right-radius: 2px;
}

.msg-row.ai .msg-bubble {
    background: var(--ai-msg-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}

pre {
    background: #0d1117;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin-top: 10px;
    border: 1px solid var(--border-color);
    font-family: monospace;
    color: #58a6ff;
}

.generated-image-box {
    margin-top: 10px;
}

.generated-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: block;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 14px;
    background: var(--primary-blue);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

/* Footer Prompt Input */
.prompt-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--sidebar-bg);
}

.prompt-box {
    display: flex;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 12px;
    align-items: center;
    gap: 10px;
}

.prompt-box textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-white);
    font-size: 14px;
    resize: none;
    max-height: 120px;
}

.btn-send {
    background: var(--primary-blue);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prompt-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}

/* PWA Bottom Nav Mobile */
.pwa-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    justify-content: space-around;
    align-items: center;
    z-index: 200;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    cursor: pointer;
    gap: 4px;
}

.nav-item i {
    font-size: 18px;
}

.nav-item.active {
    color: var(--primary-blue);
}

/* Responsivité Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 80%;
        transition: 0.3s ease;
    }
    .sidebar.active {
        left: 0;
    }
    .mobile-close-btn, .mobile-menu-btn {
        display: block;
    }
    .pwa-bottom-nav {
        display: flex;
    }
    .prompt-footer {
        padding-bottom: 75px;
    }
}
