/* CSS Variables - Modern Color Palette */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --bg-dark: #0f0f23;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent: #667eea;
    --accent-hover: #764ba2;
    --success: #10b981;
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at top left, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2rem 0;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* JSON Input Section */
.json-input-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.data-source-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.indicator-dot.default {
    background: var(--accent);
}

.indicator-dot.custom {
    background: #10b981;
}

.indicator-dot.waiting {
    background: #f59e0b;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.json-input-wrapper {
    margin-bottom: 1rem;
}

.json-input-wrapper textarea {
    width: 100%;
    height: 150px;
    padding: 1rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.3s ease;
}

.json-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.json-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.json-input-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.parse-result {
    display: none;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: opacity 0.3s ease;
}

.parse-result.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.parse-result.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.parse-result.info {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: var(--accent);
}

/* Filter Section */
.filter-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.filter-row {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.filter-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.filter-group select option {
    background: #1a1a2e;
    color: var(--text-primary);
}

.filter-group input::placeholder {
    color: var(--text-muted);
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Stats Bar */
.stats-bar {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#total-count {
    font-weight: 600;
    color: var(--accent);
    font-size: 1rem;
}

/* Table Container */
.table-container {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(102, 126, 234, 0.15);
}

th {
    padding: 1.25rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

th.sortable:hover {
    background: rgba(102, 126, 234, 0.25);
    color: var(--text-primary);
}

th.sortable.active {
    color: var(--accent);
}

.sort-icon {
    margin-left: 0.5rem;
    opacity: 0.5;
    font-size: 0.75rem;
}

th.sortable.active .sort-icon {
    opacity: 1;
}

th.sortable.asc .sort-icon::after {
    content: '↑';
}

th.sortable.desc .sort-icon::after {
    content: '↓';
}

tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

td {
    padding: 1rem 1.5rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

td:first-child {
    font-weight: 600;
    color: var(--accent);
}

td:nth-child(2) {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td:nth-child(3),
td:nth-child(4) {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--success);
}

/* Loading State */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading.show {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Welcome State */
.welcome-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-primary);
}

.welcome-state .icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
}

.welcome-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.supported-formats {
    display: inline-flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.supported-formats p {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.supported-formats code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8125rem;
    background: rgba(102, 126, 234, 0.15);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    color: var(--accent);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge-vehicle {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.4);
}

.badge-normal {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .btn-group {
        width: 100%;
    }

    .btn {
        flex: 1;
    }

    th,
    td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    td:nth-child(2) {
        max-width: 200px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Animation for table rows */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

tbody tr {
    animation: fadeIn 0.3s ease forwards;
}

tbody tr:nth-child(1) {
    animation-delay: 0.02s;
}

tbody tr:nth-child(2) {
    animation-delay: 0.04s;
}

tbody tr:nth-child(3) {
    animation-delay: 0.06s;
}

tbody tr:nth-child(4) {
    animation-delay: 0.08s;
}

tbody tr:nth-child(5) {
    animation-delay: 0.10s;
}

tbody tr:nth-child(6) {
    animation-delay: 0.12s;
}

tbody tr:nth-child(7) {
    animation-delay: 0.14s;
}

tbody tr:nth-child(8) {
    animation-delay: 0.16s;
}

tbody tr:nth-child(9) {
    animation-delay: 0.18s;
}

tbody tr:nth-child(10) {
    animation-delay: 0.20s;
}