* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.hidden {
    display: none !important;
}

.page {
    min-height: 100vh;
}

/* Page de connexion */
#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.login-container h2 {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

/* Header */
header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #667eea;
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Navigation tabs */
.tabs {
    background: white;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    padding: 0 2rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f5f5f5;
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* Main content */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.section h2 {
    color: #333;
    margin-bottom: 1.5rem;
}

.section h3 {
    color: #666;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Form elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #666;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Lists */
.list-container {
    margin-bottom: 1rem;
}

.list-item {
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #667eea;
}

.list-item-name {
    font-weight: 500;
    color: #333;
}

/* Checkbox list */
.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
    flex: 1;
}

/* Radio buttons pour le mode inclusion/exclusion */
input[type="radio"] {
    margin-right: 0.5rem;
    cursor: pointer;
    pointer-events: auto !important;
}

.radio-option {
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none;
    position: relative;
}

.radio-option:hover {
    background: #e9ecef !important;
    border-color: #667eea !important;
}

.radio-option input[type="radio"]:checked ~ span {
    font-weight: 600;
}

.radio-option.checked {
    background: #e7f3ff !important;
    border-color: #667eea !important;
}

.radio-option.checked span {
    font-weight: 600;
}

/* Logs */
.log-container {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: 4px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.log-line {
    margin-bottom: 0.25rem;
}

/* History */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.history-item.success {
    border-left-color: #28a745;
}

.history-item.error {
    border-left-color: #dc3545;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-item-title {
    font-weight: 600;
    color: #333;
}

.history-item-date {
    color: #666;
    font-size: 0.9rem;
}

.history-item-details {
    color: #666;
    font-size: 0.9rem;
}

/* Migration status */
.migration-status {
    margin-top: 1.5rem;
}

.migration-info {
    background: #e7f3ff;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.migration-info.running {
    background: #fff3cd;
}

.migration-info.success {
    background: #d4edda;
}

.migration-info.error {
    background: #f8d7da;
}

/* Error message */
.error-message {
    color: #dc3545;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid #667eea;
}

.toast.success {
    border-left-color: #28a745;
}

.toast.error {
    border-left-color: #dc3545;
}

.toast.warning {
    border-left-color: #ffc107;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Search container */
.search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: -1px;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.selected {
    background-color: #667eea;
    color: white;
}

.search-result-item-name {
    font-weight: 500;
    color: #333;
}

.search-result-item.selected .search-result-item-name {
    color: white;
}

.search-result-item-type {
    font-size: 0.85rem;
    color: #666;
    margin-left: 0.5rem;
}

.search-result-item.selected .search-result-item-type {
    color: rgba(255, 255, 255, 0.9);
}

.search-result-empty {
    padding: 1rem;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Console de sortie pour la migration */
.console-output {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: 4px;
    height: 400px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    border: 1px solid #333;
}

.console-output::-webkit-scrollbar {
    width: 8px;
}

.console-output::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.console-output::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.console-welcome {
    color: #6a9955;
    font-style: italic;
}

.console-line {
    margin: 0;
    padding: 2px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.console-line.error {
    color: #f14c4c;
}

.console-line.success {
    color: #4ec9b0;
}

.console-line.warning {
    color: #dcdcaa;
}

.console-line.info {
    color: #9cdcfe;
}

.console-line.progress {
    color: #4ec9b0;
    font-weight: 500;
}

.console-line.header {
    color: #ce9178;
    font-weight: bold;
}

/* Indicateur de statut */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 1rem;
}

#status-text {
    font-weight: 500;
    font-size: 1rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.idle {
    background: #6c757d;
}

.status-dot.running {
    background: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-dot.success {
    background: #28a745;
}

.status-dot.error {
    background: #dc3545;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Barre de progression */
.progress-container {
    margin-bottom: 1rem;
}

.progress-bar {
    height: 28px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
    border: 1px solid #dee2e6;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    min-width: 40px;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-details {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.progress-details span {
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* Modale des logs */
.log-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.log-modal {
    background: #1e1e1e;
    border-radius: 8px;
    width: 100%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.log-modal-header {
    padding: 1rem 1.5rem;
    background: #2d2d2d;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-modal-header h2 {
    color: #d4d4d4;
    margin: 0;
    font-size: 1.1rem;
}

.log-modal-content {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.log-modal-content pre {
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Styles pour l'onglet Admin */
.admin-status-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.status-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.status-row:last-child {
    margin-bottom: 0;
}

.status-label {
    font-weight: 600;
    color: #555;
    min-width: 150px;
}

.status-value {
    color: #333;
    flex: 1;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.admin-mode-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.radio-group .radio-option {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-group .radio-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.radio-group .radio-option input[type="radio"] {
    margin-right: 0.75rem;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.radio-group .radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #667eea;
}

.radio-group .radio-option:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: #f0f4ff;
}

.mode-info {
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.mode-info .info-text {
    margin: 0;
    color: #1976D2;
    font-size: 0.9rem;
    line-height: 1.6;
}

.mode-info code {
    background: rgba(33, 150, 243, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85em;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

/* Bannière de différences config */
.config-diff-banner {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid #e65100;
}

.config-diff-banner.hidden {
    display: none;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.banner-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.banner-text {
    flex: 1;
    min-width: 300px;
    line-height: 1.6;
}

.banner-text strong {
    font-weight: 600;
}

.banner-buttons {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

#promote-test-btn,
#sync-prod-to-test-btn {
    white-space: nowrap;
    font-weight: 600;
}

#promote-test-btn {
    background: white;
    color: #f57c00;
    border: none;
}

#promote-test-btn:hover {
    background: #fff3e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#sync-prod-to-test-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

#sync-prod-to-test-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
