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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: #00d4ff;
    margin-bottom: 10px;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

input[type="file"] {
    display: none;
}

#groupsContainer {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.group {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.group-header {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(102, 126, 234, 0.1));
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}

.group-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.toggle-icon {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.group-icon {
    font-size: 1.5em;
}

.group-text h2 {
    font-size: 1.3em;
    color: #00d4ff;
    margin-bottom: 5px;
}

.group-text p {
    font-size: 0.9em;
    color: #aaa;
}

.group-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-edit-group, .btn-duplicate-group, .btn-bulk-edit, .btn-delete-group {
    padding: 8px 12px;
    font-size: 0.85em;
}

.btn-edit-group {
    background: #4CAF50;
}

.btn-duplicate-group {
    background: #2196F3;
}

.btn-bulk-edit {
    background: #FF9800;
}

.btn-delete-group {
    background: #f44336;
}

.group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.group-content.visible {
    max-height: 5000px;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    padding: 20px;
}

.template-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.15);
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
}

.template-card:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.2);
}

.template-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #00d4ff;
    margin-bottom: 8px;
}

.template-caption {
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 8px;
}

.template-meta {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 12px;
}

.destinations-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.destination-badge {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75em;
}

.template-actions {
    display: flex;
    gap: 8px;
    justify-content: space-between;
}

.btn-view, .btn-edit, .btn-delete {
    flex: 1;
    padding: 8px;
    font-size: 0.8em;
}

.btn-view {
    background: #2196F3;
}

.btn-edit {
    background: #4CAF50;
}

.btn-delete {
    background: #f44336;
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: #aaa;
    font-style: italic;
}

/* ===== MODALES - CORRECTION DU BUG ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    pointer-events: none;  /* ← IMPORTANT */
}

.modal.active {
    display: flex;
    pointer-events: auto;  /* ← IMPORTANT */
}

.modal-content {
    background: #16213e;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    pointer-events: auto;  /* ← IMPORTANT */
}

.modal-header {
    font-size: 1.5em;
    color: #00d4ff;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #00d4ff;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 6px;
    color: #fff;
    font-size: 1em;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(0, 212, 255, 0.6);
}

.destination-item {
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.destination-item h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status {
    font-size: 0.7em;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-enabled {
    background: #4CAF50;
    color: #fff;
}

.status-disabled {
    background: #f44336;
    color: #fff;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
}

.info-label {
    color: #00d4ff;
    font-weight: 600;
}

.info-value {
    color: #aaa;
    word-break: break-word;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

.btn-save, .btn-cancel {
    padding: 10px 20px;
}

.btn-save {
    background: #4CAF50;
}

.btn-cancel {
    background: #666;
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: #4CAF50;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.notification.error {
    background: #f44336;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.password-field-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.password-field-wrapper input {
    padding-right: 40px;
    width: 100%;
    box-sizing: border-box;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
}
/* MODALE DE CONFIRMATION */
.confirm-modal {
    max-width: 400px;
    text-align: center;
    padding: 40px 30px;
    border: 2px solid #ff4444;
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.confirm-modal h2 {
    color: #ff4444;
    margin-bottom: 15px;
    font-size: 24px;
}

.confirm-modal p {
    color: #888;
    margin-bottom: 30px;
    font-size: 16px;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-cancel {
    background: #444;
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-cancel:hover {
    background: #555;
}

.btn-confirm-delete {
    background: #ff4444;
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-confirm-delete:hover {
    background: #cc0000;
}