/* ============================================
   GPS Fleet Monitor - Reports Page Styles
   Professional Report & Export Center
   ============================================ */

:root {
    --report-primary: #3b82f6;
    --report-primary-dark: #2563eb;
    --report-success: #10b981;
    --report-warning: #f59e0b;
    --report-danger: #ef4444;
    --report-info: #06b6d4;
    --report-purple: #8b5cf6;
    --report-pink: #ec4899;
    --report-bg: #f8fafc;
    --report-card-bg: #ffffff;
    --report-border: #e2e8f0;
    --report-text: #1e293b;
    --report-text-muted: #64748b;
    --report-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --report-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Page Layout */
.reports-page {
    background: var(--report-bg);
    min-height: 100vh;
    padding: 0;
}

.reports-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

/* Page Header */
.reports-header {
    background: linear-gradient(135deg, var(--report-primary) 0%, var(--report-purple) 100%);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: var(--report-shadow-lg);
}

.reports-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.reports-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.reports-title-icon {
    font-size: 3rem;
}

.reports-title h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.reports-title p {
    margin: 0.25rem 0 0 0;
    opacity: 0.9;
    font-size: 1rem;
}

.reports-header-stats {
    display: flex;
    gap: 2rem;
}

.header-stat {
    text-align: center;
    padding: 0.5rem 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.header-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
}

.header-stat-label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Report Categories Grid */
.report-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.report-category-card {
    background: var(--report-card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--report-shadow);
    border: 1px solid var(--report-border);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.report-category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--report-shadow-lg);
}

.report-category-card.active {
    border-color: var(--report-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.report-category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.report-category-card.speed::before {
    background: linear-gradient(90deg, var(--report-danger), var(--report-warning));
}

.report-category-card.night::before {
    background: linear-gradient(90deg, var(--report-purple), var(--report-pink));
}

.report-category-card.alarms::before {
    background: linear-gradient(90deg, var(--report-info), var(--report-primary));
}

.report-category-card.geofence::before {
    background: linear-gradient(90deg, var(--report-success), var(--report-info));
}

.category-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.category-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

.report-category-card.speed .category-icon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(245, 158, 11, 0.15));
}

.report-category-card.night .category-icon {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.15));
}

.report-category-card.alarms .category-icon {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(59, 130, 246, 0.15));
}

.report-category-card.geofence .category-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 182, 212, 0.15));
}

.category-info h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--report-text);
}

.category-info p {
    margin: 0.35rem 0 0 0;
    font-size: 0.85rem;
    color: var(--report-text-muted);
    line-height: 1.4;
}

.category-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--report-border);
}

.category-stat {
    display: flex;
    flex-direction: column;
}

.category-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--report-text);
}

.category-stat-label {
    font-size: 0.75rem;
    color: var(--report-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Report Panel (Active Report) */
.report-panel {
    background: var(--report-card-bg);
    border-radius: 16px;
    box-shadow: var(--report-shadow);
    border: 1px solid var(--report-border);
    overflow: hidden;
    display: none;
    animation: slideDown 0.3s ease;
}

.report-panel.active {
    display: block;
}

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

.report-panel-header {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--report-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-panel-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.report-panel-title h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--report-text);
}

.report-panel-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--report-text-muted);
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.report-panel-close:hover {
    background: var(--report-border);
    color: var(--report-text);
}

.report-panel-content {
    padding: 2rem;
}

/* Report Controls */
.report-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid var(--report-border);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 180px;
}

.control-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--report-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group input,
.control-group select {
    padding: 0.75rem 1rem;
    border: 1px solid var(--report-border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--report-text);
    background: white;
    transition: all 0.2s;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: var(--report-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.control-buttons {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn-report {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-report:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--report-primary), var(--report-primary-dark));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--report-success), #059669);
    color: white;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--report-warning), #d97706);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--report-danger), #dc2626);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-outline {
    background: white;
    border: 1px solid var(--report-border);
    color: var(--report-text);
}

.btn-outline:hover:not(:disabled) {
    background: #f8fafc;
    border-color: var(--report-primary);
    color: var(--report-primary);
}

/* Report Summary Cards */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: linear-gradient(135deg, #f8fafc, white);
    border: 1px solid var(--report-border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.summary-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.summary-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--report-text);
    display: block;
}

.summary-card-label {
    font-size: 0.8rem;
    color: var(--report-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card.danger {
    border-left: 4px solid var(--report-danger);
}

.summary-card.warning {
    border-left: 4px solid var(--report-warning);
}

.summary-card.success {
    border-left: 4px solid var(--report-success);
}

.summary-card.info {
    border-left: 4px solid var(--report-info);
}

/* Results Table */
.report-results {
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--report-border);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--report-border);
}

.results-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--report-text);
}

.results-actions {
    display: flex;
    gap: 0.5rem;
}

.expand-btn {
    background: none;
    border: 1px solid var(--report-border);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--report-text-muted);
    transition: all 0.2s;
}

