/* ═══════════════ HEADER ═══════════════ */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.settings-header .tab-title { margin-bottom: 0; }
.settings-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
    line-height: 1.5;
}

.settings-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(245, 124, 0, 0.1);
    border: 1px solid rgba(245, 124, 0, 0.3);
    border-radius: var(--radius-pill);
    font-size: 13px;
    color: var(--yellow);
}
.settings-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--yellow);
    animation: settingsPulse 1.8s ease-in-out infinite;
}
@keyframes settingsPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(1.15); }
}

.settings-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    background: var(--bg-surface);
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-bottom: 24px;
}
.settings-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 12px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.22s ease;
    position: relative;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-tap-highlight-color: transparent;
}
.settings-tab svg { width: 18px; height: 18px; flex-shrink: 0; }
.settings-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.settings-tab:hover { color: var(--text-main); background: var(--skeleton-base); }
.settings-tab.active {
    background: var(--accent);
    color: var(--white-on-accent);
    box-shadow: 0 4px 16px rgba(var(--accent-rgb), 0.35);
}
.settings-tab.active svg { stroke: var(--white-on-accent); }

.settings-section { display: none; }
.settings-section.active { display: block; }

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.settings-preview {
    position: sticky;
    top: 90px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}
.settings-preview-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 16px;
}
.settings-preview-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
    line-height: 1.5;
}

.seo-preview-empty-hint {
    padding: 24px 16px;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    line-height: 1.5;
}

.seo-preview {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    color: #202124;
}
.seo-preview-url { color: #5f6368; font-size: 12px; margin-bottom: 6px; }
.seo-preview-title {
    color: #1a0dab;
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 6px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.seo-preview-desc {
    color: #4d5156;
    font-size: 13px;
    line-height: 1.58;
    word-break: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.seo-image-preview {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    aspect-ratio: 1200 / 630;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.seo-favicon-preview {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
}
.seo-favicon-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

.seo-logo-preview {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
}
.seo-logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}
.settings-card:hover { border-color: var(--border); }
.settings-card-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.settings-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.settings-card-icon svg { width: 20px; height: 20px; }
.settings-card-title {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 4px 0;
    line-height: 1.3;
}
.settings-card-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}
.settings-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.settings-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.5;
}
.settings-hint code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--accent);
    font-family: monospace;
}

.settings-save-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 24px;
    position: sticky;
    bottom: 16px;
    z-index: 50;
    box-shadow: 0 -6px 24px var(--shadow-color);
    flex-wrap: wrap;
}
.settings-save-info {
    font-size: 14px;
    color: var(--text-muted);
}
.settings-save-info.dirty { color: var(--yellow); }
.settings-save-actions { display: flex; gap: 12px; }
.settings-save-actions .btn-cancel,
.settings-save-actions .btn-save {
    padding: 10px 24px;
    font-size: 14px;
    min-height: 40px;
    border-radius: var(--radius-pill);
}
.settings-save-actions .btn-cancel:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: var(--border);
    color: var(--text-muted);
}

.settings-service-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.btn-tool {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    transition: var(--transition);
    font-family: var(--font-body);
    cursor: pointer;
}
.btn-tool.btn-cache { color: var(--text-muted); }
.btn-tool.btn-cache:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}
.btn-tool.btn-logout {
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.3);
}
.btn-tool.btn-logout:hover {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-hover);
}

.btn-upload-hero {
    padding: 12px 20px;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    font-family: var(--font-body);
}
.btn-upload-hero:hover {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
}

@media (max-width: 992px) {
    .settings-grid { grid-template-columns: 1fr; }
    .settings-preview { position: static; }
    .settings-service-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .settings-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .settings-tabs {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 6px;
        border-radius: 14px;
    }
    .settings-tab {
        padding: 12px 10px;
        font-size: 13px;
        gap: 8px;
        border-radius: 10px;
    }
    .settings-tab svg { width: 16px; height: 16px; }
    .settings-save-bar {
        position: static;
        box-shadow: none;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
    }
    .settings-save-actions { width: 100%; }
    .settings-save-actions button { flex: 1; }
}

.theme-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    text-align: center;
}

.theme-option:hover {
    border-color: var(--text-muted);
}

.theme-option input {
    display: none;
}

.theme-option:has(input:checked) {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.06);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.15);
}

.theme-option-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: block;
    position: relative;
}

.theme-option-preview--dark {
    background: #0E0E0E;
}
.theme-option-preview--dark::before {
    content: '';
    position: absolute;
    top: 16%; left: 10%; right: 10%;
    height: 14%;
    background: #F5F0EB;
    border-radius: 3px;
    opacity: 0.85;
}
.theme-option-preview--dark::after {
    content: '';
    position: absolute;
    top: 40%; left: 10%;
    width: 40%;
    height: 36%;
    background: #C22A42;
    border-radius: 6px;
}

.theme-option-preview--light {
    background: #F7F3EE;
}
.theme-option-preview--light::before {
    content: '';
    position: absolute;
    top: 16%; left: 10%; right: 10%;
    height: 14%;
    background: #1F1B18;
    border-radius: 3px;
    opacity: 0.85;
}
.theme-option-preview--light::after {
    content: '';
    position: absolute;
    top: 40%; left: 10%;
    width: 40%;
    height: 36%;
    background: #C22A42;
    border-radius: 6px;
}

.theme-option-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    transition: color 0.2s ease;
}

.theme-option:has(input:checked) .theme-option-label {
    color: var(--accent);
    font-weight: 600;
}