/* =============================================
   API Response Time Simulator — Styles
   ============================================= */

:root {
    --bg: #0a0f1a;
    --bg-card: #111827;
    --bg-elevated: #1a2235;
    --border: #1f2a3f;
    --border-light: #2d3a52;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --red-400: #f87171;
    --red-500: #ef4444;
    --yellow-400: #facc15;
    --orange-400: #fb923c;
    --blue-400: #60a5fa;
    --cyan-400: #22d3ee;

    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.625rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.logo h1 {
    font-size: 1rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text);
}

.btn-primary {
    background: var(--green-600);
    color: #fff;
}

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

.btn-danger {
    background: var(--red-500);
    color: #fff;
}

.btn-danger:hover {
    background: var(--red-400);
}

.btn-lg {
    width: 100%;
    justify-content: center;
    padding: 0.75rem;
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
}

/* Main Layout */
.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
    align-items: start;
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.panel-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}

/* Form */
.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.input {
    width: 100%;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.625rem;
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    transition: var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.input option {
    background: var(--bg-card);
}

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

.divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--green-500);
}

/* Results */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text);
}

.stat-card.success .stat-value {
    color: var(--green-400);
}

.stat-card.error .stat-value {
    color: var(--red-400);
}

/* Histogram */
.chart-panel {
    min-height: 180px;
}

.histogram {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 160px;
    padding-top: 0.5rem;
}

.hist-bar {
    flex: 1;
    border-radius: 3px 3px 0 0;
    min-width: 4px;
    transition: height 0.3s ease;
    position: relative;
    cursor: default;
}

.hist-bar.success {
    background: var(--green-500);
}

.hist-bar.error {
    background: var(--red-500);
}

.hist-bar.timeout {
    background: var(--orange-400);
}

.hist-bar:hover {
    opacity: 0.8;
}

.hist-bar .hist-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    white-space: nowrap;
    z-index: 10;
}

.hist-bar:hover .hist-tooltip {
    display: block;
}

/* Request Log */
.request-log {
    max-height: 400px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-num {
    color: var(--text-muted);
    min-width: 24px;
}

.log-status {
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.6875rem;
    min-width: 42px;
    text-align: center;
}

.log-status.s200 {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green-400);
}

.log-status.s4xx {
    background: rgba(250, 204, 21, 0.15);
    color: var(--yellow-400);
}

.log-status.s5xx {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red-400);
}

.log-status.timeout {
    background: rgba(251, 146, 60, 0.15);
    color: var(--orange-400);
}

.log-time {
    color: var(--text-secondary);
}

.log-retries {
    color: var(--cyan-400);
    font-size: 0.625rem;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-style: italic;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 900px) {
    .app-main {
        grid-template-columns: 1fr;
    }

    .stats-bar {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}