/**
 * Settings Page Styles
 * Extracted from inline styles for proper cache-busting
 */

.settings-page {
    max-width: 700px;
    margin: 0 auto;
}

.settings-page h1 {
    margin-bottom: 1.5rem;
}

/* Tabs */
.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    transition: color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-btn .material-symbols-outlined {
    font-size: 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Settings sections */
.settings-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.section-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 500px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .settings-tabs {
        overflow-x: auto;
    }
    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

.success-banner {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Password section */
.password-toggle {
    color: var(--accent);
    cursor: pointer;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.password-toggle:hover {
    text-decoration: underline;
}

.password-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* API Key Section */
.api-key-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    font-family: monospace;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.api-key-new {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.api-key-value {
    word-break: break-all;
    flex: 1;
}

.api-key-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.btn-copy {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-copy:hover {
    background: var(--bg-hover);
}

.warning-text {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #ca8a04;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Connected Apps Section */
.connected-app {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.connected-app:last-child {
    margin-bottom: 0;
}

.app-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

.app-details h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9375rem;
}

.app-details .app-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state .material-symbols-outlined {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 0.5rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s linear infinite;
}

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

.error-text {
    color: #dc2626;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

/* AI Provider Keys */
.ai-key-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.ai-key-card:last-child {
    margin-bottom: 0;
}

.ai-key-card.is-default {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.05);
}

.ai-key-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1;
}

.ai-key-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    font-size: 1.25rem;
}

.ai-key-details {
    flex: 1;
}

.ai-key-details h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-key-details .key-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.ai-key-details .key-error {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.25rem;
}

.ai-key-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.badge-default {
    background: var(--accent);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.badge-provider {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.ai-keys-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.ai-keys-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Subscription status badges */
.status-badge {
    display: inline-block;
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
}

.status-badge.status-free {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.status-badge.status-active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.status-badge.status-trialing {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.status-badge.status-past_due {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
}

.status-badge.status-canceled {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Billing cycle toggle */
.billing-toggle {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 0.25rem;
    gap: 0.25rem;
}

.toggle-btn {
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.toggle-btn:hover {
    color: var(--text-primary);
}

.toggle-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.toggle-btn .save-badge {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* Plan cards */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.plan-card {
    position: relative;
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
}

.plan-card.featured {
    border-color: var(--accent);
}

.plan-card.featured::before {
    content: 'Most Popular';
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.plan-card-header {
    margin-bottom: 1.25rem;
}

.plan-card-header h4 {
    margin: 0 0 0.375rem 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.plan-card-header p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.plan-pricing {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.plan-price {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.plan-price .amount {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.plan-price .period {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.plan-price .billed {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    flex: 1;
}

.plan-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.875rem;
    margin-bottom: 0.625rem;
    color: var(--text-secondary);
}

.plan-features li .material-symbols-outlined {
    font-size: 18px;
    color: #22c55e;
    flex-shrink: 0;
    margin-top: 1px;
}

.plan-card .btn {
    width: 100%;
    justify-content: center;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--accent-hover, #1d4ed8);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

/* Current plan card */
.current-plan-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

.current-plan-info h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.current-plan-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.current-plan-meta .renewal {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

@media (max-width: 500px) {
    .current-plan-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .current-plan-card .btn {
        width: 100%;
    }
    .plan-grid {
        grid-template-columns: 1fr;
    }
}
