/* GitHub App Setup pages */

.setup-hero {
    display: block;
    min-height: auto;
    background: var(--gradient-hero);
    padding: 80px 40px 60px;
    text-align: center;
}

.setup-hero h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
    color: var(--text-primary);
}

.setup-hero .subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Setup section */
.setup-section {
    padding: 60px 40px 100px;
    max-width: 760px;
    margin: 0 auto;
}

/* Card container */
.setup-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-section-dark) 100%);
    border: 1px solid var(--glow-cyan-20);
    border-radius: 16px;
    padding: 40px;
}

.setup-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

/* Form fields */
.setup-field {
    margin-bottom: 24px;
}

.setup-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.setup-field input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--glow-cyan-20);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.setup-field input:focus {
    outline: none;
    border-color: var(--el-cyan);
}

.setup-field input::placeholder {
    color: var(--text-placeholder);
}

.setup-field .field-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Submit button */
.setup-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--gradient-cta);
    color: var(--bg-main);
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition:
        opacity 0.2s,
        transform 0.2s;
    font-family: inherit;
}

.setup-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.setup-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.setup-btn svg {
    width: 20px;
    height: 20px;
}

/* Steps list on start page */
.setup-steps {
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--glow-cyan-10);
}

.setup-steps h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.setup-steps ol {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: steps;
}

.setup-steps li {
    counter-increment: steps;
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.setup-steps li::before {
    content: counter(steps);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: var(--glow-cyan-20);
    color: var(--el-cyan);
    font-size: 13px;
    font-weight: 700;
    border-radius: 50%;
}

/* --- Callback page --- */

/* Loading state */
.setup-loading {
    text-align: center;
    padding: 60px 20px;
}

.setup-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glow-cyan-20);
    border-top-color: var(--el-cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.setup-loading p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Error state */
.setup-error {
    background: var(--before-bg);
    border: 1px solid var(--border-error);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.setup-error h2 {
    font-size: 20px;
    color: var(--error);
    margin-bottom: 8px;
}

.setup-error p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 16px;
}

.setup-error a {
    color: var(--el-cyan);
    text-decoration: underline;
}

/* Success / results */
.setup-results {
    display: none;
}

.setup-results.visible {
    display: block;
}

.setup-results h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 8px;
}

.setup-results .results-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Credential rows */
.credential-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.credential-item {
    background: var(--bg-main);
    border: 1px solid var(--glow-cyan-10);
    border-radius: 10px;
    padding: 16px 20px;
}

.credential-item .cred-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.credential-item .cred-value {
    font-size: 15px;
    color: var(--text-primary);
    font-family: 'Roboto Mono', monospace;
    word-break: break-all;
}

.credential-item .cred-value.masked {
    filter: blur(4px);
    user-select: none;
    transition: filter 0.2s;
    cursor: pointer;
}

.credential-item .cred-value.masked:hover,
.credential-item .cred-value.masked:focus,
.credential-item .cred-value.masked:focus-visible {
    filter: none;
    user-select: auto;
    outline: 2px solid var(--el-cyan);
    outline-offset: 2px;
}

/* Copyable fields */
.cred-copy-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cred-copy-row .cred-value {
    flex: 1;
    min-width: 0;
}

.copy-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    background: var(--glow-cyan-10);
    border: 1px solid var(--glow-cyan-20);
    border-radius: 6px;
    color: var(--el-cyan);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.copy-btn:hover {
    background: var(--glow-cyan-20);
}

/* PEM section */
.pem-section {
    margin-bottom: 32px;
}

.pem-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.pem-section .pem-warning {
    font-size: 13px;
    color: var(--warning);
    margin-bottom: 12px;
}

.pem-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--glow-cyan-10);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Roboto Mono', monospace;
    resize: vertical;
    box-sizing: border-box;
}

.pem-textarea:focus {
    outline: none;
    border-color: var(--el-cyan);
}

/* Next steps / install section */
.next-steps {
    background: var(--after-bg);
    border: 1px solid var(--border-success);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 32px;
}

.next-steps h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 16px;
}

.next-steps ol {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: nextsteps;
}

.next-steps li {
    counter-increment: nextsteps;
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.next-steps li:last-child {
    margin-bottom: 0;
}

.next-steps li::before {
    content: counter(nextsteps);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: var(--glow-green-20);
    color: var(--success);
    font-size: 13px;
    font-weight: 700;
    border-radius: 50%;
}

.next-steps a {
    color: var(--el-cyan);
    text-decoration: underline;
}

.next-steps code {
    background: var(--bg-main);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--code-inline);
}

/* Env vars block */
.env-block {
    margin-top: 24px;
}

.env-block h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.env-block pre {
    background: var(--bg-main);
    border: 1px solid var(--glow-cyan-10);
    border-radius: 8px;
    padding: 16px 20px;
    font-size: 13px;
    font-family: 'Roboto Mono', monospace;
    color: var(--text-primary);
    overflow-x: auto;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Install button */
.install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--gradient-cta);
    color: var(--bg-main);
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition:
        opacity 0.2s,
        transform 0.2s;
}

.install-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .setup-hero {
        padding: 60px 20px 40px;
    }

    .setup-hero h1 {
        font-size: 32px;
    }

    .setup-section {
        padding: 40px 20px 60px;
    }

    .setup-card {
        padding: 24px;
    }

    .next-steps {
        padding: 20px;
    }

    .credential-item {
        padding: 12px 16px;
    }
}
