/* ==========================================
   API Playground Styles - Professional Layout
   ========================================== */

:root {
    --sidebar-width: 320px;
    --sidebar-bg: #ffffff;
    --main-bg: #f8fafc;
    --border-color: #e2e8f0;
    --header-height: 70px;
}

body {
    background-color: var(--main-bg);
    overflow: hidden; /* Prevent page scroll */
}

.playground-layout {
    display: flex;
    height: calc(100vh - 80px); /* Fill remaining height */
    margin-top: 80px;
    position: relative;
    overflow: hidden;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Sidebar --- */
.playground-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    z-index: 10;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.sidebar-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.sidebar-content {
    padding: 20px;
    flex: 1;
}

.config-section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.section-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-textarea {
    font-family: var(--font-mono);
    resize: vertical;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.required {
    color: #ef4444;
}

.parameters-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-actions {
    padding: 24px;
    background: #fff;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
}

.btn-send {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-send:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

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

/* --- Main Content --- */
.playground-main {
    flex: 1;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    max-width: calc(1200px - var(--sidebar-width));
}

.response-panel-wrapper {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    min-height: 400px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.panel-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fcfcfd;
    border-radius: 12px 12px 0 0;
}

.panel-title-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.status-indicator-compact {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #ecfdf5;
    color: #059669;
}

.status-badge.error {
    background: #fef2f2;
    color: #dc2626;
}

.time-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.response-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.response-container {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.request-summary {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.method-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.7rem;
}

.method-badge.GET { background: #dcfce7; color: #166534; }
.method-badge.POST { background: #e0e7ff; color: #3730a3; }

.placeholder-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-illustration {
    margin-bottom: 20px;
    color: var(--border-color);
}

.placeholder-content h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.placeholder-content p {
    font-size: 0.9rem;
    max-width: 320px;
    margin: 0;
}

.json-display {
    background: #1e293b;
    color: #f1f5f9;
    padding: 24px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    overflow: auto;
    max-height: 600px;
    margin: 0;
}

.error-container {
    background: #fff1f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.error-icon { color: #e11d48; margin-top: 2px; }
.error-content h4 { color: #9f1239; margin: 0 0 4px 0; }
.error-content p { color: #be123c; margin: 0; font-size: 0.9rem; }

/* --- cURL Panel --- */
.curl-panel {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.curl-display {
    padding: 20px 24px;
}

.curl-display pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

/* --- Examples & Tags --- */
.example-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-btn {
    padding: 6px 12px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.tag-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* --- Toasts --- */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: #334155;
    color: #fff;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show { transform: translateX(0); }
.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }

/* --- Loader --- */
.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Footer --- */
.playground-footer {
    padding: 40px 0;
    background: #0f172a;
    color: #94a3b8;
    text-align: center;
    font-size: 0.85rem;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .playground-layout {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    .playground-main {
        max-width: 100%;
    }
}

@media (max-width: 1024px) {
    .playground-layout { 
        flex-direction: column; 
        max-width: 100%;
    }
    .playground-sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .playground-main { 
        padding: 20px; 
        max-width: 100%;
    }
}
