:root {
    --bg-dark: #0a0a0c;
    --bg-card: #131316;
    --bg-hover: #1c1c21;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent-primary: #f8fafc;
    --accent-secondary: #475569;
    --accent-glow: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #27272a;

    --font-main: 'Outfit', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    overflow-x: hidden;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 20px var(--accent-glow);
}

h1 {
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-link-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.header-link-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.report-select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.report-select:hover {
    border-color: var(--text-secondary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Dashboard Grid */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-secondary);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 0.25rem;
}

.stat-card .trend {
    font-size: 0.875rem;
    color: var(--success);
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    min-height: 400px;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-container h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-dark);
    padding: 0.25rem;
    border-radius: 6px;
}

.chart-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.chart-btn.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chart-canvas {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

/* Explorer Row */
.explorer-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 6px;
    font-family: var(--font-main);
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    font-size: 0.875rem;
}

.data-table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-hover);
}

/* Footer */
.main-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* SVG Chart Styles */
.bar {
    fill: var(--text-secondary);
    transition: fill 0.2s, height 0.5s ease-out;
}

.bar:hover {
    fill: var(--text-primary);
}

.axis-line {
    stroke: var(--border);
    stroke-width: 1;
}

.axis-text {
    fill: var(--text-secondary);
    font-size: 10px;
    font-family: var(--font-mono);
}

.tooltip {
    position: absolute;
    background: var(--bg-hover);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    pointer-events: none;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

/* Responsive */
@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
}

/* Tablet */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        gap: 1.5rem;
    }

    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-controls {
        width: 100%;
        justify-content: space-between;
    }

    h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .value {
        font-size: 1.5rem;
    }

    .charts-row {
        min-height: 300px;
        gap: 1rem;
    }

    .chart-container {
        padding: 1rem;
    }

    .explorer-row {
        padding: 1rem;
        gap: 1rem;
    }

    .explorer-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-box {
        width: 100%;
    }

    .view-tabs {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .view-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }

    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
        max-height: 90vh;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .app-container {
        padding: 0.75rem;
        gap: 1rem;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-card h3 {
        font-size: 0.75rem;
    }

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

    .stat-card .trend {
        font-size: 0.75rem;
    }

    .chart-container h2 {
        font-size: 1rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .chart-controls {
        width: 100%;
    }

    .chart-btn {
        flex: 1;
        text-align: center;
    }

    .filter-group {
        width: 100%;
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1;
        text-align: center;
        min-width: 80px;
    }

    .matcher-chips {
        max-height: 120px;
        overflow-y: auto;
    }

    .pattern-type-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    th, td {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.625rem;
        padding: 0.125rem 0.375rem;
    }

    .main-footer {
        font-size: 0.75rem;
        padding-top: 1rem;
    }

    .modal-content {
        margin: 0.5rem;
        padding: 1rem;
        border-radius: 8px;
    }

    .modal-content h2 {
        font-size: 1.25rem;
    }

    .credit-item {
        padding: 0.75rem;
    }
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.badge-purple {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

/* View Tabs */
.view-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-dark);
    padding: 0.25rem;
    border-radius: 6px;
}

.view-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.view-tab.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Matcher Chips */
.matcher-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.matcher-chip {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    border-radius: 16px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.matcher-chip:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.matcher-chip.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* Pattern Type Buttons */
.pattern-type-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.pattern-type-btn.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.modal-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-body ul {
    list-style: none;
    padding-left: 0;
    margin-top: 0.5rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.modal-body li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--text-primary);
}

.modal-body a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.2s;
}

.modal-body a:hover {
    border-color: var(--text-primary);
}

.credit-list {
    margin-top: 1rem;
}

.credit-item {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-hover);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.credit-item strong {
    color: var(--text-primary);
    font-size: 1rem;
}

.credit-item p {
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 0.875rem;
    font-style: italic;
    color: var(--text-secondary);
}