/**
 * Analytics Dashboard Styles
 * Comprehensive styling for advanced analytics visualizations
 */

/* Analytics Container */
.analytics-dashboard {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    background: #F8F9FA;
}

/* Analytics Header */
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.analytics-header h2 {
    margin: 0;
    color: #2C3E50;
    font-size: 1.8rem;
}

.analytics-subtitle {
    margin: 0.5rem 0 0 0;
    color: #7F8C8D;
    font-size: 0.95rem;
}

/* Date Range Selector */
.date-range-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.date-range-selector label {
    font-weight: 600;
    color: #2C3E50;
}

.date-range-selector select {
    padding: 0.6rem 1rem;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.date-range-selector select:hover {
    border-color: #E87722;
}

.date-range-selector select:focus {
    outline: none;
    border-color: #E87722;
    box-shadow: 0 0 0 3px rgba(232, 119, 34, 0.1);
}

/* KPI Section */
.kpi-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2C3E50;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.kpi-label {
    font-size: 0.85rem;
    color: #7F8C8D;
    font-weight: 500;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.analytics-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.analytics-card.full-width {
    grid-column: 1 / -1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #F0F0F0;
}

.card-header h3 {
    margin: 0;
    color: #2C3E50;
    font-size: 1.2rem;
}

.info-badge {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E8F4F8;
    color: #E87722;
    border-radius: 50%;
    cursor: help;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.info-badge:hover {
    background: #E87722;
    color: white;
}

/* Chart Canvas */
canvas {
    max-height: 300px;
}

.analytics-card.full-width canvas {
    max-height: 400px;
}

/* No Data Message */
.no-data {
    text-align: center;
    padding: 2rem;
    color: #95A5A6;
    font-style: italic;
}

/* Top Crew List */
.top-crew-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.top-crew-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #F8F9FA;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.top-crew-item:hover {
    background: #E8F4F8;
    transform: translateX(4px);
}

.crew-rank {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E87722, #F4A261);
    color: white;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.crew-info {
    flex: 1;
}

.crew-name {
    font-weight: 600;
    color: #2C3E50;
    margin-bottom: 0.25rem;
}

.crew-stats {
    font-size: 0.85rem;
    color: #7F8C8D;
}

.crew-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active {
    background: #D4EDDA;
    color: #155724;
}

.badge-inactive {
    background: #F8D7DA;
    color: #721C24;
}

/* Last-Minute Analysis */
.last-minute-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
}

.last-minute-card {
    padding: 1.25rem;
    background: #F8F9FA;
    border-radius: 10px;
    border: 2px solid #E0E0E0;
    transition: all 0.3s ease;
}

.last-minute-card:hover {
    border-color: #E87722;
    box-shadow: 0 4px 12px rgba(232, 119, 34, 0.15);
}

.last-minute-month {
    font-weight: 700;
    color: #2C3E50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.last-minute-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-item.highlight .stat-value {
    color: #E74C3C;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2C3E50;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: #7F8C8D;
    margin-top: 0.25rem;
}

.percentage-bar {
    height: 8px;
    background: #E0E0E0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.percentage-fill {
    height: 100%;
    background: linear-gradient(90deg, #E74C3C, #E87722);
    transition: width 0.6s ease;
}

.percentage-label {
    font-size: 0.85rem;
    color: #7F8C8D;
    text-align: center;
}

/* Equipment List */
.equipment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.equipment-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.equipment-name {
    font-weight: 600;
    color: #2C3E50;
    font-size: 0.95rem;
}

.equipment-bar {
    position: relative;
    height: 28px;
    background: #F0F0F0;
    border-radius: 6px;
    overflow: hidden;
}

.equipment-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #52B788, #2A9D8F);
    transition: width 0.6s ease;
}

.equipment-count {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: #2C3E50;
    font-size: 0.85rem;
    z-index: 1;
}

/* Conflict History */
.conflict-success {
    text-align: center;
    padding: 3rem 2rem;
    color: #52B788;
}

.conflict-success i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.conflict-success p {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.conflict-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.conflict-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #FFF3CD;
    border: 2px solid #FFE69C;
    border-radius: 8px;
    color: #856404;
    font-weight: 600;
}

.conflict-summary i {
    font-size: 1.2rem;
}

.conflict-card {
    padding: 1.25rem;
    background: #FFF3CD;
    border: 2px solid #FFE69C;
    border-radius: 8px;
}

.conflict-crew {
    font-weight: 700;
    color: #856404;
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.conflict-events {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

.conflict-event {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.conflict-event strong {
    color: #2C3E50;
}

.conflict-date {
    font-size: 0.85rem;
    color: #7F8C8D;
}

.conflict-separator {
    font-size: 1.5rem;
    color: #E74C3C;
}

/* Analytics Footer */
.analytics-footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #E0E0E0;
}

.btn-export {
    padding: 0.9rem 2rem;
    background: white;
    border: 2px solid #E87722;
    color: #E87722;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-export:hover {
    background: #E87722;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 119, 34, 0.3);
}

.btn-export i {
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .analytics-card.full-width {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .analytics-dashboard {
        padding: 1rem;
    }
    
    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .kpi-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .last-minute-grid {
        grid-template-columns: 1fr;
    }
    
    .conflict-events {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .conflict-separator {
        transform: rotate(90deg);
    }
    
    .analytics-footer {
        flex-direction: column;
    }
    
    .btn-export {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .kpi-section {
        grid-template-columns: 1fr;
    }
    
    .kpi-card {
        padding: 1rem;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
    
    .analytics-header h2 {
        font-size: 1.4rem;
    }
}

/* Print Styles */
@media print {
    .analytics-header {
        box-shadow: none;
        border: 1px solid #E0E0E0;
    }
    
    .analytics-card {
        box-shadow: none;
        border: 1px solid #E0E0E0;
        page-break-inside: avoid;
    }
    
    .analytics-footer {
        display: none;
    }
    
    .date-range-selector select {
        border: 1px solid #E0E0E0;
    }
    
    .btn-export {
        display: none;
    }
}
