/* ============================================================================
   Vehicle Tracking Violation Detector - Stylesheet
   ============================================================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.app-header p {
    font-size: 1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

/* Instructions Panel */
.instructions-panel {
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.instructions-panel h3 {
    color: #1e40af;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.instructions-panel ul {
    list-style: none;
    padding-left: 0;
}

.instructions-panel li {
    color: #1e3a8a;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.instructions-panel li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    font-weight: bold;
}

/* Upload Section */
.upload-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.upload-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.upload-card h3 {
    margin-bottom: 1rem;
    color: #1f2937;
    font-size: 1.1rem;
}

.file-input-wrapper {
    position: relative;
}

.file-input {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.file-label:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.file-icon {
    font-size: 2rem;
}

.file-name {
    color: #2563eb;
    font-weight: 500;
}

/* Process Section */
.process-section {
    margin-bottom: 2rem;
}

.process-btn {
    width: 100%;
    padding: 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.process-btn:hover:not(:disabled) {
    background: #1d4ed8;
}

.process-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.btn-spinner {
    display: inline-block;
}

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    color: #991b1b;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.error-message::before {
    content: "⚠️";
    font-size: 1.5rem;
}

/* Dashboard Section */
.dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header h2 {
    color: #1f2937;
    font-size: 1.5rem;
}

.processed-time {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.stat-blue { background: #eff6ff; }
.stat-green { background: #f0fdf4; }
.stat-purple { background: #faf5ff; }
.stat-orange { background: #fff7ed; }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-blue .stat-value { color: #2563eb; }
.stat-green .stat-value { color: #16a34a; }
.stat-purple .stat-value { color: #9333ea; }
.stat-orange .stat-value { color: #ea580c; }

.stat-label {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Violation Breakdown */
.violation-breakdown {
    margin-bottom: 1.5rem;
}

.violation-breakdown h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #1f2937;
}

.violation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fef2f2;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.violation-name {
    color: #991b1b;
    font-size: 0.9rem;
}

.violation-count {
    color: #dc2626;
    font-weight: 700;
}

/* Unmatched Stats */
.unmatched-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.unmatched-item {
    background: #fefce8;
    padding: 0.75rem 1rem;
    border-radius: 6px;
}

.unmatched-label {
    color: #713f12;
}

.unmatched-value {
    font-weight: 700;
    color: #ca8a04;
    margin-left: 0.5rem;
}

/* Filters Section */
.filters-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #2563eb;
}

.export-btn {
    padding: 0.75rem 1.5rem;
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.export-btn:hover {
    background: #15803d;
}

.results-count {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Table Section */
.table-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table td {
    padding: 1rem;
    color: #1f2937;
}

.vin-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.source-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.source-both {
    background: #d1fae5;
    color: #065f46;
}

.source-tracking {
    background: #dbeafe;
    color: #1e40af;
}

.source-tsd {
    background: #f3e8ff;
    color: #6b21a8;
}

.violation-cell {
    color: #dc2626;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
}

.violation-cell::before {
    content: "⚠️";
    font-size: 1rem;
}

.no-violation {
    color: #16a34a;
}

.no-violation::before {
    content: "✓";
    font-weight: bold;
}

.notes-cell {
    color: #6b7280;
    font-size: 0.85rem;
}

/* Footer */
.app-footer {
    background: #1f2937;
    color: #9ca3af;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters-row {
        flex-direction: column;
    }

    .search-input,
    .filter-select,
    .export-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}