/* Variables CSS pour les thèmes */
:root {
    /* Thème clair */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
    --accent-primary: #007bff;
    --accent-success: #28a745;
    --accent-warning: #ffc107;
    --accent-danger: #dc3545;
    --accent-info: #17a2b8;
    --input-bg: #ffffff;
    --card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.95);
    --log-bg: #1e1e1e;
    --log-text: #ffffff;
}

/* Thème sombre */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    --border-color: #404040;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.4);
    --accent-primary: #4dabf7;
    --accent-success: #51cf66;
    --accent-warning: #ffd43b;
    --accent-danger: #ff6b6b;
    --accent-info: #22b8cf;
    --input-bg: #3d3d3d;
    --card-bg: #2d2d2d;
    --header-bg: rgba(45, 45, 45, 0.95);
    --log-bg: #0d1117;
    --log-text: #e6edf3;
}

/* Styles pour le système de déploiement */
body {
    background: var(--bg-gradient);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
    transition: all 0.3s ease;
    margin: 0;
    padding: 0;
}

/* Header avec contrôles */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: white;
    transform: translateY(-1px);
}

.auto-save-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
    justify-content: center;
}

.auto-save-indicator.saving {
    background: var(--accent-warning);
    color: #000;
}

.auto-save-indicator.saved {
    background: var(--accent-success);
    color: white;
}

.auto-save-indicator.error {
    background: var(--accent-danger);
    color: white;
}

.save-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Ajustement du contenu principal */
.main-content {
    margin-top: 80px;
    padding: 20px;
}

.container-fluid {
    padding-top: 0;
}

.card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    border-radius: 12px;
    margin-bottom: 20px;
    background: var(--card-bg);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.card-header {
    background: var(--bg-gradient);
    color: white;
    border-radius: 12px 12px 0 0 !important;
    border: none;
    padding: 15px 20px;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 12px 20px;
    margin-right: 5px;
    border-radius: 10px 10px 0 0;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
}

.nav-tabs .nav-link:hover {
    background: var(--border-color);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.nav-tabs .nav-link.active {
    background: var(--bg-gradient);
    color: white;
    border: none;
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background: var(--input-bg);
}

.log-container {
    background: var(--log-bg);
    color: var(--log-text);
    padding: 20px;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid var(--border-color);
}

.log-entry {
    margin-bottom: 8px;
    padding: 5px 0;
    border-left: 3px solid transparent;
    padding-left: 10px;
}

.log-entry.info {
    border-left-color: #17a2b8;
}

.log-entry.success {
    border-left-color: #28a745;
}

.log-entry.warning {
    border-left-color: #ffc107;
}

.log-entry.error {
    border-left-color: #dc3545;
}

.log-entry .timestamp {
    color: #6c757d;
    font-weight: bold;
}

.log-entry .level {
    font-weight: bold;
    margin: 0 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.log-entry.info .level {
    background-color: #17a2b8;
    color: white;
}

.log-entry.success .level {
    background-color: #28a745;
    color: white;
}

.log-entry.warning .level {
    background-color: #ffc107;
    color: black;
}

.log-entry.error .level {
    background-color: #dc3545;
    color: white;
}

.log-entry .message {
    color: #ffffff;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.connected {
    background-color: #28a745;
    animation: pulse 2s infinite;
}

.status-indicator.disconnected {
    background-color: #dc3545;
}

.status-indicator.testing {
    background-color: #ffc107;
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress {
    height: 25px;
    border-radius: 15px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 15px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    border: none;
}

.input-group .btn {
    border-radius: 0 8px 8px 0;
}

.input-group .form-control {
    border-radius: 8px 0 0 8px;
}

/* Notifications push */
.notification-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    pointer-events: none;
}

.notification {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    transform: translateX(100%);
    opacity: 0;
    animation: slideInNotification 0.3s ease-out forwards;
    position: relative;
    pointer-events: auto;
    color: var(--text-primary);
}

.notification.success {
    border-left: 4px solid var(--accent-success);
}

.notification.warning {
    border-left: 4px solid var(--accent-warning);
}

.notification.error {
    border-left: 4px solid var(--accent-danger);
}

.notification.info {
    border-left: 4px solid var(--accent-info);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.notification-title {
    font-weight: 600;
    color: var(--text-primary);
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notification-close:hover {
    color: var(--text-primary);
    background: var(--border-color);
}

.notification-body {
    color: var(--text-secondary);
    font-size: 14px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
}

@keyframes slideInNotification {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.removing {
    animation: slideOutNotification 0.3s ease-in forwards;
}

@keyframes slideOutNotification {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Raccourcis clavier */
.keyboard-shortcuts {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: var(--shadow);
    max-width: 300px;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.keyboard-shortcuts.visible {
    transform: translateY(0);
    opacity: 1;
}

.shortcuts-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.shortcut-key {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    min-width: 25px;
    text-align: center;
}

.shortcut-desc {
    color: var(--text-secondary);
}

/* Responsive Design Amélioré */
@media (max-width: 1200px) {
    .main-content {
        padding: 15px;
    }
    
    .notification-container {
        max-width: 350px;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 8px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .app-title {
        font-size: 18px;
    }
    
    .header-controls {
        gap: 10px;
    }
    
    .theme-toggle {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .main-content {
        margin-top: 90px;
        padding: 10px;
    }
    
    .container-fluid {
        padding: 5px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .nav-tabs .nav-link {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .notification-container {
        top: 100px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .keyboard-shortcuts {
        bottom: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 6px 10px;
    }
    
    .app-title {
        font-size: 16px;
    }
    
    .header-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .theme-toggle {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .auto-save-indicator {
        font-size: 10px;
        padding: 4px 8px;
        min-width: 80px;
    }
    
    .main-content {
        margin-top: 100px;
        padding: 8px;
    }
    
    .card {
        border-radius: 8px;
    }
    
    .card-header {
        padding: 12px 15px;
        border-radius: 8px 8px 0 0 !important;
    }
    
    .notification {
        padding: 12px;
    }
    
    .notification-container {
        top: 110px;
        right: 8px;
        left: 8px;
    }
}

/* Animation pour les boutons de test */
.btn-testing {
    position: relative;
    overflow: hidden;
}

.btn-testing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Scrollbar personnalisée pour les logs */
.log-container::-webkit-scrollbar {
    width: 8px;
}

.log-container::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.log-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