.expand-btn:hover {
    background: white;
    color: var(--report-primary);
    border-color: var(--report-primary);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}

.report-table thead {
    background: #f1f5f9;
}

.report-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--report-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--report-border);
}

.report-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--report-border);
    font-size: 0.95rem;
    color: var(--report-text);
}

.report-table tbody tr:hover {
    background: #f8fafc;
}

.report-table tbody tr:last-child td {
    border-bottom: none;
}

/* Vehicle Group Header Row */
.vehicle-group-header {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9) !important;
    cursor: pointer;
}

.vehicle-group-header:hover {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0) !important;
}

.vehicle-header-cell {
    padding: 0.75rem 1.25rem !important;
}

.vehicle-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vehicle-expand-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--report-text-muted);
}

.vehicle-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.vehicle-name-header {
    font-weight: 600;
    color: var(--report-text);
}

.vehicle-device {
    font-size: 0.85rem;
    color: var(--report-text-muted);
}

.vehicle-stats {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.stat-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.stat-badge.violations-count {
    background: rgba(239, 68, 68, 0.1);
    color: var(--report-danger);
}

.stat-badge.max-speed {
    background: rgba(245, 158, 11, 0.1);
    color: var(--report-warning);
}

.stat-badge.avg-over {
    background: rgba(59, 130, 246, 0.1);
    color: var(--report-primary);
}

/* Speed Over Badge */
.speed-over-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, var(--report-danger), var(--report-warning));
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Map Link */
.map-link {
    color: var(--report-primary);
    text-decoration: none;
    font-weight: 500;
}

.map-link:hover {
    text-decoration: underline;
}

/* Empty State */
.report-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--report-text-muted);
}

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

.report-empty h3 {
    margin: 0 0 0.5rem 0;
    color: var(--report-text);
}

.report-empty p {
    margin: 0;
    font-size: 0.95rem;
}

/* Loading State */
.report-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.report-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--report-border);
    border-top-color: var(--report-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.report-loading p {
    color: var(--report-text-muted);
    margin: 0;
}

/* Quick Actions Bar */
.quick-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 16px;
    box-shadow: var(--report-shadow);
    border: 1px solid var(--report-border);
    margin-bottom: 2rem;
}

.quick-action-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background: #f8fafc;
    border: 2px dashed var(--report-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--report-text);
}

.quick-action-btn:hover {
    border-style: solid;
    border-color: var(--report-primary);
    background: rgba(59, 130, 246, 0.05);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: white;
    box-shadow: var(--report-shadow);
}

.quick-action-btn span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .reports-container {
        padding: 1.5rem;
    }

    .reports-header {
        padding: 1.5rem;
    }

    .reports-header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .reports-header-stats {
        width: 100%;
        justify-content: space-around;
    }

    .report-categories {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        flex-wrap: wrap;
    }

    .quick-action-btn {
        min-width: calc(50% - 0.5rem);
    }
}

@media (max-width: 768px) {
    .reports-container {
        padding: 1rem;
    }

    .reports-header {
        border-radius: 12px;
        padding: 1.25rem;
    }

    .reports-title h1 {
        font-size: 1.5rem;
    }

    .header-stat {
        padding: 0.5rem 1rem;
    }

    .header-stat-value {
        font-size: 1.25rem;
    }

    .report-controls {
        flex-direction: column;
    }

    .control-group {
        width: 100%;
    }

    .control-buttons {
        width: 100%;
        justify-content: stretch;
    }

    .control-buttons .btn-report {
        flex: 1;
        justify-content: center;
    }

    .report-table {
        font-size: 0.85rem;
    }

    .report-table th,
    .report-table td {
        padding: 0.75rem;
    }

    .vehicle-stats {
        flex-wrap: wrap;
    }

    .quick-actions {
        flex-direction: column;
    }

    .quick-action-btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .reports-header,
    .report-controls,
    .control-buttons,
    .quick-actions,
    .report-category-card {
        display: none !important;
    }

    .report-panel {
        box-shadow: none;
        border: none;
    }

    .report-table {
        font-size: 10pt;
    }
}

/* Night Travel Specific Styles */
.night-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, var(--report-purple), var(--report-pink));
    color: white;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.duration-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    color: var(--report-purple);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Alarms Report Specific Styles */
.alarm-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.alarm-type-badge.critical {
    background: rgba(239, 68, 68, 0.1);
    color: var(--report-danger);
}

.alarm-type-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--report-warning);
}

.alarm-type-badge.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--report-primary);
}

/* Date Range Presets */
.date-presets {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.date-preset-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--report-border);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--report-text);
}

.date-preset-btn:hover {
    border-color: var(--report-primary);
    color: var(--report-primary);
}

.date-preset-btn.active {
    background: var(--report-primary);
    color: white;
    border-color: var(--report-primary);
}

/* Status Indicator */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.active {
    background: var(--report-success);
}

.status-dot.pending {
    background: var(--report-warning);
}

.status-dot.inactive {
    background: var(--report-text-muted);
}
