/* Control Panel Styles */
.control-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 30px;
}

.control-panel .section-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.control-panel .section-header h2 {
    color: white;
    margin: 0;
}

.status-indicator {
    display: flex;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.status-enabled {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 2px solid #10b981;
}

.status-badge.status-disabled {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 2px solid #ef4444;
}

.status-badge.status-unknown {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
    border: 2px solid #9ca3af;
}

.status-badge i {
    font-size: 10px;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.control-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.control-label i {
    color: rgba(255, 255, 255, 0.7);
}

.control-value {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.3);
    transition: 0.4s;
    border-radius: 34px;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: #10b981;
    border-color: #10b981;
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-status {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    border-left: 4px solid;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.stat-card.stat-success {
    border-left-color: #10b981;
}

.stat-card.stat-error {
    border-left-color: #ef4444;
}

.stat-card.stat-warning {
    border-left-color: #f59e0b;
}

.stat-card.stat-info {
    border-left-color: #3b82f6;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-error .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.stat-warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-info .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-success .stat-number {
    color: #10b981;
}

.stat-error .stat-number {
    color: #ef4444;
}

.stat-warning .stat-number {
    color: #f59e0b;
}

.stat-info .stat-number {
    color: #3b82f6;
}

.stat-label {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Auto Refresh Indicator */
.auto-refresh-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.auto-refresh-indicator i {
    font-size: 12px;
}

/* Logs Container */
.logs-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.log-filters {
    display: flex;
    gap: 20px;
}

.log-filters label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.log-filters input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

.filter-label {
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 12px;
}

.filter-label.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.filter-label.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.filter-label.info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.log-count {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.logs-table-container {
    max-height: 500px;
    overflow-y: auto;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
}

.logs-table th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logs-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}

.logs-table tbody tr:hover {
    background: #f9fafb;
}

.logs-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.logs-table tbody tr:nth-child(even):hover {
    background: #f3f4f6;
}

.empty-logs {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.empty-logs i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

/* Log Event Types */
.event-type {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-type.check_started,
.event-type.check_completed,
.event-type.manual_check {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.event-type.dead_detected,
.event-type.dead_proxy {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.event-type.replace_started {
    background: rgba(156, 163, 175, 0.1);
    color: #6b7280;
}

.event-type.replace_success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.event-type.replace_failed,
.event-type.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.event-type.feature_enabled,
.event-type.feature_disabled {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

/* Status Icons */
.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 12px;
}

.status-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-icon.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* IP Address Styling */
.ip-address {
    font-family: 'Consolas', 'Monaco', monospace;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #374151;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.loading-content i {
    font-size: 48px;
    color: #3b82f6;
    margin-bottom: 16px;
}

.loading-content p {
    margin: 0;
    color: #374151;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .control-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .logs-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .log-filters {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .logs-table-container {
        overflow-x: auto;
    }
    
    .logs-table {
        min-width: 800px;
    }
}

/* Dark Mode Support */
[data-theme="dark"] .control-panel {
    background: linear-gradient(135deg, #4c1d95 0%, #581c87 100%);
}

[data-theme="dark"] .stat-card {
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .logs-container {
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .logs-header {
    background: #111827;
    border-color: #374151;
}

[data-theme="dark"] .logs-table th {
    background: #111827;
    color: #f3f4f6;
    border-color: #374151;
}

[data-theme="dark"] .logs-table td {
    border-color: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .logs-table tbody tr:hover {
    background: #374151;
}

[data-theme="dark"] .logs-table tbody tr:nth-child(even) {
    background: #111827;
}

[data-theme="dark"] .logs-table tbody tr:nth-child(even):hover {
    background: #374151;
}

[data-theme="dark"] .ip-address {
    background: #374151;
    color: #e5e7eb;
}

[data-theme="dark"] .loading-content {
    background: #1f2937;
    color: #f3f4f6;
}

[data-theme="dark"] .auto-refresh-indicator {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* Animation for stats numbers */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-number.updated {
    animation: countUp 0.3s ease;
}

/* Pulse animation for refresh icon */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.auto-refresh-indicator i.fa-spin {
    animation: fa-spin 2s infinite linear, pulse 1s infinite;
}