:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --danger: #ef4444;
    --success: #22c55e;
    --bg-light: #f8fafc;
    --bg-dark: #1e293b;
    --text-dark: #0f172a;
    --text-light: #f8fafc;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    background-color: var(--primary);
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.saved-configs-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.config-management {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.client-selector, .config-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.client-selector label, .config-selector label {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0;
}

.config-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#clientFilter, #savedConfigsList {
    min-width: 200px;
    background-color: white;
    color: var(--text-dark);
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
}

footer {
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: 1rem 0;
    margin-top: 2rem;
}

h1, h2, h3 {
    margin-top: 0;
}

.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

input.invalid-field:focus, select.invalid-field:focus, textarea.invalid-field:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

small {
    color: var(--secondary);
    font-size: 0.85rem;
}

/* Styles pour les indications de mots de passe */
.auto-generated {
    color: #059669;
    font-weight: 500;
    background-color: #ecfdf5;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border-left: 3px solid #10b981;
    margin-top: 0.25rem;
    display: block;
}

.user-defined {
    color: #dc2626;
    font-weight: 500;
    background-color: #fef2f2;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border-left: 3px solid #ef4444;
    margin-top: 0.25rem;
    display: block;
}

/* Info box pour les explications */
.info-box {
    background-color: #eff6ff;
    border: 1px solid #3b82f6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.info-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
}

.info-content h4 {
    color: #1e40af;
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.info-content p {
    margin: 0 0 0.5rem 0;
    color: #374151;
}

.info-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    color: #374151;
}

.info-content li {
    margin-bottom: 0.25rem;
}

.btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    border: none;
}

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

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

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #15803d;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.config-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
}

.config-list-item:hover {
    background-color: #f1f5f9;
}

.config-actions {
    display: flex;
    gap: 0.5rem;
}

.config-date {
    color: var(--secondary);
    font-size: 0.85rem;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 1.5rem;
    border-radius: 0.5rem;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.form-actions, .yaml-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.yaml-output {
    background-color: var(--bg-dark);
    color: var(--text-light);
    padding: 1rem;
    border-radius: 0.25rem;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tab-container {
    margin-top: 2rem;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.host-entry {
    margin-bottom: 1.5rem;
    position: relative;
}

.host-entry h4 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 200px;
}

.checkbox-item input[type="checkbox"] {
    width: auto;
}

.checkbox-item label {
    display: inline;
    font-weight: normal;
    margin-bottom: 0;
}

.ftp-user {
    margin-bottom: 1.5rem;
}

.ftp-user h5 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.host-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--danger);
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

/* New styles for required fields and validation */
.required-field::after {
    content: '*';
    color: var(--danger);
    margin-left: 0.25rem;
}

.invalid-field {
    border-color: var(--danger) !important;
    background-color: #fff5f5;
}

.invalid-field-label {
    color: var(--danger);
}

.field-error-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    max-width: 400px;
    transition: all 0.3s ease-in-out;
    transform: translateX(110%);
}

.notification.show {
    transform: translateX(0);
}

.notification.hidden {
    display: none;
}

.notification-content {
    background-color: white;
    border-left: 4px solid var(--danger);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.notification-content.success {
    border-left-color: var(--success);
}

.notification-content.warning {
    border-left-color: #f59e0b;
}

.notification-message {
    flex: 1;
}

.notification-close {
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.missing-fields-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.validation-badge {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background-color: var(--danger);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.invalid-tab::after {
    content: '!';
    display: inline-block;
    color: white;
    background-color: var(--danger);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.75rem;
    line-height: 18px;
    text-align: center;
    margin-left: 0.5rem;
}

/* Warning box styles */
.warning-box {
    background-color: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.warning-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.warning-content {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.warning-content strong {
    color: var(--danger);
}

.security-notice {
    background-color: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #0c4a6e;
    font-size: 0.9rem;
}

.encryption-info {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.encryption-info h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary);
}

.info-grid {
    display: grid;
    gap: 1rem;
}

.info-item {
    background-color: white;
    padding: 1rem;
    border-radius: 0.25rem;
    border: 1px solid #e5e7eb;
}

.info-item strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.info-item code {
    background-color: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.info-item ul {
    margin: 0.5rem 0 0 1rem;
    padding: 0;
}

.info-item li {
    margin-bottom: 0.25rem;
}

.script-output {
    background-color: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

@media (max-width: 768px) {
    .checkbox-group {
        flex-direction: column;
    }
    
    .checkbox-item {
        min-width: auto;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    /* Responsive pour les nouvelles fonctionnalités */
    .encryption-summary {
        flex-direction: column;
    }
    
    .encryption-stat {
        justify-content: center;
        min-width: auto;
    }
    
    .password-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .copy-vault-btn {
        align-self: flex-start;
    }
    
    .password-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .var-name, .var-value {
        width: 100%;
    }
}

/* Styles améliorés pour l'affichage du chiffrement */
.encryption-info {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 2px solid #4caf50;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fff8 0%, #e8f8e8 100%);
    position: relative;
}

.encryption-info h4 {
    color: #2e7d32;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.encryption-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.encryption-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.75rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    min-width: 120px;
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2e7d32;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    line-height: 1;
}

.vault-password {
    border-color: #ff9800 !important;
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%) !important;
}

.password-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.vault-password-code {
    flex: 1;
    background: #fff;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    color: #d32f2f;
    word-break: break-all;
}

.copy-vault-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.copy-vault-btn:hover {
    background: #45a049;
}

.copy-vault-btn:active {
    transform: translateY(1px);
}

.security-warning {
    color: #f57c00;
    font-weight: bold;
    font-size: 0.9rem;
    display: block;
    margin-top: 0.5rem;
}

.passwords-grid {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.password-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f5f5f5;
    border-radius: 4px;
    border: 1px solid #ddd;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.var-name {
    font-weight: bold;
    color: #1976d2;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.var-value {
    font-family: 'Courier New', monospace;
    color: #2e7d32;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    border: 1px solid #ccc;
    font-size: 0.9rem;
    word-break: break-all;
}

.script-output-details {
    margin-top: 1rem;
}

.script-output-details summary {
    cursor: pointer;
    padding: 0.5rem;
    background: #f0f0f0;
    border-radius: 4px;
    border: 1px solid #ddd;
    outline: none;
}

.script-output-details summary:hover {
    background: #e0e0e0;
}

.script-output {
    background: #1e1e1e;
    color: #f0f0f0;
    padding: 1rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.5rem;
    border: 1px solid #333;
}

.encryption-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.loading-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1.1rem;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ccc;
    animation: pulse 2s infinite;
}

.loading-message small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #999;
}

/* Animation pour le chargement */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* Styles pour améliorer la lisibilité du YAML chiffré */
.yaml-output pre {
    line-height: 1.4;
    font-size: 0.9rem;
}

.yaml-output pre::before {
    content: "🔐 Fichier Ansible Vault - Contenu chiffré";
    display: block;
    color: #4caf50;
    font-weight: bold;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #333;
}

/* Amélioration de la zone de notification avec gradients */
.notification-content.success {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left-color: #22c55e;
}

.notification-content.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left-color: #ef4444;
}

.notification-content.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-left-color: #f59e0b;
}
