/* Global Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f6f7;
}

/* Main Container */
.pg-container {
    display: flex;
    height: calc(100vh - 140px); /* Adjusted to fit viewport (90px top + 40px bottom + 10px buffer) */
    overflow: hidden;
    margin-top: 60px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-radius: 12px;
    /* Updated Layout for Wider View */
    max-width: 1600px;
    margin: 90px auto 40px;
    border: 1px solid #ebedf0;
}

/* Left Sidebar */
.pg-sidebar {
    width: 260px;
    background: #f7f8fa;
    border-right: 1px solid #ebedf0;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    padding-bottom: 60px; /* Ensure last item is fully visible */
    height: 100%;
    overflow-y: auto;
}

/* Custom Scrollbar for Sidebar */
.pg-sidebar::-webkit-scrollbar {
    width: 6px;
}
.pg-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.pg-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}
.pg-sidebar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

.pg-menu-item {
    padding: 12px 20px;
    cursor: pointer;
    color: #646a73;
    font-size: 14px;
    margin: 4px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}
.pg-menu-item:hover {
    background: #eef0f5;
    color: #1f2329;
}
.pg-menu-item.active {
    background: #e1ebff;
    color: #3370ff;
    font-weight: 500;
}

/* Middle Content (Docs & Form) */
.pg-main {
    flex: 4;
    padding: 40px;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid #ebedf0;
}

/* Right Panel (Preview & Result) */
.pg-right-panel {
    flex: 6;
    display: flex;
    flex-direction: column;
    background: #f7f8fa;
    padding: 30px;
    overflow-y: auto;
    border-left: 1px solid #ebedf0;
}

/* Header Styling */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #ebedf0;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2329;
    margin: 0;
}

h2 {
    font-size: 18px;
    margin: 32px 0 16px 0;
    color: #1f2329;
    font-weight: 600;
}

/* Doc Link */
.doc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: #f2f3f5;
    color: #4e5969;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.doc-link:hover {
    background-color: #e5e6eb;
    color: #1f2329;
}

.doc-link i {
    font-size: 12px;
    color: #86909c;
}

.doc-link:hover i {
    color: #4e5969;
}

/* API URL Styling */
.api-url-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-family: 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    color: #646a73;
}

.badge-method {
    background: #e8ffea;
    color: #00b42a;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.api-path {
    color: #646a73;
    word-break: break-all;
}

.desc-text {
    color: #4e5969;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 32px;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}
.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #1f2329;
    font-weight: 500;
}
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s;
    line-height: 1.5;
    background: #fff;
}
.form-input:hover {
    border-color: #c0c4cc;
}
.form-input:focus {
    border-color: #3370ff;
    box-shadow: 0 0 0 2px rgba(51, 112, 255, 0.1);
    outline: none;
}
.form-helper {
    font-size: 13px;
    color: #86909c;
    margin-top: 6px;
    line-height: 1.5;
}

.switch-container {
    display: flex;
    align-items: center;
    margin-top: 8px;
}
.switch-label {
    font-size: 14px;
    margin-right: 12px;
    color: #1f2329;
}

/* Buttons */
.btn-primary {
    background: #3370ff;
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(51, 112, 255, 0.25);
}
.btn-primary:hover {
    background: #295acb;
    box-shadow: 0 4px 12px rgba(51, 112, 255, 0.35);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-primary:disabled {
    background: #a0cfff;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f0f2f5;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 16px;
    gap: 4px;
}

.tab-item {
    flex: 1;
    text-align: center;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #606266;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab-item:hover {
    background: rgba(255,255,255,0.6);
    color: #303133;
}

.tab-item.active {
    background: #ffffff;
    color: #165dff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    font-weight: 600;
}

/* Code Block Container */
.code-block-wrapper {
    background: #282c34;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    border: 1px solid #1e2227;
}

.code-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #21252b;
    border-bottom: 1px solid #181a1f;
    color: #abb2bf;
    font-size: 13px;
    font-weight: 600;
}

.code-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-btn {
    background: transparent;
    border: none;
    color: #abb2bf;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
}

.action-btn:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
}

.code-content {
    padding: 20px;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    color: #abb2bf;
    font-family: 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Result Section */
.result-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #282c34;
    border: 1px solid #1e2227;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #21252b;
    border-bottom: 1px solid #181a1f;
}

.result-title {
    font-weight: 600;
    color: #abb2bf;
    font-size: 14px;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-content {
    padding: 20px;
    overflow: auto;
    font-family: 'Menlo', 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #abb2bf;
    background: #282c34;
    flex: 1;
}

/* Status Badge */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.success { background: rgba(152, 195, 121, 0.15); color: #98c379; border: 1px solid rgba(152, 195, 121, 0.2); }
.status-badge.error { background: rgba(224, 108, 117, 0.15); color: #e06c75; border: 1px solid rgba(224, 108, 117, 0.2); }

/* Cost Badge Styling */
.cost-badge {
    display: inline-block;
    margin-top: 0;
    padding: 4px 10px;
    background: rgba(230, 162, 60, 0.2);
    color: #e6a23c;
    border: 1px solid rgba(230, 162, 60, 0.3);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: none;
}

/* Copy Button in Result Header */
.btn-icon-light {
    color: #abb2bf;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 14px;
}
.btn-icon-light:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
}

/* JSON Syntax Highlighting - Atom One Dark */
.string { color: #98c379; }  /* Green */
.number { color: #d19a66; }  /* Orange */
.boolean { color: #56b6c2; } /* Cyan */
.null { color: #c678dd; }    /* Purple */
.key { color: #e06c75; font-weight: normal; } /* Red */

/* Scrollbar Styling */
.code-content::-webkit-scrollbar,
.result-content::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.code-content::-webkit-scrollbar-thumb,
.result-content::-webkit-scrollbar-thumb {
    background: #4b5263;
    border-radius: 5px;
    border: 2px solid #282c34;
}
.code-content::-webkit-scrollbar-track,
.result-content::-webkit-scrollbar-track {
    background: transparent;
}
.code-content::-webkit-scrollbar-corner,
.result-content::-webkit-scrollbar-corner {
    background: transparent;
}
