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

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --status-2xx: #22c55e;
    --status-3xx: #3b82f6;
    --status-4xx: #f59e0b;
    --status-5xx: #ef4444;
    --status-0: #94a3b8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

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

main {
    flex: 1;
}

.upload-section {
    max-width: 600px;
    margin: 0 auto;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.drop-zone:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.drop-text {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

#fileInput {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.actions {
    margin-top: 1.5rem;
    text-align: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: 8px;
    color: var(--error);
    display: none;
}

.error-message.show {
    display: block;
}

.card-section {
    animation: fadeIn 0.3s ease;
}

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

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

.card-header h2 {
    font-size: 1.875rem;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.card-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    gap: 0.5rem;
}

.meta-label {
    color: var(--text-muted);
    font-weight: 600;
}

.meta-value {
    color: var(--text-primary);
    word-break: break-all;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.histogram-section,
.failed-section,
.slowest-section {
    margin-top: 2.5rem;
}

h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.histogram {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.histogram-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.histogram-label {
    min-width: 80px;
    font-weight: 600;
    font-size: 0.875rem;
}

.histogram-track {
    flex: 1;
    background: var(--bg-tertiary);
    border-radius: 4px;
    height: 32px;
    position: relative;
    overflow: hidden;
}

.histogram-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.histogram-fill.status-2xx { background: var(--status-2xx); }
.histogram-fill.status-3xx { background: var(--status-3xx); }
.histogram-fill.status-4xx { background: var(--status-4xx); }
.histogram-fill.status-5xx { background: var(--status-5xx); }
.histogram-fill.status-0 { background: var(--status-0); }
.histogram-fill.status-other { background: var(--text-muted); }

.failed-count {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.failed-list,
.slowest-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.request-item {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--border-color);
}

.request-item.failed {
    border-left-color: var(--error);
}

.request-item.slow {
    border-left-color: var(--warning);
}

.request-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.request-method {
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--accent);
}

.request-status {
    font-weight: 700;
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.request-status.status-2xx { background: var(--status-2xx); color: white; }
.request-status.status-3xx { background: var(--status-3xx); color: white; }
.request-status.status-4xx { background: var(--status-4xx); color: white; }
.request-status.status-5xx { background: var(--status-5xx); color: white; }
.request-status.status-0 { background: var(--status-0); color: white; }
.request-status.status-error { background: var(--error); color: white; }

.request-time {
    color: var(--warning);
    font-weight: 600;
    font-size: 0.875rem;
}

.request-url {
    color: var(--text-secondary);
    font-size: 0.875rem;
    word-break: break-all;
    font-family: 'Monaco', 'Courier New', monospace;
}

.request-error {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-style: italic;
}

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

.slowest-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slowest-controls label {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.slowest-controls select {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    cursor: pointer;
}

.slowest-controls select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transform: translateY(150%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
}

footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

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

    .card-content {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .toast {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
    }
}
