/* Connect page styles — uses CSS variables from /style.css for theming */

.connect-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 24px 40px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
}

/* Breadcrumb */
.connect-breadcrumb {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.connect-breadcrumb a {
    color: var(--link-color);
    text-decoration: none;
}

.connect-breadcrumb a:hover {
    text-decoration: underline;
}

/* Header */
.connect-header {
    text-align: center;
    margin-bottom: 8px;
}

.connect-header img {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.connect-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.connect-intro {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    margin: 4px 0 6px;
    line-height: 1.5;
}

.connect-page .trust-line {
    margin-top: 4px;
    margin-bottom: 24px;
}

/* AI Setup CTA */
.ai-setup-cta {
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 32px;
    text-align: center;
}

.ai-setup-cta-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.ai-setup-cta-title svg {
    flex-shrink: 0;
}

.ai-setup-cta-prompt {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-light, #eee);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    word-break: break-word;
}

.ai-setup-cta-beta-note {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 10px;
    text-align: center;
}

.ai-setup-cta-beta-note a {
    color: var(--link-color);
    text-decoration: none;
}

.ai-setup-cta-beta-note a:hover {
    text-decoration: underline;
}

.ai-setup-cta .copy-prompt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: 50px;
    background: var(--accent-primary, #007bff);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-setup-cta .copy-prompt-btn:hover {
    background: var(--accent-primary-hover, #0056b3);
}

.ai-setup-cta .copy-prompt-btn.copied {
    background: #4caf50;
}

/* Select prompt */
.select-prompt {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
    padding-top: 28px;
    border-top: 1px solid var(--border-light, #eee);
}

/* Category Buttons (Level 1) */
.category-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px 30px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 14px;
    background: var(--bg-primary, #fff);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    font-family: inherit;
    outline: none;
}

.category-btn:hover {
    border-color: var(--accent-primary, #007bff);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.08);
}

.category-btn:focus-visible {
    border-color: var(--accent-primary, #007bff);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.category-btn.active {
    border-color: var(--accent-primary, #007bff);
    background: var(--bg-highlight, rgba(0, 123, 255, 0.04));
}

.category-icon {
    width: 36px;
    height: 36px;
    color: var(--accent-primary, #007bff);
}

.category-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.category-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -4px;
}

.category-favicons {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

.category-favicons img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    opacity: 0.5;
    filter: grayscale(40%);
    transition: opacity 0.2s, filter 0.2s;
}

.category-btn:hover .category-favicons img,
.category-btn.active .category-favicons img {
    opacity: 1;
    filter: none;
}

/* Tool Grid (Level 2) */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
    animation: fadeIn 0.25s ease;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    background: var(--bg-primary, #fff);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-family: inherit;
    outline: none;
}

.tool-btn:hover {
    border-color: var(--accent-primary, #007bff);
}

.tool-btn:focus-visible {
    border-color: var(--accent-primary, #007bff);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.tool-btn.active {
    border-color: var(--accent-primary, #007bff);
    background: var(--bg-highlight, rgba(0, 123, 255, 0.04));
}

.tool-btn img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.tool-btn .tool-btn-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.3;
}

/* Favicon fallback circle */
.favicon-fallback {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent-primary, #007bff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.favicon-fallback-sm {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 10px;
}

/* Tool Content (Level 3) */
.tool-content {
    animation: fadeIn 0.25s ease;
    margin-bottom: 32px;
}

.tool-content-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.tool-content-header img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.tool-content-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.tool-content-header .docs-link {
    margin-left: auto;
    font-size: 13px;
    color: var(--link-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tool-content-header .docs-link:hover {
    text-decoration: underline;
}

.tool-instructions {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.tool-instructions ol {
    padding-left: 20px;
    margin: 8px 0;
}

.tool-instructions li {
    margin-bottom: 6px;
}

.tool-instructions code {
    background: var(--bg-secondary, #f8f9fa);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
    font-size: 13px;
}

.tool-file-path {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.tool-file-path code {
    background: var(--bg-secondary, #f8f9fa);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
}

.tool-fallback {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-color, #ddd);
    font-size: 13px;
    color: var(--text-muted);
}

.tool-notes {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary, #007bff);
}

/* Code Snippet Block */
.snippet-block {
    position: relative;
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-light, #eee);
    border-radius: 10px;
    overflow: hidden;
}

.snippet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light, #eee);
    background: var(--bg-tertiary, rgba(0,0,0,0.02));
}

.snippet-lang {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.snippet-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.snippet-copy-btn:hover {
    background: var(--bg-primary, #fff);
    color: var(--text-primary);
}

.snippet-copy-btn.copied {
    color: #4caf50;
}

.snippet-code {
    padding: 14px 16px;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre;
    margin: 0;
}

/* Try-it Widget (Developers section) */
.try-it-widget {
    margin-bottom: 24px;
}

.try-it-widget h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text-primary);
}

.try-it-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.try-it-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary, #fff);
    outline: none;
    transition: border-color 0.2s;
}

.try-it-input:focus {
    border-color: var(--accent-primary, #007bff);
}

.try-it-input::placeholder {
    color: var(--text-muted);
}

.try-it-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--accent-primary, #007bff);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.try-it-btn:hover {
    background: var(--accent-primary-hover, #0056b3);
}

.try-it-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.try-it-response {
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-light, #eee);
    border-radius: 10px;
    padding: 14px 16px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    display: none;
}

.try-it-response.visible {
    display: block;
}

.try-it-error {
    color: #dc3545;
}

.try-it-loading {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-muted);
}

.try-it-loading.visible {
    display: flex;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-top-color: var(--accent-primary, #007bff);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Code Tabs (for Developers section) */
.code-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    margin-bottom: 0;
}

.code-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
    margin-bottom: -1px;
}

.code-tab:hover {
    color: var(--text-primary);
}

.code-tab.active {
    color: var(--accent-primary, #007bff);
    border-bottom-color: var(--accent-primary, #007bff);
}

.code-panel {
    display: none;
}

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

/* API Reference (embedded) */
.api-reference {
    margin-top: 24px;
}

.api-reference h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--text-primary);
}

.api-ref-endpoint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.api-ref-method {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'SF Mono', Menlo, monospace;
    background: #e8f5e9;
    color: #2e7d32;
}

.api-ref-url {
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 13px;
    color: var(--text-primary);
}

.api-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 16px;
}

.api-ref-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-light, #eee);
    font-weight: 600;
    color: var(--text-primary);
}

.api-ref-table td {
    padding: 8px 12px;
    border: 1px solid var(--border-light, #eee);
    color: var(--text-secondary);
}

.api-ref-table code {
    background: var(--bg-secondary, #f8f9fa);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 12px;
}

/* Troubleshooting & FAQ Sections */
.connect-section {
    margin-top: 36px;
}

.connect-section h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 14px;
    color: var(--text-primary);
}

.connect-section details {
    border: 1px solid var(--border-light, #eee);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.connect-section details + details {
    margin-top: 0;
}

.connect-section summary {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connect-section summary::-webkit-details-marker {
    display: none;
}

.connect-section summary::before {
    content: '';
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.connect-section details[open] > summary::before {
    transform: rotate(45deg);
}

.connect-section summary:hover {
    background: var(--bg-secondary, #f8f9fa);
}

.connect-section .detail-answer {
    padding: 0 16px 14px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.connect-section .detail-answer code {
    background: var(--bg-secondary, #f8f9fa);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Menlo, monospace;
    font-size: 13px;
}

.connect-section .detail-answer a {
    color: var(--link-color);
    text-decoration: none;
}

.connect-section .detail-answer a:hover {
    text-decoration: underline;
}

/* Help Section (collapsed Troubleshooting & FAQ) */
.help-section {
    margin-top: 40px;
    border: none;
}

.help-section-toggle {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.help-section-toggle::-webkit-details-marker {
    display: none;
}

.help-section-toggle::before {
    content: '';
    width: 5px;
    height: 5px;
    border-right: 1.5px solid var(--text-muted);
    border-bottom: 1.5px solid var(--text-muted);
    transform: rotate(-45deg);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.help-section[open] > .help-section-toggle::before {
    transform: rotate(45deg);
}

.help-section-toggle:hover {
    color: var(--text-secondary);
}

.help-section-body {
    padding-top: 8px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.help-section-body.visible {
    opacity: 1;
    transform: translateY(0);
}

.help-section-body .connect-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 10px;
}

.connect-kofi {
    margin-top: 12px;
    transform: scale(0.8);
    transform-origin: center center;
}

/* Footer */
.connect-footer {
    text-align: center;
    padding: 24px 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-light, #eee);
    margin-top: 40px;
}

.connect-footer a {
    color: var(--link-color);
    text-decoration: none;
}

.connect-footer a:hover {
    text-decoration: underline;
}

.connect-footer .feedback-link {
    background: none;
    border: none;
    color: var(--link-color);
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    font-family: inherit;
}

.connect-footer .feedback-link:hover {
    text-decoration: underline;
}

/* Theme toggle (fixed top-right) */
.about-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hidden utility */
[hidden] {
    display: none !important;
}

/* Mobile responsive */
@media (max-width: 700px) {
    .connect-page {
        padding: 16px 16px 32px;
    }

    .connect-header h1 {
        font-size: 22px;
    }

    .category-buttons {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .category-btn {
        padding: 18px 14px 14px;
    }

    .tool-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .tool-btn {
        padding: 10px 6px;
    }

    .tool-btn .tool-btn-name {
        font-size: 11px;
    }

    .snippet-code {
        font-size: 12px;
        padding: 12px;
    }

    .try-it-input-row {
        flex-direction: column;
    }

    .tool-content-header {
        flex-wrap: wrap;
    }

    .tool-content-header .docs-link {
        margin-left: 0;
        margin-top: 4px;
    }

    .ai-setup-cta {
        padding: 16px;
    }

    .ai-setup-cta-prompt {
        font-size: 12px;
    }

    .api-ref-table {
        font-size: 12px;
    }

}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
