/* ================================
   KABI FLEET CSS - EXACT DASHBOARD STYLING
   ================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fdfdfd;
    color: #1f2937;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header Styles */
.header {
    background: white;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-right .fleet-date-range-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.header-right .fleet-date-range-group .date-range-text {
    color: #6b7280;
    font-weight: 500;
}

.header-right .fleet-date-range-group label {
    color: #374151;
    font-weight: 500;
    margin: 0;
}

.header-right .fleet-date-range-group .date-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    min-width: 140px;
}

.header-right .fleet-date-range-group .apply-btn {
    padding: 8px 16px;
    background: #34d399;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.header-right .fleet-date-range-group .apply-btn:hover {
    background: #10b981;
}

.bolt-logo {
    width: 80px;
    height: 48px;
    background: #34d399;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 24px;
    letter-spacing: -0.3px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.title {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.2px;
}

.subtitle {
    font-size: 15px;
    color: #6b7280;
    margin-top: 2px;
    font-weight: 400;
}

/* Form Controls */
select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 16px;
    min-width: 140px;
    height: 44px;
    cursor: pointer;
    transition: border-color 0.2s;
}

select:hover {
    border-color: #9ca3af;
}

select:focus {
    outline: none;
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.date-input {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 16px;
    min-width: 180px;
    height: 44px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.date-input:hover {
    border-color: #9ca3af;
}

.date-input:focus {
    outline: none;
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

/* Main Content Area */
.main-content {
    display: flex;
    height: calc(100vh - 89px);
    background: #fdfdfd;
}

.content-area {
    flex: 1;
    position: relative;
    overflow: visible;
}

/* Fleet View Styles */
.fleet-view {
    padding: 0 40px;
    background: #f8fafc;
    min-height: 100%;
    overflow-y: auto;
    width: 100%;
}

.fleet-content {
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Fleet Header with Date Controls */
.fleet-header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
}

.fleet-date-range-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.fleet-date-range-group .date-range-text {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.fleet-date-range-group label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.fleet-date-range-group .date-input {
    min-width: 160px;
    height: 40px;
    font-size: 14px;
}

.fleet-date-range-group .apply-btn {
    padding: 10px 20px;
    background: #34d399;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 40px;
}

.fleet-date-range-group .apply-btn:hover {
    background: #10b981;
    transform: translateY(-1px);
}

/* Fleet Summary Stats Cards */
.fleet-summary-stats {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 20px;
    margin-bottom: 40px;
    width: 100%;
}

.fleet-stat-card {
    background: white;
    border-radius: 16px;
    padding: 20px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-align: center;
    border: 1px solid #e5e7eb;
    min-width: 0;
    position: relative;
}

.fleet-stat-value {
    font-size: 32px;
    font-weight: 900;
    color: #10b981;
    margin-bottom: 8px;
}

.fleet-stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Info Icon Styles */
.info-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #9ca3af;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    cursor: help;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.info-icon:hover {
    background: #6b7280;
}

/* Tooltip Styles */
.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Tooltip arrow */
.info-icon::before {
    content: '';
    position: absolute;
    bottom: 117%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
}

.info-icon:hover::after,
.info-icon:hover::before {
    opacity: 1;
    visibility: visible;
}

.fleet-stat-sublabel {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    margin-top: 4px;
}

/* Fleet Analytics Section */
.fleet-analytics-section {
    background: white;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 20px 80px;
    margin-bottom: 40px;
}

.fleet-trend-container {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.comparison-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.metric-selector-analytics {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric-selector-analytics label {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
}

.metric-selector-analytics select {
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.metric-selector-analytics select:hover {
    border-color: #9ca3af;
}

.metric-selector-analytics select:focus {
    outline: none;
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

/* Chart Styles */
.chart-section {
    flex: 1;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-svg {
    width: 100%;
    height: 100%;
}

.chart-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    display: none;
    white-space: nowrap;
}

/* Fleet Table Section */
.fleet-table-section {
    background: white;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-top: 40px;
    padding: 20px 80px;
}

.fleet-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.download-btn:active {
    transform: translateY(0);
}

.download-icon {
    font-size: 16px;
}

.fleet-table-container {
    position: relative;
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.fleet-table-wrapper {
    max-height: 500px;
    overflow: auto;
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.fleet-performance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    position: relative;
}

.fleet-performance-table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Freeze first column and date formatting */
.fleet-performance-table th:first-child,
.fleet-performance-table td:first-child {
    position: sticky;
    left: 0;
    background: #f8f9fa;
    z-index: 11;
    border-right: 2px solid #e5e7eb;
    min-width: 120px;
    white-space: nowrap;
}

.fleet-performance-table th:first-child {
    z-index: 12;
    background: #e5e7eb;
}

.fleet-performance-table td:first-child {
    background: white;
    font-weight: 600;
    color: #374151;
}

.fleet-performance-table tbody tr:hover td:first-child {
    background: #f9fafb;
}

.fleet-performance-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    color: #6b7280;
}

.fleet-performance-table tbody tr:hover {
    background: #f9fafb;
}

.fleet-performance-table tbody tr:last-child td {
    border-bottom: none;
}

/* Excel-style Header */
.excel-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    border-right: 1px solid #d1d5db;
}

.excel-header:hover {
    background: #e5e7eb;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-text {
    flex: 1;
    text-align: left;
}

.header-icons {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.sort-icon {
    font-size: 10px;
    color: #9ca3af;
    cursor: pointer;
}

.filter-arrow {
    font-size: 8px;
    color: #6b7280;
    cursor: pointer;
    padding: 2px;
    border-radius: 2px;
}

.filter-arrow:hover {
    background: #f3f4f6;
}

.filter-arrow.active {
    background: #3b82f6;
    color: white;
}

.excel-header.asc .sort-icon {
    color: #3b82f6;
}

.excel-header.desc .sort-icon {
    color: #3b82f6;
}

/* Filter Dropdown */
.filter-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    width: 280px;
    max-height: 400px;
    overflow: hidden;
}

.filter-header {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
}

.filter-search {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.filter-search:focus {
    border-color: #3b82f6;
}

.filter-clear {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.filter-clear:hover {
    background: #e5e7eb;
}

.filter-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    gap: 8px;
}

.filter-option:hover {
    background: #f9fafb;
}

.filter-option input[type="checkbox"] {
    margin-right: 8px;
}

.filter-footer {
    padding: 8px 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.filter-ok, .filter-cancel {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    background: white;
}

.filter-ok {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.filter-ok:hover {
    background: #2563eb;
}

.filter-cancel:hover {
    background: #f3f4f6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .fleet-view {
        padding: 0 20px;
    }
    
    .fleet-analytics-section,
    .fleet-table-section {
        padding: 20px 20px;
    }
    
    .comparison-controls {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .fleet-summary-stats {
        grid-template-columns: 1fr;
    }
    
    .fleet-date-range-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 20px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .fleet-table-wrapper {
        font-size: 12px;
    }
    
    .fleet-performance-table th,
    .fleet-performance-table td {
        padding: 8px 12px;
    }
}