/* ========================================
   SITIA - DESIGN CHATGPT-STYLE - MODE SOMBRE PERMANENT
   ======================================== */

   :root {
    --primary-color: #303030;
    --primary-hover: #212121;
    --secondary-color: #303030;
    --accent-color: #303030;
    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --text-muted: #cccccc;
    --bg-primary: #212121;
    --bg-secondary: #303030;
    --bg-tertiary: #212121;
    --border-color: #303030;
    --border-hover: #303030;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.2);
    --sidebar-width: 260px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* ========================================
   SIDEBAR GAUCHE - STYLE CHATGPT
   ======================================== */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
}

.logo i {
    font-size: 2rem;
    color: #ffffff;
}

.sidebar-nav {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nav-btn.new-chat {
    width: 100%;
    padding: 12px 16px;
    background: #303030;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.nav-btn.new-chat:hover {
    background: #212121;
    transform: translateY(-1px);
}

.search-section {
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-btn {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    font-size: 0.9rem;
}

.settings-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ========================================
   CONTENU PRINCIPAL
   ======================================== */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 0;
    max-width: calc(100vw - var(--sidebar-width));
}

.main-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 40px;
}

.ai-selector-container {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: center;
}

.ai-selector-container label {
    font-weight: 600;
    color: var(--text-secondary);
}

.ai-selector-container select {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #2a2a2a !important;
    color: #ffffff !important;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 200px;
    appearance: auto !important;
    -webkit-appearance: auto !important;
    -moz-appearance: auto !important;
}

.ai-selector-container select option {
    background: #2a2a2a !important;
    color: #ffffff !important;
    padding: 8px;
    border: none;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.ai-selector-container select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.2);
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00d4aa;
}

.status-dot.active {
    background: #00d4aa;
}

.status-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ========================================
   SECTION DESCRIPTION CENTRALE
   ======================================== */

.description-section {
    text-align: center;
    padding: 60px 40px;
    background: var(--bg-primary);
    margin: 0;
    min-height: 90vh;
    border: none;
    box-shadow: none;
}

.description-section h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.description-section p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.description-input {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.description-input textarea {
    width: 100%;
    padding: 25px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 180px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

/* Stylisation de la barre de défilement */
.description-input textarea::-webkit-scrollbar {
    width: 8px;
}

.description-input textarea::-webkit-scrollbar-track {
    background: #212121;
    border-radius: 4px;
}

.description-input textarea::-webkit-scrollbar-thumb {
    background: #303030;
    border-radius: 4px;
}

.description-input textarea::-webkit-scrollbar-thumb:hover {
    background: #404040;
}

/* Support Firefox */
.description-input textarea {
    scrollbar-width: thin;
    scrollbar-color: #303030 #212121;
}

.description-input textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.char-counter {
    font-size: 0.9rem;
    color: var(--text-muted);
}

#generateBtn {
    background: #303030;
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

#generateBtn:hover {
    background: #212121;
    transform: translateY(-1px);
}

/* ========================================
   SECTIONS DE STATUT ET PRÉVISUALISATION
   ======================================== */

.status-section,
.preview-section,
.code-section {
    background: var(--bg-primary);
    margin: 20px;
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.status-section {
    text-align: center;
    background: #334155;
    color: #f8fafc;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(26, 32, 44, 0.3);
    border-top: 4px solid #1a202c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.preview-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.preview-btn {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.preview-btn:hover {
    background: #475569;
    color: #f8fafc;
    border-color: #475569;
}

.preview-container {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    min-height: 500px;
    background: var(--bg-secondary);
}

#previewFrame {
    width: 100%;
    height: 500px;
    border: none;
}

/* ========================================
   SECTION CODE
   ======================================== */

.ai-info {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ai-provider-badge,
.generation-time {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.ai-provider-badge {
    background: var(--primary-color);
    color: #1a202c;
}

.generation-time {
    background: #303030;
    color: #ffffff;
}

.code-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 24px;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.tab-btn.active {
    background: #303030;
    color: #ffffff;
    border-color: #303030;
}

.tab-btn:hover:not(.active) {
    border-color: #303030;
    background: var(--bg-secondary);
}

.code-block {
    display: none;
    background: #0f1419;
    color: #e2e8f0;
    padding: 25px;
    border-radius: 12px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: 500px;
    border: 1px solid var(--border-color);
}

.code-block.active {
    display: block;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn.primary {
    background: #303030;
    color: #ffffff;
}

.action-btn.primary:hover {
    background: #212121;
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.action-btn.secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        max-width: 100vw;
    }
}

@media (max-width: 768px) {
    .description-section {
        padding: 40px 20px;
        margin: 10px;
    }
    
    .description-section h1 {
        font-size: 2rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .ai-selector-container {
        flex-direction: column;
        gap: 15px;
    }
}