/* ============================================================
   P2P TEST SITE - DESIGN SYSTEM (TEAL #0f766e / ONYX #07111f)
   Built with design-taste-frontend anti-slop guidelines
   Pure HTML5 + Vanilla CSS (Zero 3rd party UI dependencies)
   ============================================================ */

:root {
    /* Brand Colors */
    --primary: #0f766e;
    --primary-hover: #115e59;
    --primary-light: #5eead4;
    --primary-dim: rgba(15, 118, 110, 0.15);
    --primary-glow: rgba(20, 184, 166, 0.25);
    --primary-gradient: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    
    --accent: #14b8a6;
    --accent-dim: rgba(20, 184, 166, 0.15);

    /* Backgrounds & Surfaces */
    --bg: #07111f;
    --surface: #0f172a;
    --surface-elevated: #111b2f;
    --surface-card: rgba(15, 23, 42, 0.88);
    --surface-border: rgba(255, 255, 255, 0.08);
    --surface-border-hover: rgba(20, 184, 166, 0.4);

    /* Semantic Status */
    --success: #22c55e;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #38bdf8;

    /* Typography */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    background-image: radial-gradient(circle at 85% 10%, rgba(20, 184, 166, 0.08), transparent 40%),
                      radial-gradient(circle at 15% 90%, rgba(15, 118, 110, 0.06), transparent 40%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.test-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Top Header ────────────────────────────────────────────────────────── */
.test-header {
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--surface-border);
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    white-space: nowrap;
}

.brand-badge {
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 800;
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px var(--primary-glow);
    white-space: nowrap;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.header-settings {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
    white-space: nowrap;
}

.config-item {
    display: inline-flex;
    align-items: center;
    background: rgba(17, 27, 47, 0.75);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    padding: 4px 8px;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.config-item:hover, .config-item:focus-within {
    border-color: var(--surface-border-hover);
    background: rgba(17, 27, 47, 0.95);
}

.config-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.cfg-input {
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    outline: none;
}

/* ── Main Body Container ────────────────────────────────────────────────── */
.test-body {
    flex: 1;
    padding: 20px 24px;
    max-width: 1480px;
    margin: 0 auto;
    width: 100%;
}

.workspace-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Preset Scenarios Bar ───────────────────────────────────────────────── */
.preset-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--surface-border);
    border-radius: 10px;
    padding: 10px 16px;
}

.preset-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.preset-chip {
    background: rgba(17, 27, 47, 0.8);
    border: 1px solid var(--surface-border);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.preset-chip:hover {
    border-color: var(--accent);
    background: var(--primary-dim);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.preset-chip.active {
    border-color: var(--accent);
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* ── Custom Tabs Navigation ─────────────────────────────────────────────── */
.custom-tabs-header {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--surface-border);
    padding-bottom: 2px;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    padding: 10px 18px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    border-radius: 6px 6px 0 0;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--primary-light);
    border-bottom-color: var(--accent);
    background: rgba(20, 184, 166, 0.08);
}

.tab-body {
    margin-top: 12px;
}

/* ── Custom Cards ────────────────────────────────────────────────────────── */
.custom-card {
    background: var(--surface-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.card-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--surface-border);
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.2px;
}

.card-subtitle {
    margin: 4px 0 0 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ── Form Controls & Grid ───────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.form-control {
    background: rgba(7, 17, 31, 0.8);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--primary-glow);
    background: rgba(7, 17, 31, 0.98);
}

.form-control option {
    background: #0f172a;
    color: #fff;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 16px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: #e2e8f0;
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--primary-dim);
    color: #fff;
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-warning {
    background: #d97706;
    color: #fff;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ── Ranges Pill Selector ──────────────────────────────────────────────── */
.range-pill {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(20, 184, 166, 0.25);
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.range-pill:hover {
    border-color: var(--accent);
    background: var(--primary-dim);
    transform: translateY(-1px);
}

.range-pill.active {
    border-color: var(--accent);
    background: rgba(20, 184, 166, 0.18);
    box-shadow: 0 0 14px var(--primary-glow);
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.custom-table th {
    background: rgba(17, 27, 47, 0.9);
    padding: 10px 14px;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--surface-border);
    text-align: left;
    white-space: nowrap;
}

.custom-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #f1f5f9;
}

.custom-table tr:hover td {
    background: rgba(20, 184, 166, 0.05);
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.badge-primary { background: rgba(15, 118, 110, 0.25); color: #5eead4; border: 1px solid rgba(20, 184, 166, 0.3); }
.badge-success { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-danger  { background: rgba(248, 113, 113, 0.2); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.3); }
.badge-info    { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

/* ── Spinners ───────────────────────────────────────────────────────────── */
.spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

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

/* ── Cashier Generated URL Result Card ───────────────────────────────────── */
.url-result-box {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(20, 184, 166, 0.4);
    border-radius: 10px;
    padding: 16px;
    margin-top: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    animation: urlAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.url-pulse-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #4ade80;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.3px;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
    animation: pulseGlow 1.5s infinite;
}

.url-input-container {
    background: #040914;
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    animation: borderFlash 0.8s ease-out;
}

@keyframes urlAppear {
    0% { opacity: 0; transform: translateY(8px) scale(0.99); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes borderFlash {
    0% { border-color: #22d3ee; box-shadow: 0 0 16px rgba(34, 211, 238, 0.5); }
    100% { border-color: rgba(20, 184, 166, 0.3); box-shadow: none; }
}

/* ── Utility Classes ────────────────────────────────────────────────────── */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.justify-space-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mx-4 { margin-left: 16px; margin-right: 16px; }
.pa-3 { padding: 12px; }
