/* ==========================================
   JCFlow — Interactive Developer Playground & Sandbox 1-Clic
   playground/dom/index.css
   ========================================== */

.playground-section {
    padding: clamp(3rem, 6vw, 6rem) 0;
    background: var(--bg-secondary, #f9fafb);
    position: relative;
    border-top: 1px solid var(--border, #e5e7eb);
    border-bottom: 1px solid var(--border, #e5e7eb);
}

[data-theme="dark"] .playground-section {
    background: #0d1117;
    border-color: rgba(255, 255, 255, 0.08);
}

.playground-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.playground-header-block {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 2.5rem;
}

.playground-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent, #4f46e5);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

[data-theme="dark"] .playground-badge {
    background: rgba(99, 102, 241, 0.18);
    color: #a5b4fc;
}

.playground-title {
    font-size: clamp(1.8rem, 3.5vw, 2.7rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary, #111827);
}

.playground-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary, #4b5563);
    line-height: 1.6;
    margin-bottom: 1.8rem;
}

.playground-top-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Card Shell */
.playground-card {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Endpoint Selection Bar */
.playground-endpoints-bar {
    display: flex;
    overflow-x: auto;
    background: #181825;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 12px 0;
    gap: 8px;
    scrollbar-width: none;
}

.playground-endpoints-bar::-webkit-scrollbar {
    display: none;
}

.pg-tab-btn {
    background: transparent;
    border: none;
    outline: none;
    color: #a6adc8;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pg-tab-btn:hover {
    color: #f5e0dc;
    background: rgba(255, 255, 255, 0.04);
}

.pg-tab-btn.active {
    color: #89b4fa;
    background: #1e1e2e;
    border-bottom-color: #89b4fa;
}

.pg-tab-badge {
    background: rgba(16, 185, 129, 0.2);
    color: #a6e3a1;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* URL and Auth bar */
.playground-url-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #11111b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-family: monospace;
    font-size: 0.85rem;
    gap: 12px;
    flex-wrap: wrap;
}

.pg-method-badge {
    background: #a6e3a1;
    color: #11111b;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.pg-endpoint-url {
    color: #f9e2af;
    word-break: break-all;
    font-weight: 500;
}

.pg-url-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.pg-header-auth {
    color: #6c7086;
    font-size: 0.78rem;
}

.pg-header-auth span {
    color: #fab387;
}

.pg-btn-sm {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cdd6f4;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.pg-btn-sm:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* IDE Split Grid */
.playground-ide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 480px;
}

@media (max-width: 900px) {
    .playground-ide-grid {
        grid-template-columns: 1fr;
    }
}

.playground-pane {
    display: flex;
    flex-direction: column;
    position: relative;
}

.playground-pane--request {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
    .playground-pane--request {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
}

.playground-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #181825;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.82rem;
    font-weight: 600;
}

.pg-pane-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #bac2de;
}

.pg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pg-dot--blue { background: #89b4fa; }
.pg-dot--green { background: #a6e3a1; }

.pg-btn-copy {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cdd6f4;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.pg-btn-copy:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* Editor Wrapper */
.playground-editor-wrapper {
    flex: 1;
    position: relative;
    background: #1e1e2e;
}

.pg-textarea {
    width: 100%;
    height: 100%;
    min-height: 380px;
    background: transparent;
    border: none;
    outline: none;
    color: #f5c2e7;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.86rem;
    line-height: 1.55;
    padding: 16px;
    resize: none;
    box-sizing: border-box;
    white-space: pre;
    tab-size: 2;
}

/* Panes Footer */
.playground-pane-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #181825;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
    flex-wrap: wrap;
    gap: 10px;
}

.pg-tip {
    color: #6c7086;
    font-size: 0.78rem;
}

.pg-btn-simulate {
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    color: #ffffff;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pg-btn-simulate:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.6);
}

.pg-btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: pgSpin 0.7s linear infinite;
}

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

/* Response status header */
.pg-response-status-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pg-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 800;
    font-family: monospace;
}

.pg-status--success {
    background: rgba(16, 185, 129, 0.2);
    color: #a6e3a1;
}

.pg-latency-badge {
    background: rgba(245, 194, 231, 0.15);
    color: #f5c2e7;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: monospace;
}

/* Response output */
.playground-response-wrapper {
    flex: 1;
    background: #181825;
    padding: 16px;
    overflow-y: auto;
    max-height: 380px;
}

.pg-response-pre {
    margin: 0;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.84rem;
    line-height: 1.55;
    color: #cdd6f4;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Simulation Stepper */
.pg-sim-stepper {
    background: #11111b;
    padding: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pg-step-item {
    font-size: 0.82rem;
    color: #a6adc8;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pg-step-item.active {
    color: #89b4fa;
    font-weight: 600;
}

.pg-step-item.done {
    color: #a6e3a1;
}

/* Response Actions Footer */
.pg-meta-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
}

.pg-meta-label {
    color: #6c7086;
}

.pg-cufe-code {
    background: #11111b;
    color: #89b4fa;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.78rem;
}

.pg-meta-links {
    display: flex;
    gap: 12px;
}

.pg-action-link {
    color: #89dceb;
    text-decoration: none;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s ease;
}

.pg-action-link:hover {
    color: #b4befe;
    text-decoration: underline;
}

/* ════════ SANDBOX 1-CLIC MODAL ════════ */
.sandbox-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: sbFadeIn 0.2s ease-out;
}

@keyframes sbFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sandbox-modal {
    background: var(--bg-card, #ffffff);
    color: var(--text-primary, #111827);
    border-radius: 24px;
    max-width: 580px;
    width: 100%;
    padding: 2.2rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border, #e5e7eb);
    animation: sbScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .sandbox-modal {
    background: #181825;
    border-color: rgba(255, 255, 255, 0.1);
    color: #cdd6f4;
}

@keyframes sbScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.sandbox-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: transparent;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    color: var(--text-tertiary, #9ca3af);
    cursor: pointer;
}

.sandbox-modal-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.sandbox-modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.sandbox-modal-desc {
    font-size: 0.95rem;
    color: var(--text-secondary, #4b5563);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

[data-theme="dark"] .sandbox-modal-desc {
    color: #a6adc8;
}

/* Key Box */
.sandbox-key-box {
    background: var(--bg-tertiary, #f3f4f6);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border, #e5e7eb);
}

[data-theme="dark"] .sandbox-key-box {
    background: #11111b;
    border-color: rgba(255, 255, 255, 0.08);
}

.sandbox-key-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent, #4f46e5);
    margin-bottom: 6px;
    font-family: monospace;
}

.sandbox-key-input-wrap {
    display: flex;
    gap: 8px;
}

.sandbox-key-input {
    flex: 1;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border, #d1d5db);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 700;
    color: #10b981;
}

[data-theme="dark"] .sandbox-key-input {
    background: #1e1e2e;
    border-color: rgba(255, 255, 255, 0.12);
    color: #a6e3a1;
}

.sandbox-copy-toast {
    margin-top: 8px;
    font-size: 0.82rem;
    color: #10b981;
    font-weight: 600;
}

/* Snippet Box */
.sandbox-snippet-box {
    background: #11111b;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sandbox-snippet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #181825;
    font-size: 0.78rem;
    color: #bac2de;
}

.sandbox-snippet-code {
    margin: 0;
    padding: 12px;
    font-family: monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #cdd6f4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.sandbox-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.sandbox-wa-link {
    font-size: 0.85rem;
    color: var(--text-secondary, #4b5563);
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: color 0.15s ease;
}

[data-theme="dark"] .sandbox-wa-link {
    color: #a6adc8;
}

.sandbox-wa-link:hover {
    color: #25d366;
    text-decoration: underline;
}

/* Progress Track & Fill */
.pg-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    position: relative;
}

.pg-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #10b981, #06b6d4);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    transition: width 0.12s ease-in-out;
}

/* Quick Action Highlight Button */
.pg-btn-highlight {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.35) !important;
    font-weight: 600;
}

.pg-btn-highlight:hover {
    background: rgba(16, 185, 129, 0.28) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.6) !important;
}

/* Copy Mini Button */
.pg-btn-copy-mini {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #a6adc8;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    margin-left: 4px;
}

.pg-btn-copy-mini:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* QR Preview Pill */
.pg-qr-preview-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.28);
    color: #a6e3a1;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pg-qr-preview-pill:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: #10b981;
    transform: translateY(-1px);
}

.pg-qr-icon {
    display: block;
    color: #10b981;
}
