/* QueryCraft - Styles spécifiques à la page index */

/* Informations de la base de données */
.db-info {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    margin-top: 15px;
    border-radius: 8px;
    display: inline-block;
}

.db-info span {
    margin: 0 10px;
    font-weight: 500;
}

/* Contenu principal */
.content {
    padding: 30px;
}

/* Section de requête */
.query-section {
    margin-bottom: 30px;
}

.query-section label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.query-input {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s;
}

.query-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Options et checkboxes */
.options {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

/* Boutons */
.buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Section de sortie */
.output-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 100px;
    display: none;
}

.output-section.show {
    display: block;
}

.output-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2em;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.output-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
}

/* Styles pour les tableaux HTML générés */
.output-content table {
    border-collapse: collapse;
    margin: 10px 0;
    width: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.output-content table th {
    background-color: #667eea;
    color: white;
    font-weight: 600;
}

.output-content table td,
.output-content table th {
    padding: 10px 15px;
    text-align: left;
    border: 1px solid #ddd;
}

.output-content table tr:hover {
    background-color: #f5f5f5;
}

/* Table attendue des questions IT->R : police réduite alignée sur l'intention */
#questionTable {
    font-size: 12px;
}

#questionTable .output-content table td,
#questionTable .output-content table th {
    padding: 5px 10px;
}

/* IA */
.ia {
    background: #ede2d4;
    color: #572e15;
    padding: 30px;
    border-radius: 8px;
    border-left: 4px solid #a76828;
}

/* Page schéma : diagramme à gauche, bascule SQL/Tableaux à droite */
.schema-columns {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) 1.15fr;
    gap: 1.5rem;
    align-items: start;
}

.schema-columns img {
    max-width: 100%;
    height: auto;
}

/* Bouton de régénération du diagramme (mode enseignant), sous l'image du schéma */
.schema-regenerate {
    margin-top: 0.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.regenerate-status {
    font-size: 0.85rem;
    color: #6b7280;
}

/* Clé primaire / clé étrangère : mêmes couleurs que la coloration du DDL,
   réutilisées dans la légende du diagramme et dans le tableau des colonnes. */
.pk {
    color: #a76828;
    font-weight: 700;
}

.fk {
    color: #667eea;
    font-weight: 700;
}

/* Bloc DDL (schéma SQL) */
.ddl-block {
    background: #f5f5f5;
    color: #333;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* Bascule SQL formaté / Tableaux */
.schema-switch-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.switch {
    display: inline-flex;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.switch-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #666;
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.switch-btn:hover {
    color: #333;
}

.switch-btn[aria-selected="true"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.switch-btn:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.schema-panel[hidden] {
    display: none;
}

@media (max-width: 860px) {
    .schema-columns {
        grid-template-columns: 1fr;
    }
}

/* Classes pour les enseignants */
.ens-only {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .options {
        flex-direction: column;
    }

    .buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

.output-content p {
    margin-top: 1rem;
    margin-bottom: 1rem;
}
.output-content h1, .output-content h2, .output-content h3 {
    margin-top: 1rem;
    margin-bottom: 1rem;
}
.output-content hr {
    margin-top: 1rem;
    margin-bottom: 1rem;
}