/**
 * API Code Showcase Block Styles
 */

.api-code-showcase-block {
    background-color: var(--bg-color, #000000);
    color: var(--text-color, #ffffff);
    border-radius: 0;
    margin: 12px;
    padding: 5px;
    overflow: hidden;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: none;
    position: relative;
}

/* Rainbow Gradient Border */
.api-code-showcase-block.has-rainbow-border {
    padding: 2px;
    background: linear-gradient(90deg, 
        #ff0080 0%, 
        #ff4d4d 12%, 
        #ff9500 25%, 
        #ffcc00 37%, 
        #00ff88 50%, 
        #00bfff 62%, 
        #8000ff 75%, 
        #ff0080 87%,
        #ff0080 100%
    );
}

.api-code-showcase-block.has-rainbow-border .api-code-tabs {
    background-color: #212121;
    overflow: hidden;
}

/* Header Section */
.api-code-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.api-code-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-color, #ffffff);
    line-height: 1.2;
}

.api-code-description {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-color, #ffffff);
    opacity: 0.7;
    line-height: 1.5;
}

/* Tabs Navigation */
.api-code-tabs-nav {
    display: flex;
    gap: 0;
    padding: 0 1.5rem;
    background-color: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.api-code-tabs-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* Rainbow border variant - darker bg */
.api-code-showcase-block.has-rainbow-border .api-code-tabs-nav {
    background-color: #212121;
}

.api-code-tab-button {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-color, #ffffff);
    opacity: 0.5;
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 400;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.api-code-tab-button:hover {
    opacity: 0.8;
}

.api-code-tab-button.active {
    opacity: 1;
    border-bottom-color: var(--accent-color, #ffffff);
}

/* Tabs Content */
.api-code-tabs-content {
    position: relative;
    min-height: 200px;
}

.api-code-tab-panel {
    display: none;
}

.api-code-tab-panel.active {
    display: block;
}

/* Code Wrapper */
.api-code-wrapper {
    position: relative;
    width: 100%;
}

/* Copy Button */
.api-code-copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

.api-code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.api-code-copy-btn.copied {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

.api-code-copy-btn svg {
    width: 14px;
    height: 14px;
}

/* Line Numbers */
.line-number {
    display: inline-block;
    min-width: 40px;
    width: 40px;
    color: rgba(255, 255, 255, 0.3) !important;
    text-align: right;
    padding-right: 24px;
    user-select: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    flex-shrink: 0;
}

/* Syntax Highlighting */
.api-code-line code .string {
    color: #FF009C;
}

.api-code-line code .keyword {
    color: #FF009C;
}

.api-code-line code .comment {
    color: #6B7280;
    font-style: italic;
}

/* Code Block */
.api-code-pre {
    margin: 0;
    padding: 1.5rem 1.5rem 1.5rem 1rem;
    background-color: #000000;
    overflow-x: hidden;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #FFFFFF;
}

/* Rainbow border variant - darker bg */
.api-code-showcase-block.has-rainbow-border .api-code-pre {
    background-color: #212121;
}

.api-code-line {
    display: flex;
    align-items: flex-start;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.api-code-line .line-number {
    flex-shrink: 0;
}

.api-code-line code {
    flex: 1;
    min-width: 0;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    background: transparent;
    padding: 0;
    margin: 0;
    border: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Responsive Design */
@media (max-width: 768px) {
    .api-code-tabs-nav {
        padding: 0 1rem;
    }
    
    .api-code-tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }
    
    .api-code-pre {
        padding: 1.5rem 1rem 1.5rem 0.5rem;
        font-size: 13px;
        overflow-x: hidden;
    }
    
    .line-number {
        min-width: 30px;
        width: 30px;
        padding-right: 12px;
    }
    
    .api-code-copy-btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.7rem;
    }
}

/* When used in Infrastructure Trust Section */
.infrastructure-trust__custom-block .api-code-showcase-block {
    margin: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

.infrastructure-trust__custom-block .api-code-showcase-block.has-rainbow-border {
    padding: 2px !important;
}
