/* Formulaires, inputs, selects et boutons */

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input[type="text"], input[type="password"], select, textarea {
    box-sizing: border-box; /* Ajout pour un meilleur contrôle de la largeur */
    width: calc(100% - 30px);
    max-width: 350px;
    padding: 12px 15px;
    border: 2px solid rgba(100, 116, 139, 0.8);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
    transition: all 0.3s ease;
}

/* Spécifiquement pour les champs de paramètres générés dynamiquement */
#parametersContainer input[type="text"] {
    width: calc(100% - 30px);
    max-width: 350px;
    padding: 12px 15px;
    border: 2px solid rgba(100, 116, 139, 0.8);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
    transition: all 0.3s ease;
}

/* Amélioration de la lisibilité pour les éléments select */
select {
    color: #ffffff;
    background: rgba(74, 58, 119, 0.9);
    border: 2px solid rgba(74, 58, 119, 0.9);
    font-weight: 500 !important;
}

/* Notification de succès pour select (appliquée par JS) */
select.select-notification-success {
    background: #22c55e !important; /* green background */
    border: 2px solid #16a34a !important; /* green border */
    color: #fff !important;
}

/* Assurer que tous les selects ont les mêmes couleurs */
select#apiRoute, select#themeRoute {
    color: #ffffff !important;
    background: rgba(74, 58, 119, 0.9) !important;
    border: 2px solid rgba(74, 58, 119, 0.9) !important;
    font-weight: 500 !important;
}

select option {
    background: rgba(30, 41, 59, 0.95) !important;
    color: #ffffff !important;
    padding: 8px 12px;
    border: none;
    font-weight: 500 !important;
}

/* Assurer que toutes les options ont les mêmes couleurs */
select#apiRoute option, select#themeRoute option {
    background: rgba(30, 41, 59, 0.95) !important;
    color: #ffffff !important;
    padding: 8px 12px;
    border: none;
    font-weight: 500 !important;
}

/* Styles spécifiques pour les options avec icônes */
select option[value*="🔒"],
select option[value*="🔍"],
select option[value*="📊"],
select option[value*="👥"],
select option[value*="🏛️"],
select option[value*="📍"],
select option[value*="💾"],
select option[value*="⚙️"] {
    background: rgba(51, 65, 85, 0.95) !important;
    color: #f1f5f9 !important;
    font-weight: 600 !important;
}

/* Amélioration pour tous les éléments option */
option {
    background: rgba(30, 41, 59, 0.95) !important;
    color: #ffffff !important;
    padding: 10px !important;
}

/* Styles pour les optgroups */
optgroup {
    background: rgba(15, 23, 42, 0.95) !important;
    color: #e2e8f0 !important;
    font-weight: 700 !important;
    font-style: normal !important;
    padding: 8px 12px !important;
    border: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-size: 11px !important;
}

/* Assurer que les optgroups dans nos selects spécifiques ont le bon style */
select#apiRoute optgroup, select#themeRoute optgroup {
    background: rgba(15, 23, 42, 0.95) !important;
    color: #e2e8f0 !important;
    font-weight: 700 !important;
    font-style: normal !important;
    padding: 8px 12px !important;
    border: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-size: 11px !important;
}

/* Focus states */
input[type="text"]:focus, input[type="password"]:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.5);
    background: rgba(30, 41, 59, 0.95) !important;
    color: #ffffff !important;
}

/* Styles pour les champs de paramètres obligatoires */
#parametersContainer input.required-param {
    border-color: rgba(252, 165, 165, 0.4) !important;
    background: rgba(220, 53, 69, 0.2) !important; /* Rouge plus visible */
}

#parametersContainer input.required-param:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1) !important;
    background: rgba(220, 53, 69, 0.3) !important; /* Rouge focus plus visible */
}

/* Styles pour les champs de paramètres optionnels */
#parametersContainer input.param-optional {
    background: rgba(13, 110, 253, 0.2) !important; /* Bleu plus visible */
}

#parametersContainer input.param-optional:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1) !important;
    background: rgba(13, 110, 253, 0.3) !important; /* Bleu focus plus visible */
}

/* Amélioration du hover pour les select */
select:hover {
    background: rgba(30, 41, 59, 0.9) !important;
    border-color: rgba(100, 116, 139, 0.8);
}

/* Styles pour les options au hover */
select option:hover {
    background: #475569 !important;
    color: #ffffff !important;
}

/* Boutons */
button {
    background: linear-gradient(45deg, var(--primary-color), #6d5a9a);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-right: 10px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(74, 58, 119, 0.4);
    background: linear-gradient(45deg, #5a4a88, #7d6aaa);
}

button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Boutons spécifiques */
button#ad41-btn {
    background: #a7d2ff;
    color: #1e3a8a;
}
button#ad41-btn:hover {
    background: #93c5fd;
}

button#login-btn {
    background: var(--success-color);
    color: #065f46;
}
button#login-btn.connected {
    background: var(--border-color);
    color: #e5e7eb;
    cursor: not-allowed;
}
button#login-btn.connected:hover {
    background: var(--border-color);
}

button#logout-btn {
    background: var(--border-color);
    color: #e5e7eb;
    display: none; /* Masqué par défaut */
    padding: 8px 16px; /* Plus petit que les autres boutons */
    font-size: 12px; /* Taille de police réduite */
    margin-top: 10px; /* Espacement au-dessus */
}
button#logout-btn.connected {
    background: var(--error-color);
    color: #991b1b;
    display: inline-block; /* Visible quand connecté */
    padding: 8px 16px; /* Plus petit que les autres boutons */
    font-size: 12px; /* Taille de police réduite */
}
button#logout-btn.connected:hover {
    background: #ef4444;
}

.method-display {
    padding: 12px 15px;
    background: #3b82f6;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #93c5fd;
}

/* --- MODAL GENERIQUE --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    background: #fff;
    margin: auto;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 2px 16px rgba(0,0,0,0.2);
    position: relative;
}

/* Style for JSON output in modal */
#generatedDefaultJson {
    background: #f8fafc; /* very light gray for high contrast */
    color: #222; /* dark text for readability */
    font-family: 'Fira Mono', 'Consolas', 'Menlo', 'Monaco', 'Liberation Mono', monospace;
    font-size: 1rem;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    overflow-x: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e5e7eb;
    max-height: 350px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Notification toast en haut à droite */
.toast-notification {
    position: fixed;
    top: 32px;
    right: 32px;
    z-index: 9999;
    background: #22c55e;
    color: #fff;
    padding: 18px 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 4px 24px rgba(34,197,94,0.18);
    opacity: 0.98;
    transition: opacity 0.4s, transform 0.4s;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 12px;
}
.toast-notification.hide {
    opacity: 0;
    transform: translateY(-20px);
}
