/* API & integration panel — scoped to #api, loaded on tool detail pages */

#api.tool-section-api {
    padding: 3rem 0;
    border-bottom: none;
}

#api .api-panel {
    position: relative;
    overflow: hidden;
    padding: 2rem 2rem 2.25rem;
    border-radius: 20px;
    border: 1px solid rgba(44, 57, 149, 0.18);
    background:
        linear-gradient(135deg, rgba(44, 57, 149, 0.09) 0%, rgba(255, 255, 255, 0.96) 38%, rgba(12, 164, 39, 0.05) 100%),
        linear-gradient(180deg, #f8faff 0%, #ffffff 100%);
    box-shadow:
        0 1px 2px rgba(44, 57, 149, 0.06),
        0 12px 40px rgba(44, 57, 149, 0.08);
}

#api .api-panel-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

#api .api-panel-decor-svg {
    position: absolute;
    top: -40px;
    right: -40px;
    width: min(420px, 55%);
    height: auto;
    opacity: 0.9;
}

#api .api-panel-header {
    position: relative;
    z-index: 1;
    margin-bottom: 1.75rem;
}

#api .api-panel-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 999px;
    background: rgba(44, 57, 149, 0.1);
    color: #2c3995;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#api .api-panel-badge svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

#api .api-panel-title {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    color: #404040;
    letter-spacing: -0.02em;
}

#api .api-access-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

#api .api-access-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
    margin: 0;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(44, 57, 149, 0.12);
    border-radius: 14px;
    backdrop-filter: blur(6px);
}

#api .api-access-card.is-featured {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(254, 243, 199, 0.35) 100%);
    border-color: rgba(217, 119, 6, 0.25);
}

#api .api-access-card-header {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

#api .api-access-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(44, 57, 149, 0.12), rgba(44, 57, 149, 0.06));
    color: #2c3995;
}

#api .api-access-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

#api .api-access-card.is-featured .api-access-icon {
    background: linear-gradient(145deg, rgba(217, 119, 6, 0.16), rgba(254, 243, 199, 0.5));
    color: #b45309;
}

#api .api-access-label {
    margin: 0 0 0.25rem;
    font-size: 1.0625rem;
    font-weight: 700;
    color: #404040;
}

#api .api-access-description {
    margin: 0;
    font-size: 0.8125rem;
    color: #7f8181;
    line-height: 1.5;
}

#api .api-access-value {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

#api .api-access-code {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: none;
    color: #e2e8f0;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    word-break: break-all;
    white-space: pre-wrap;
}

#api .api-copy-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: inherit;
    line-height: 1;
}

#api .api-copy-btn svg {
    width: 14px;
    height: 14px;
    display: block;
    flex-shrink: 0;
}

#api .api-copy-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.28);
}

#api .api-copy-btn.is-copied {
    background: rgba(12, 164, 39, 0.35);
    border-color: rgba(12, 164, 39, 0.5);
}

#api .api-access-actions {
    margin-top: auto;
}

#api .api-access-open {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.2;
    text-decoration: none;
    font-family: inherit;
    box-sizing: border-box;
    cursor: pointer;
}

#api .api-access-open svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}

#api .api-access-open.is-primary {
    background: #2c3995;
    color: #fff;
    border: 1px solid #2c3995;
}

#api .api-access-open.is-primary:hover {
    background: #1e2a6b;
    border-color: #1e2a6b;
    color: #fff;
}

#api .api-access-open.is-secondary {
    background: #fff;
    color: #2c3995;
    border: 1px solid rgba(44, 57, 149, 0.35);
}

#api .api-access-open.is-secondary:hover {
    background: #f8faff;
    color: #1e2a6b;
    border-color: #2c3995;
}

@media (max-width: 768px) {
    #api .api-panel {
        padding: 1.5rem 1.25rem 1.75rem;
        border-radius: 16px;
    }

    #api .api-access-grid {
        grid-template-columns: 1fr;
    }

    #api .api-access-card.is-featured {
        grid-column: auto;
    }

    #api .api-access-value {
        flex-direction: column;
        align-items: stretch;
    }

    #api .api-copy-btn {
        width: 100%;
    }

    #api .api-panel-decor-svg {
        width: 70%;
        top: -20px;
        right: -20px;
    }
}
