/* Arc Playground — custom styles */

:root {
    --blue-500: #2563eb;
    --blue-600: #1d4ed8;
    --blue-700: #1e40af;
    --blue-50: #eff6ff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --green-500: #22c55e;
    --green-50: #f0fdf4;
    --red-500: #ef4444;
    --red-50: #fef2f2;
    --yellow-500: #eab308;
    --yellow-50: #fefce8;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- Navbar ---- */
.navbar {
    background: var(--gray-900);
    color: #fff;
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: #fff;
    text-decoration: none;
}

.navbar-brand span {
    color: var(--blue-500);
}

.navbar-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.navbar-links a {
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s;
}

.navbar-links a:hover,
.navbar-links a.active {
    color: #fff;
}

/* ---- Layout ---- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

/* ---- Cards ---- */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---- Forms ---- */
label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

select,
textarea,
input[type="text"] {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--gray-800);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

select:focus,
textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--blue-500);
    color: #fff;
}

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

.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-icon {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 0.375rem 0.5rem;
    cursor: pointer;
    color: var(--gray-500);
    transition: all 0.15s;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* ---- Output area ---- */
#output-area {
    min-height: 100px;
}

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

.output-meta {
    font-size: 0.8125rem;
    color: var(--gray-500);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.output-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.output-text {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 1rem;
    white-space: pre-wrap;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--gray-800);
}

/* ---- Status badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: var(--green-50);
    color: #16a34a;
}

.badge-error {
    background: var(--red-50);
    color: #dc2626;
}

.badge-pending {
    background: var(--yellow-50);
    color: #ca8a04;
}

/* ---- Comparison panel ---- */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

.comparison-panel {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.comparison-panel-header {
    background: var(--gray-100);
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-bottom: 1px solid var(--gray-200);
}

.comparison-panel-body {
    padding: 1rem;
    white-space: pre-wrap;
    font-size: 0.9375rem;
    line-height: 1.7;
    min-height: 120px;
    background: #fff;
}

/* ---- Workflow / Stepper ---- */
.workflow-toggle {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.workflow-toggle button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    background: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.15s;
}

.workflow-toggle button:first-child {
    border-radius: 6px 0 0 6px;
}

.workflow-toggle button:last-child {
    border-radius: 0 6px 6px 0;
}

.workflow-toggle button.active {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: #fff;
}

.stepper {
    position: relative;
    padding-left: 2rem;
}

.stepper::before {
    content: "";
    position: absolute;
    left: 0.75rem;
    top: 0.25rem;
    bottom: 0.25rem;
    width: 2px;
    background: var(--gray-200);
}

.step {
    position: relative;
    padding-bottom: 1.25rem;
}

.step:last-child {
    padding-bottom: 0;
}

.step-icon {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 1;
}

.step-icon.success {
    background: var(--green-500);
    color: #fff;
}

.step-icon.pending {
    background: var(--yellow-500);
    color: #fff;
}

.step-icon.error {
    background: var(--red-500);
    color: #fff;
}

.step-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.step-detail {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.125rem;
}

.step-technical {
    font-size: 0.75rem;
    color: var(--gray-400);
    font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    margin-top: 0.25rem;
    display: none;
}

.step-technical.visible {
    display: block;
}

/* ---- Scorecard ---- */
.scorecard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.star-rating {
    display: flex;
    gap: 0.25rem;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.star-rating input {
    display: none;
}

.star-rating label {
    cursor: pointer;
    font-size: 1.375rem;
    color: var(--gray-300);
    transition: color 0.15s;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
    color: var(--yellow-500);
}

.radio-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.radio-pill {
    display: inline-block;
}

.radio-pill input {
    display: none;
}

.radio-pill label {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.15s;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0;
}

.radio-pill input:checked + label {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: #fff;
}

/* ---- Alerts ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success {
    background: var(--green-50);
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ---- Loading indicator ---- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
}

.spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--blue-500);
    font-size: 0.875rem;
    font-weight: 500;
}

.spinner::before {
    content: "";
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--gray-200);
    border-top-color: var(--blue-500);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Scenario cards ---- */
.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.scenario-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: box-shadow 0.15s, border-color 0.15s;
    cursor: pointer;
}

.scenario-card:hover {
    border-color: var(--blue-500);
    box-shadow: var(--shadow-md);
}

.scenario-card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.375rem;
}

.scenario-card p {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.scenario-card .badge {
    font-size: 0.6875rem;
}

/* ---- Raw response toggle ---- */
.raw-toggle {
    margin-top: 1rem;
}

.raw-response {
    background: var(--gray-900);
    color: #e5e7eb;
    border-radius: 6px;
    padding: 1rem;
    font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.8125rem;
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 0.5rem;
    display: none;
}

.raw-response.visible {
    display: block;
}

/* ---- Utility ---- */
.text-muted {
    color: var(--gray-500);
}

.text-sm {
    font-size: 0.8125rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
