/* Top 10 Daily Dashboard - Custom Styles */

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-content {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Card Enhancements */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

.card-header.bg-gradient {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-secondary) 100%) !important;
}

/* Top 10 Rankings Styles */
.top10-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.top10-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

.top10-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.top10-item:hover::before {
    width: 8px;
}

/* Ranking badges */
.ranking-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ranking-badge.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
}

.ranking-badge.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e5e5e5 100%);
    color: #333;
}

.ranking-badge.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #daa520 100%);
    color: white;
}

.ranking-badge.rank-other {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* IMEI styling */
.imei-code {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    font-size: 0.9rem;
    border: 1px solid #dee2e6;
}

/* Metric displays */
.metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #495057;
}

.metric-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-secondary {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Progress bars for visual comparison */
.progress-comparison {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-comparison .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.8s ease;
}

/* Statistics cards */
.stat-card {
    background: white;
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Date selector styling */
.form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Animation classes */
.fadeInUp {
    animation: fadeInUp 0.6s ease forwards;
}

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

.slideInRight {
    animation: slideInRight 0.5s ease forwards;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .top10-item {
        padding: 0.75rem;
    }
    
    .metric-value {
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .ranking-badge {
        width: 25px;
        height: 25px;
        font-size: 0.7rem;
    }
}

/* Chart container styling */
.chart-container {
    position: relative;
    height: 300px;
    padding: 1rem;
}

/* Tooltip styling for better UX */
.custom-tooltip {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Filter form enhancements */
.form-control, .form-select {
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

/* Button enhancements */
.btn {
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Summary statistics enhancements */
.summary-metric {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.summary-metric .metric-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.summary-metric .metric-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #495057;
    margin-bottom: 0.25rem;
}

.summary-metric .metric-text {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Header gradient variations */
.header-speed-violations {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%) !important;
}

.header-distance {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.header-max-speed {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

.header-positions {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%) !important;
}

/* Performance indicators */
.performance-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.performance-indicator.excellent {
    background: #28a745;
}

.performance-indicator.good {
    background: #17a2b8;
}

.performance-indicator.average {
    background: #ffc107;
}

.performance-indicator.poor {
    background: #dc3545;
}

/* Chart enhancements for dynamic charts */
.chart-container canvas {
    border-radius: 8px;
}

/* Chart selector styling */
#chartTypeSelector, #chartDateSelector {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-weight: 500;
}

#chartTypeSelector:focus, #chartDateSelector:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background: white;
}

/* Chart title styling */
#chartTitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
}

/* Chart details panel */
#chartDetailsPanel .card {
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

#chartDetailsPanel .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Top 3 details styling */
#top3Details .border {
    border-color: #e9ecef !important;
    transition: all 0.3s ease;
}

#top3Details .border:hover {
    border-color: #667eea !important;
    background-color: #f8f9ff !important;
}

/* Chart stats styling */
#chartStats .bg-light {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

#chartStats .bg-light:hover {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%) !important;
    transform: scale(1.02);
}

/* Enhanced chart container */
.chart-container {
    position: relative;
    min-height: 400px;
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Trend charts grid */
.trend-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

/* Chart loading state */
.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.chart-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Chart error state */
.chart-error {
    text-align: center;
    padding: 3rem 1rem;
    color: #dc3545;
}

.chart-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

/* Interactive chart elements */
.chart-interactive-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-container:hover .chart-interactive-hint {
    opacity: 1;
}

/* Modal enhancements for item details */
.modal-content {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

.modal-body .list-group-item {
    border: none;
    background: transparent;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.modal-body .list-group-item:last-child {
    border-bottom: none;
}

.modal-body .badge {
    padding: 0.5rem 1rem;
    border-radius: 25px;
}

/* Chart type indicators */
.chart-type-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.chart-type-indicator.excesos {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

.chart-type-indicator.distancia {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chart-type-indicator.velocidad {
    background: linear-gradient(135deg, #ffc107 0%, #ff8c00 100%);
}

.chart-type-indicator.posiciones {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Responsive chart adjustments */
@media (max-width: 768px) {
    .chart-container {
        min-height: 300px;
        padding: 0.5rem;
    }
    
    #chartDetailsPanel .row {
        flex-direction: column;
    }
    
    #chartDetailsPanel .col-md-6 {
        margin-bottom: 1rem;
    }
    
    .trend-charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Chart animation */
@keyframes chartFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chart-animate {
    animation: chartFadeIn 0.6s ease forwards;
}

/* Enhanced empty state */
#chartEmptyState {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 2px dashed #dee2e6;
    border-radius: 15px;
    margin: 2rem 0;
    transition: all 0.3s ease;
}

#chartEmptyState:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #ffffff 0%, #f0f0ff 100%);
}

/* Chart controls section */
.chart-controls {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Trend chart titles */
.trend-chart-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

/* Chart legends custom styling */
.chart-legend-custom {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Success state for charts */
.chart-success-state {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    color: #155724;
}

.chart-success-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Advanced Charts Styles */
.speed-progress-item {
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

.speed-progress-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chart containers */
.card-body canvas {
    transition: all 0.3s ease;
}

.card:hover .card-body canvas {
    transform: scale(1.01);
}

/* Advanced metrics cards */
.bg-gradient {
    position: relative;
    overflow: hidden;
}

.bg-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.bg-gradient:hover::before {
    left: 100%;
}

/* Performance indicators */
.performance-excellent { color: #28a745; }
.performance-good { color: #17a2b8; }
.performance-average { color: #ffc107; }
.performance-poor { color: #dc3545; }

/* Responsive chart adjustments */
@media (max-width: 768px) {
    .card-body canvas {
        height: 200px !important;
    }
    
    .speed-progress-item {
        margin-bottom: 1rem;
    }
}

/* Chart hover effects */
.chart-container:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* Loading states for charts */
.chart-loading {
    position: relative;
}

.chart-loading::after {
    content: 'Cargando...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.9);
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    color: #6c757d;
}
