/* Dashboard Styles pour Weave Scraping System */

/* Layout général */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem !important;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* Status badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
}

.status-completed {
    background-color: #d1edff;
    color: #0c63e4;
}

.status-running {
    background-color: #fff3cd;
    color: #856404;
}

.status-failed {
    background-color: #f8d7da;
    color: #721c24;
}

.status-stopped {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Log levels */
.log-level {
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
}

.log-debug {
    background-color: #e7f1ff;
    color: #004085;
}

.log-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.log-warning {
    background-color: #fff3cd;
    color: #856404;
}

.log-error {
    background-color: #f8d7da;
    color: #721c24;
}

.log-critical {
    background-color: #d1ecf1;
    color: #155724;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% { opacity: 0.5; }
}

/* System health indicators */
.health-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.health-healthy {
    background-color: #28a745;
}

.health-warning {
    background-color: #ffc107;
}

.health-critical {
    background-color: #dc3545;
    animation: pulse 1s infinite;
}

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

/* Progress bars */
.progress {
    height: 8px;
    background-color: #e9ecef;
}

.progress-bar {
    transition: width 0.3s ease-in-out;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    vertical-align: middle;
    padding: 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-sm {
    font-size: 0.775rem;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
}

/* Modals */
.modal-content {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
    font-weight: 500;
}

.alert-info {
    background-color: #e7f1ff;
    color: #004085;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-success {
    background-color: #d1edff;
    color: #155724;
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loading::after {
    content: "Loading...";
    font-weight: 500;
    color: #6c757d;
}

/* Scan cards */
.scan-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: #fff;
    transition: all 0.15s ease-in-out;
}

.scan-card:hover {
    border-color: #0d6efd;
    box-shadow: 0 0.125rem 0.25rem rgba(13, 110, 253, 0.075);
}

.scan-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.scan-id {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    background-color: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: #495057;
}

.scan-progress {
    margin-top: 0.5rem;
}

.scan-actions {
    margin-top: 0.5rem;
}

.scan-actions .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Platform stats */
.platform-stat {
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    background-color: #fff;
}

.platform-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
}

.platform-metrics {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Log entries */
.log-entry {
    padding: 12px;
    border-left: 3px solid #dee2e6;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.log-entry:hover {
    background: #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.log-entry.log-level-debug {
    border-left-color: #6c757d;
}

.log-entry.log-level-info {
    border-left-color: #0dcaf0;
}

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

.log-entry.log-level-error,
.log-entry.log-level-critical {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.log-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.log-time {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #6c757d;
}

.log-level-badge {
    font-size: 10px;
    padding: 2px 6px;
}

.log-source {
    font-size: 11px;
    margin-left: auto;
}

.log-message {
    font-size: 13px;
    line-height: 1.5;
}

.log-message strong {
    display: block;
    margin-bottom: 4px;
}

/* Logs Statistics Header */
.logs-stats-header .stat-card {
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.logs-stats-header .stat-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

/* Animation for stat value updates */
.stat-value.stat-updated {
    animation: pulse-stat 0.6s ease;
}

@keyframes pulse-stat {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: #0dcaf0;
    }
    100% {
        transform: scale(1);
    }
}

.logs-stats-header .stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Logs Container */
#logsContainer {
    max-height: 500px;
    overflow-y: auto;
}

#logsContainer::-webkit-scrollbar {
    width: 8px;
}

#logsContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#logsContainer::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#logsContainer::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .scan-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .scan-actions {
        width: 100%;
    }
    
    .scan-actions .btn {
        width: 100%;
        margin-right: 0;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #ffffff;
    }
    
    .card {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    .card-header {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    .table {
        color: #ffffff;
    }
    
    .table-striped > tbody > tr:nth-of-type(odd) > td {
        background-color: #2a2a2a;
    }
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Properties Needing Scan Card */
.bg-gradient-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.card.bg-gradient-danger {
    border: none;
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.4);
}

.card.bg-gradient-danger:hover {
    box-shadow: 0 6px 25px rgba(220, 53, 69, 0.5);
    transform: translateY(-3px);
}

.card.bg-gradient-danger .opacity-75 {
    opacity: 0.75 !important;
}
