/* Light Theme (default) */
:root {
    /* Material Design 3 Color Tokens - Light */
    --md-sys-color-primary: #1a73e8;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #d3e3fd;
    --md-sys-color-on-primary-container: #041e49;
    --md-sys-color-surface: #FFFBFE;
    --md-sys-color-surface-container: #F3EDF7;
    --md-sys-color-surface-container-high: #ECE6F0;
    --md-sys-color-on-surface: #1C1B1F;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;
    --md-sys-elevation-1: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px 1px rgba(0,0,0,0.15);
    --md-sys-elevation-2: 0 1px 2px rgba(0,0,0,0.3), 0 2px 6px 2px rgba(0,0,0,0.15);
    --md-sys-elevation-3: 0 4px 8px 3px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.3);
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --sl-bg: #ffffff;
    --sl-color-text: #1C1B1F;
}

/* Dark Theme */
[data-theme="dark"] {
    --md-sys-color-primary: #64b5f6;
    --md-sys-color-on-primary: #003258;
    --md-sys-color-primary-container: #0d47a1;
    --md-sys-color-on-primary-container: #d3e3fd;
    --md-sys-color-surface: #141218;
    --md-sys-color-surface-container: #211F26;
    --md-sys-color-surface-container-high: #2B2930;
    --md-sys-color-on-surface: #E6E1E5;
    --md-sys-color-on-surface-variant: #CAC4D0;
    --md-sys-color-outline: #938F99;
    --md-sys-color-outline-variant: #49454F;
    --md-sys-elevation-1: 0 1px 2px rgba(0,0,0,0.5), 0 1px 3px 1px rgba(0,0,0,0.3);
    --md-sys-elevation-2: 0 1px 2px rgba(0,0,0,0.5), 0 2px 6px 2px rgba(0,0,0,0.3);
    --md-sys-elevation-3: 0 4px 8px 3px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.5);
    --sl-bg: #141218;
    --sl-color-text: #E6E1E5;
}

/* Dark theme token string fix */
[data-theme="dark"] .token.string {
    color: #A5D6A7 !important;
}

[data-theme="dark"] .token.property {
    color: #9ab3ff !important;
}

[data-theme="dark"] .token.number {
    color: #55a4ff !important;
}
[data-theme="dark"] .token.boolean {
    color: #55a4ff !important;
}

[data-theme="dark"] .token.punctuation {
    color: #fff !important;
}

[data-theme="dark"] .token.function {
    color: #b287ff !important;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

/* Custom Scrollbar - Light Theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--md-sys-color-surface-container);
}

::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline);
}

/* Custom Scrollbar - Dark Theme */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--md-sys-color-surface-container);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline);
}

/* Top App Bar */
.app-bar {
    background: #ffffff;
    padding: 10px 16px 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    position: relative;
    z-index: 100;
    max-height: 60px;
}

.app-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

/* Icon base styles */
.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.spacer {
    flex: 1;
}

/* Input Field - MD3 Outlined Text Field */
.input-group label {
    display: none;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
}

