/**
 * ═══════════════════════════════════════════════════════════════════════════
 * EDUBLOC - Styles du panneau IA
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ═══════════════════════════════════════════════════════════════════════════
   BOUTON IA DANS LE HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.header__btn--ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    padding: 0 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.header__btn--ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.header__btn--ai.active {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PANNEAU IA
   ═══════════════════════════════════════════════════════════════════════════ */

.ai-panel {
    position: fixed;
    top: 110px;
    right: -400px;
    width: 380px;
    height: calc(100vh - 140px);
    background: white;
    border-left: 1px solid #e0e0e0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 900;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-panel.active {
    right: 0;
}

/* En-tête du panneau */
.ai-panel__header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
}

.ai-panel__title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-panel__subtitle {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
}

/* Configuration Provider */
.ai-panel__provider {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.ai-panel__provider-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-panel__provider-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

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

.ai-panel__provider-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.ai-panel__provider-icon.inactive {
    background: #ef4444;
}

.ai-panel__provider-name {
    font-weight: 500;
}

.ai-panel__settings-btn {
    padding: 4px 12px;
    font-size: 12px;
    background: #f3f4f6;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-panel__settings-btn:hover {
    background: #e5e7eb;
}

/* Contenu du panneau */
.ai-panel__content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Actions IA */
.ai-panel__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.ai-panel__action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.ai-panel__action:hover:not(:disabled) {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(-2px);
}

.ai-panel__action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-panel__action-icon {
    font-size: 20px;
}

/* Loader */
.ai-panel__loader {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
}

.ai-panel__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-panel__loader-text {
    font-size: 14px;
    color: #666;
}

/* Zone de résultat */
.ai-panel__result {
    margin-top: 20px;
}

.ai-panel__result-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#ai-result {
    display: none;
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

.ai-panel__result-actions {
    display: none;
    gap: 8px;
    margin-top: 12px;
}

.ai-panel__result-btn {
    flex: 1;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-panel__result-btn--primary {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.ai-panel__result-btn--primary:hover {
    background: #5568d3;
}

.ai-panel__result-btn--secondary {
    background: white;
    color: #333;
}

.ai-panel__result-btn--secondary:hover {
    background: #f3f4f6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALE PARAMÈTRES IA
   ═══════════════════════════════════════════════════════════════════════════ */

#modal-ai-settings .modal__container {
    max-width: 600px;
}

.ai-settings__group {
    margin-bottom: 24px;
}

.ai-settings__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.ai-settings__input,
.ai-settings__select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.ai-settings__input:focus,
.ai-settings__select:focus {
    outline: none;
    border-color: #667eea;
}

.ai-settings__help {
    margin-top: 6px;
    font-size: 12px;
    color: #666;
}

.ai-settings__section {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 20px;
}

.ai-settings__section-title {
    margin: 0 0 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-settings__badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    background: #667eea;
    color: white;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-settings__info {
    padding: 12px;
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    border-radius: 4px;
    margin-top: 16px;
}

.ai-settings__info-text {
    margin: 0;
    font-size: 13px;
    color: #1976d2;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .ai-panel {
        width: 100%;
        right: -100%;
    }
    
    .ai-panel.active {
        right: 0;
    }
}