.text-input {
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-size: 14px;
    font-family: inherit;
    width: 280px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.text-input:hover {
    border-color: var(--md-sys-color-on-surface);
}

.text-input:focus {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

/* Input Hint */
.input-hint {
    position: absolute;
    bottom: -28px;
    left: 0;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    white-space: nowrap;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 200;
    box-shadow: var(--md-sys-elevation-2);
}

.input-hint.visible {
    opacity: 1;
    transform: translateY(0);
}

.input-group {
    display: flex;
    align-items: center;
    position: relative;
}

/* Filled Button - MD3 Style */
.btn-filled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 36px;
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-filled:hover {
    box-shadow: var(--md-sys-elevation-1);
    background: #1967d2;
}

.btn-filled:active {
    box-shadow: none;
}

/* Theme toggle icons */
.icon-dark,
.icon-light {
    display: none;
}

[data-theme="light"] .icon-dark {
    display: block;
}

[data-theme="dark"] .icon-light {
    display: block;
}

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Main Container */
.main-container {
    height: calc(100vh - 60px);
    overflow: auto;
    position: relative;
}

elements-api {
    height: 100%;
    display: block;
}

/* Override Stoplight Elements styles for MD3 */
.sl-elements {
    --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sl-flex.sl-items-center.sl-py-3{
    display: none;
}

/* Status indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-size: 11px;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1a73e8;
    animation: pulse 2s infinite;
}

.version-info {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 11px;
    font-weight: 500;
}

/* Version info icon */
.version-info .icon {
    width: 14px;
    height: 14px;
}

/* Theme Toggle Button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-icon:hover {
    background: var(--md-sys-color-surface-container-high);
}

.btn-icon .icon {
    width: 20px;
    height: 20px;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsive */
@media (max-width: 768px) {
    .app-bar {
        padding: 8px 12px;
        max-height: none;
        flex-wrap: wrap;
        gap: 8px;
    }

    .app-bar-title {
        font-size: 16px;
    }

    .spacer {
        display: none;
    }

    .text-input {
        width: 100%;
        max-width: 180px;
        font-size: 13px;
        padding: 8px 10px 8px 36px;
    }

    .input-icon {
        width: 16px;
        height: 16px;
        left: 10px;
    }

    .btn-filled {
        padding: 0 12px;
        height: 32px;
        font-size: 12px;
    }

    .btn-filled .icon {
        width: 14px;
        height: 14px;
    }

    .status-indicator,
    .version-info {
        font-size: 10px;
        padding: 3px 8px;
    }

    .main-container {
        height: calc(100vh - 100px);
    }

    /* Force stacked layout on mobile */
    elements-api {
        --sl-layout-sidebar-width: 0;
    }

    .sl-sidebar,
    .sl-components__sidebar,
    .sl-element__sidebar {
        display: none;
    }

    /* Mobile navigation enhancements */
    .sl-navbar {
        flex-wrap: wrap;
    }

    .sl-operation__path {
        font-size: 13px;
        word-break: break-all;
    }

    .sl-parameters,
    .sl-request-body,
    .sl-responses {
        padding: 12px;
    }

    .sl-panel {
        margin: 8px 0;
    }

    /* Code blocks on mobile */
    .sl-code-editor,
    pre {
        font-size: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tables on mobile */
    .sl-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sl-table th,
    .sl-table td {
        font-size: 12px;
        padding: 8px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .app-bar {
        padding: 6px 8px;
        gap: 6px;
    }

    .app-bar-title {
        font-size: 14px;
    }

    .app-bar-title .icon {
        width: 20px;
        height: 20px;
    }

    .text-input {
        max-width: 230px;
        font-size: 12px;
        padding: 6px 8px 6px 32px;
    }

    .btn-filled {
        padding: 0 10px;
        height: 28px;
        font-size: 11px;
        gap: 4px;
    }

    .btn-filled .icon {
        width: 12px;
        height: 12px;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    .btn-icon .icon {
        width: 18px;
        height: 18px;
    }

    .status-indicator {
        display: none;
    }

    .main-container {
        height: calc(100vh - 80px);
    }

    /* Even smaller code on tiny screens */
    .sl-code-editor,
    pre {
        font-size: 11px;
    }

    .sl-operation__path {
        font-size: 12px;
    }

    .sl-heading {
        font-size: 16px;
    }
}

/* API 列表 hover 效果 */
.api-group-header {
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 8px;
    border-top-left-radius: var(--md-sys-shape-corner-small);
    border-top-right-radius: var(--md-sys-shape-corner-small);
    display: flex;
    align-items: center;
    margin: 16px 0 8px;
    border-bottom: 1px solid #1a73e8;
}
.api-group-header:hover {
    background-color: rgba(193, 199, 194, 0.1);
}
.api-group-header:hover h3 {
    color: #1557b0;
}

.api-group-header h3 a {
    color: #333;
    pointer-events: none;
}
.api-group-header h3 a .sl-link-heading__icon{
    display: none;
}

.api-group-path{
    color: #666;
    font-size: 14px;
}

.api-item{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    background: #f5f5f5;
}

.api-item a {
    text-decoration: none;
    flex: 1;
}

.api-item a:hover {
    text-decoration: underline;
    color: #1a73e8;
}

.api-method-badge {
    display: inline-block;
    min-width: 60px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    text-align: center;
}


.api-summary {
    color: #666;
    font-size: 14px;
    margin-left: auto;
}

/* 暗色主题 */
[data-theme="dark"] .app-bar {
    background: var(--md-sys-color-surface-container);
}

[data-theme="dark"] .api-group-header:hover {
    background-color: rgba(191, 208, 197, 0.1);
}
[data-theme="dark"] .api-group-header:hover h3 {
    color: #64b5f6;
}
[data-theme="dark"] .api-group-header h3 a {
    color: #ccc;
}
[data-theme="dark"] .api-group-path{
    color: #999;
}
[data-theme="dark"] .api-group-header{
    border-bottom-color: #0d47a1;
}
[data-theme="dark"] .api-item{
    background: #333;
}
[data-theme="dark"] .api-path-link {
    color: #64b5f6;
}
[data-theme="dark"] .api-summary {
    color: #aaa;
}

[data-theme="dark"] .api-item a:hover {
    color: #64b5f6;
}

/* Deprecated API styles - Light Theme */
.api-item.deprecated {
    opacity: 0.6;
}
.api-item.deprecated .api-method-badge {
    background: #9e9e9e !important;
}
.api-item.deprecated a {
    color: #757575;
}
.api-item.deprecated .api-summary {
    color: #9e9e9e;
}
.api-item.deprecated::after {
    content: 'deprecated';
    font-size: 10px;
    color: #9e9e9e;
    padding: 1px 4px;
    border: 1px solid #9e9e9e;
    border-radius: 3px;
    margin-left: 4px;
}

/* Deprecated API styles - Dark Theme */
[data-theme="dark"] .api-item.deprecated {
    opacity: 0.5;
}
[data-theme="dark"] .api-item.deprecated .api-method-badge {
    background: #616161 !important;
}
[data-theme="dark"] .api-item.deprecated a {
    color: #9e9e9e;
}
[data-theme="dark"] .api-item.deprecated .api-summary {
    color: #757575;
}
[data-theme="dark"] .api-item.deprecated::after {
    color: #757575;
    border-color: #757575;
}

/* API item highlight effect */
.api-item.highlight {
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.2) 0%, rgba(26, 115, 232, 0.05) 100%);
    border-left: 3px solid #1a73e8;
    animation: highlight-pulse 2s ease-out;
}

@keyframes highlight-pulse {
    0% {
        background: linear-gradient(90deg, rgba(26, 115, 232, 0.4) 0%, rgba(26, 115, 232, 0.2) 100%);
    }
    100% {
        background: linear-gradient(90deg, rgba(26, 115, 232, 0.2) 0%, rgba(26, 115, 232, 0.05) 100%);
    }
}

/* Dark theme highlight */
[data-theme="dark"] .api-item.highlight {
    background: linear-gradient(90deg, rgba(100, 181, 246, 0.2) 0%, rgba(100, 181, 246, 0.05) 100%);
    border-left: 3px solid #64b5f6;
}

@keyframes highlight-pulse-dark {
    0% {
        background: linear-gradient(90deg, rgba(100, 181, 246, 0.4) 0%, rgba(100, 181, 246, 0.2) 100%);
    }
    100% {
        background: linear-gradient(90deg, rgba(100, 181, 246, 0.2) 0%, rgba(100, 181, 246, 0.05) 100%);
    }
}

[data-theme="dark"] .api-item.highlight {
    animation: highlight-pulse-dark 2s ease-out;
}

#docOl1 {
    margin: 0;
    padding-left: 10px;
    color: #333;
    font-size: 14px;
}

/* API 文档使用说明卡片 */
.doc-guide-card {
    margin-bottom: 30px;
    padding: 12px 16px;
    background: #f0f7ff;
    border: 1px solid #d0e3ff;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.8;
}

.doc-guide-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a73e8;
}
.doc-guide-title span{
    font-size: 18px;
    padding-right: 8px;
}

/* Dark theme for doc guide */
[data-theme="dark"] .doc-guide-card {
    background: rgba(26, 115, 232, 0.1);
    border-color: rgba(26, 115, 232, 0.3);
}

[data-theme="dark"] .doc-guide-title {
    color: #64b5f6;
}

[data-theme="dark"] #docOl1,[data-theme="dark"] .docOl1 {
    color: #ccc;
}

.doc-ol {
    margin: 0;
    padding-left: 20px;
    color: #333;
    font-size: 14px;
}

.doc-ol li {
    margin-bottom: 8px;
}

.doc-guide-card a:hover {
    text-decoration: underline;
    color:#fff !important;
}

.doc-code {
    background: #1C1B1F;
    padding: 2px 6px 3px;
    border-radius: 4px;
    font-size: 13px;
    color: #fff;
    font-family: 'Fira Code', 'Consolas', monospace;
}

.doc-code-block {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre;
    font-family: 'Fira Code', 'Consolas', monospace;
    color: #333;
}

.doc-subtitle {
    font-weight: 600;
    margin: 16px 0 8px;
    color: #1a73e8;
    font-size: 14px;
}

.doc-ul {
    margin: 0;
    padding-left: 20px;
    color: #333;
    font-size: 14px;
}

.doc-ul li {
    margin-bottom: 4px;
}

/* Dark theme for new styles */
[data-theme="dark"] .doc-ol,
[data-theme="dark"] .doc-ul {
    color: #ccc;
}

[data-theme="dark"] .doc-code {
    background: #333;
    color: #fff;
}

[data-theme="dark"] .doc-code-block {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

[data-theme="dark"] .doc-subtitle {
    color: #64b5f6;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--md-sys-elevation-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    box-shadow: var(--md-sys-elevation-3);
    transform: translateY(-2px);
}

.back-to-top:active {
    transform: translateY(0);
}

/* Dark theme for back to top */
[data-theme="dark"] .back-to-top {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .back-to-top:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}
