@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&display=swap');

/* RANK AI Shopify Extension - Optimized Styles */

/* CSS Variables */
:root {
    --color-primary: #667eea;
    --color-brand: #563ac9;
    --color-brand-dark: #221750;
    --color-brand-light: #6e57cc;
    --color-text: #2c3e50;
    --color-text-muted: #666;
    --color-text-light: #999;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-danger-dark: #c82333;
    --color-warning: #ffc107;
    --color-border: #e9ecef;
    --color-bg-light: #f8f9fa;
    --color-bg-white: white;
    --radius-sm: 3px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;
    --transition: all 0.2s;
}

/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: Barlow, system-ui, -apple-system, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    color: #333;
    background: #f9f9f9;
    min-height: 100vh;
    padding: 20px;
}

/* Container */
.rank-container {
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 960px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Header */
.rank-header {
    background: linear-gradient(135deg, var(--color-brand-dark) 0%, var(--color-brand) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rank-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon { width: 24px; height: 24px; }

.rank-logo h1 {
    font-size: 19px;
    font-weight: 600;
    margin: 0;
}

.rank-version { font-size: 13px; opacity: 0.8; }

/* Connection Status */
.connection-status {
    padding: 12px 20px;
    background: var(--color-bg-light);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-warning);
}

.status-indicator.connected { background: var(--color-success); }
.status-indicator.disconnected { background: var(--color-danger); }
.status-indicator.warning { background: var(--color-warning); }

/* Shop Switcher */
.shop-switcher {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.shop-switcher-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.shop-switcher-select {
    font-family: inherit;
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-white);
    color: var(--color-text);
    cursor: pointer;
    max-width: 200px;
}

.shop-switcher-select:focus {
    outline: none;
    border-color: var(--color-brand);
}

.shop-switcher-current {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.shop-switcher-add {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-bg-white);
    color: var(--color-brand);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
}

.shop-switcher-add:hover {
    background: var(--color-brand);
    color: white;
    border-color: var(--color-brand);
}

/* Add-shop back link */
.add-shop-back-link {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--color-brand);
    text-decoration: none;
    font-weight: 500;
}

.add-shop-back-link:hover {
    text-decoration: underline;
}

/* Active Job Notification Bar */
.active-job-bar {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    animation: pulse-bg 2s ease-in-out infinite;
}

@keyframes pulse-bg {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

.active-job-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.active-job-icon {
    animation: spin 2s linear infinite;
}

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

.active-job-bar .button-small {
    padding: 6px 14px;
    font-size: 13px;
    background: white;
    color: var(--color-brand);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.active-job-bar .button-small:hover {
    background: #f0f0f0;
    transform: scale(1.02);
}

/* Connection Tabs */
.connection-tabs {
    display: flex;
    margin: 16px 0;
    border-bottom: 2px solid var(--color-border);
}

.conn-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: var(--transition);
}

.conn-tab:hover { background: var(--color-bg-light); }

.conn-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: var(--color-bg-light);
}

.connection-panel { display: none; padding-top: 16px; }
.connection-panel.active { display: block; }

/* OAuth Pending */
.oauth-pending {
    background: #fff9e6;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.pending-icon { font-size: 49px; margin-bottom: 10px; }
.oauth-pending h4 { color: var(--color-text); font-size: 17px; margin-bottom: 8px; }
.oauth-pending p { color: var(--color-text-muted); font-size: 14px; margin-bottom: 8px; }
.pending-note { font-size: 13px; color: var(--color-text-light); font-style: italic; }

/* Sections */
.section { padding: 20px; }
.section h3 { font-size: 17px; font-weight: 600; margin-bottom: 16px; color: var(--color-text); }
.description { color: var(--color-text-muted); margin-bottom: 20px; font-size: 14px; line-height: 1.5; }

/* Form Controls - Consolidated */
.shop-input, .api-input, .fixes-search-input, select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--color-bg-white);
    transition: var(--transition);
}

.shop-input, .api-input {
    flex: 1;
    max-width: 450px;
}

.shop-input:focus, .api-input:focus, .fixes-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

select { width: 100%; }

.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

#shop-domain-oauth { opacity: 0.7; font-size: 14px; }
.help-text { color: var(--color-text-muted); font-size: 12px; padding-top: 8px; }

/* Buttons - Consolidated */
.button, .rollback-btn, .csv-export-btn, .page-btn, .rollback-session-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--color-bg-white);
    color: #333;
}

.button:hover, .page-btn:hover { background: var(--color-bg-light); }
.button:disabled, .page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.button-primary {
    background: var(--color-brand);
    color: white;
    border-color: #30216b;
}

.button-primary:hover { background: var(--color-brand-light); }

.fix-button {
    width: 100%;
    padding: 10px;
    background: var(--color-brand);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.fix-button:hover:not(:disabled) { background: var(--color-brand-light); }

.fix-button:disabled {
    background: #E0E7FF;
    cursor: not-allowed;
    color: #413f59;
}

.button-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

#disconnect-store:hover { background: #6c757d; opacity: 0.8; }

.rollback-btn, .rollback-session-btn {
    background: var(--color-danger);
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 13px;
}

.rollback-btn:hover, .rollback-session-btn:hover:not(:disabled) { background: var(--color-danger-dark); }
.rollback-session-btn:disabled { background: #6c757d; cursor: not-allowed; }

.csv-export-btn {
    background: var(--color-bg-light);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
}

.csv-export-btn:hover { background: var(--color-border); border-color: #ccc; }
.csv-export-btn:disabled { opacity: 0.6; cursor: wait; }

.page-btn { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.page-btn:hover { border-color: var(--color-primary); }
.page-btn.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 16px;
    border-bottom: 2px solid #96afc8;
    background: var(--color-bg-white);
    padding: 0 8px;
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: #e2e3ec;
    color: #413f5b;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.tab-btn:hover { background: rgba(102, 126, 234, 0.1); }
.tab-btn.active { background: rgb(241, 243, 254); color: var(--color-brand); }

.tab-content { display: none; padding: 20px; flex: 1; flex-direction: column; }
.tab-content.active { display: flex; }

/* AI Credits Display */
.ai-credits-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgb(149 122 252) 0%, rgb(49, 46, 129) 100%);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    max-width: 200px;
}

.credits-label { font-weight: 600; }
.credits-value { font-weight: 700; font-size: 14px; }
.credits-separator { opacity: 0.7; }
.credits-total { opacity: 0.9; }

/* Health Issues */
 .domain-switcher {
     display: flex;
     align-items: center;
     gap: 10px;
     margin: 0 0 20px 0;
     padding: 12px 16px;
     background: var(--color-bg-white);
     border: 1px solid var(--color-border);
     border-radius: var(--radius-lg);
 }

 .domain-switcher-label {
     font-weight: 600;
     white-space: nowrap;
 }

 .domain-switcher-select {
     flex: 1;
     max-width: 360px;
     padding: 8px 10px;
     border: 1px solid var(--color-border);
     border-radius: var(--radius-lg);
     background: var(--color-bg-white);
     font-size: 14px;
     cursor: pointer;
 }

 .health-issues-container {
     display: grid;
     grid-template-columns: repeat(4, 1fr);
     gap: 16px;
     margin-bottom: 20px;
 }

.issue-type {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--color-bg-white);
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.latest-scan-date {
    font-size: 12px;
    color: var(--color-text-secondary, #6b7280);
    margin: -12px 0 16px 0;
    text-align: left;
}

.issue-type.no-issues {
    border-color: rgb(52, 211, 153);
    border-width: 1px;
}

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

.issue-icon { font-size: 19px; }
.issue-label { flex: 1; font-weight: 600; color: var(--color-text); }
.issue-count {
    font-size: 13px;
    color: var(--color-text-muted);
    background: var(--color-bg-light);
    padding: 4px 8px;
    border-radius: 12px;
}

/* Processing Area */
.processing-area {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    background: var(--color-bg-light);
    margin-top: 16px;
    min-height: 430px;
}

.processing-area h3 { color: var(--color-success); margin-bottom: 8px; }

.progress-container { margin: 16px 0; }

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-success);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text { font-size: 13px; color: var(--color-text-muted); margin-top: 8px; }

.processing-log {
    height: 350px;
    overflow-y: auto;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin: 12px 0;
    font-size: 14px;
}

.log-entry { margin-bottom: 8px; padding: 2px 0; }
.log-entry.success { color: #333; }
.log-entry.error { color: var(--color-danger); }
.log-entry.processing { color: var(--color-warning); }
.log-entry.warning { color: #856404; }
.log-entry a { color: inherit; text-decoration: underline; word-break: break-all; font-weight: 500; }
.log-entry a:hover { opacity: 0.8; }

.processing-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.proceed-info {
    background: #e7f3ff;
    border-left: 3px solid var(--color-primary);
    padding: 12px;
    margin: 12px 0;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text);
}

/* Fixes Accordion */
.fixes-accordion { margin: 16px 0 20px; }

.fix-category {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
}

.fix-category.no-fixes { opacity: 0.6; }
.fix-category.no-fixes .category-header { cursor: default; }
.fix-category.no-fixes .category-header:hover { background: var(--color-bg-light); }

.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-bg-light);
    cursor: pointer;
    transition: background 0.2s;
}

.category-header:hover { background: var(--color-border); }

.category-icon { font-size: 17px; }
.category-label { flex: 1; font-weight: 500; color: var(--color-text); }

.fix-count {
    background: var(--color-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.fix-count.error { background: var(--color-danger); }

.expand-icon {
    font-size: 13px;
    color: var(--color-text-muted);
    transition: transform 0.2s;
}

.fix-category.expanded .expand-icon { transform: rotate(180deg); }

.category-content {
    display: none;
    padding: 16px;
    background: var(--color-bg-white);
    border-top: 1px solid var(--color-border);
}

.fix-category.expanded .category-content { display: block; }

/* Fixes Footer */
.fixes-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

/* Settings */
.setting-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.setting-group:last-child { border-bottom: none; }
.setting-group label { display: block; font-weight: 500; margin-bottom: 8px; color: var(--color-text); }
.setting-value { color: var(--color-text-muted); margin-bottom: 8px; font-size: 14px; }
.current-value { color: var(--color-text-muted); font-size: 13px; margin-top: 4px; display: block; }

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Inline Spinner (for use in text) */
.spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

/* Notifications */
.notifications { position: fixed; top: 20px; right: 20px; z-index: 1000; }

.notification {
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-size: 14px;
    max-width: 300px;
}

.notification.success { border-left: 4px solid var(--color-success); }
.notification.error { border-left: 4px solid var(--color-danger); }
.notification.warning { border-left: 4px solid var(--color-warning); }

/* Rollback Section */
.rollback-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.rollback-section h4 { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--color-text); }

.rollback-session {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.rollback-session h5 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.rollback-session p { font-size: 13px; color: var(--color-text-muted); margin-bottom: 8px; }

/* Fixes List */
.fixes-list { max-height: 700px; overflow-y: auto; }

.fix-item {
    border-bottom: 1px solid #f1f3f4;
    padding: 16px;
    transition: opacity 0.2s;
}

.fix-item:last-child { border-bottom: none; }

.fix-item.rolled-back {
    opacity: 0.6;
    background: var(--color-bg-light);
}

.fix-item.rolled-back .fix-content {
    background: var(--color-border);
    border-left: 3px solid #6c757d;
}

.fix-item.rolled-back .rollback-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.undo-rollback-btn {
    background: transparent;
    border: 1px solid white;
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
}

.undo-rollback-btn:hover { background: white; color: #6c757d; }

.fix-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.fix-info { display: flex; flex-direction: column; gap: 4px; }
.fix-field { font-weight: 600; color: var(--color-text); font-size: 14px; }
.fix-resource, .fix-identifier { font-size: 13px; color: var(--color-text-muted); }
.fix-actions { display: flex; gap: 8px; }

.edit-fix-btn, .rollback-fix-btn {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    background: var(--color-bg-white);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.edit-fix-btn:hover { background: var(--color-bg-light); border-color: var(--color-primary); color: var(--color-primary); }
.rollback-fix-btn { border-color: var(--color-danger); color: var(--color-danger); }
.rollback-fix-btn:hover { background: var(--color-danger); color: white; }

.fix-content {
    background: var(--color-bg-light);
    border-radius: var(--radius-md);
    padding: 12px;
}

/* Alt Tags */
.alt-tags-group { display: flex; flex-direction: column; gap: 10px; }

.alt-tag-image {
    background: var(--color-bg-white);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--color-border);
}

.alt-tag-image .image-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.alt-tag-image .fix-identifier { font-size: 13px; color: var(--color-text-muted); font-weight: 500; }
.alt-tag-image .fix-change { background: transparent; padding: 0; }
.alt-tag-image .fix-meta { margin-top: 8px; }

.fix-change {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}

.original-value, .new-value { display: flex; flex-direction: column; gap: 4px; }
.original-value label, .new-value label { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--color-text-muted); }
.original-value .value { color: var(--color-danger); font-style: italic; }
.new-value .value { color: var(--color-success); font-weight: 500; }
.value { font-size: 14px; line-height: 1.4; word-break: break-word; }

.fix-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    padding-top: 8px;
}

.rollback-status {
    background: var(--color-warning);
    color: #212529;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-top: 20px;
    border-top: 1px solid var(--color-border);
}

#page-info { font-size: 14px; color: var(--color-text-muted); }

/* Empty States */
.error-message, .no-fixes-message, .no-sessions, .empty-state {
    text-align: center;
    padding: 24px;
    color: var(--color-text-muted);
    font-style: italic;
}

.error-message { color: var(--color-danger); }

.empty-state {
    padding: 60px 20px;
    background: var(--color-bg-light);
    border-radius: var(--radius-lg);
    margin: 16px 0;
    font-style: normal;
}

.empty-state p { font-size: 15px; line-height: 1.5; }

/* Loading State */
.loading-state { text-align: center; padding: 40px 20px; color: var(--color-text-muted); }

/* Rollback Sessions */
.rollback-sessions-list { margin-top: 16px; }

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.session-name { font-weight: 600; color: var(--color-text); }

.session-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-completed { background: #d4edda; color: #155724; }
.status-processing { background: #fff3cd; color: #856404; }
.status-failed { background: #f8d7da; color: #721c24; }

.session-details {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.session-actions { display: flex; justify-content: flex-end; }

/* Fix Edit Inline */
.fix-edit-tooltip {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-top: 12px;
}

.fix-edit-textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 70px;
    margin-bottom: 10px;
}

.fix-edit-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.fix-edit-buttons { display: flex; justify-content: flex-end; gap: 8px; }

.fix-edit-btn {
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.fix-edit-btn-cancel { background: var(--color-bg-white); border: 1px solid #ddd; color: var(--color-text-muted); }
.fix-edit-btn-cancel:hover { background: var(--color-bg-light); border-color: #bbb; }

.fix-edit-btn-save { background: var(--color-primary); border: 1px solid var(--color-primary); color: white; }
.fix-edit-btn-save:hover:not(:disabled) { background: #5a6fd6; }
.fix-edit-btn-save:disabled { background: #a0aec0; border-color: #a0aec0; cursor: not-allowed; }

.fix-edit-btn-rollback { background: var(--color-danger); border: 1px solid var(--color-danger); color: white; }
.fix-edit-btn-rollback:hover:not(:disabled) { background: var(--color-danger-dark); }
.fix-edit-btn-rollback:disabled { background: #e57373; border-color: #e57373; cursor: not-allowed; }

/* Fixes Table */
.fixes-search-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 8px;
}

.fixes-search-input {
    flex: 1;
    max-width: 300px;
    border-radius: var(--radius-lg);
    font-family: inherit;
}

.fixes-search-input::placeholder { color: #adb5bd; }
.fixes-search-count { font-size: 13px; color: #6c757d; }

.fixes-table-container { overflow-x: auto; max-height: 600px; overflow-y: auto; }

/* Data Tables - Consolidated */
.fixes-table, .articles-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.fixes-table th, .fixes-table td,
.articles-table th, .articles-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.fixes-table th, .articles-table th {
    background: var(--color-bg-light);
    font-weight: 600;
    color: var(--color-text);
    font-size: 12px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 1;
}

.fixes-table tbody tr:hover, .articles-table tbody tr:hover { background: var(--color-bg-light); }

.fixes-table .col-url { width: 25%; min-width: 180px; }
.fixes-table .col-url a { color: var(--color-primary); text-decoration: none; word-break: break-all; }
.fixes-table .col-url a:hover { text-decoration: underline; }
.fixes-table .col-new { width: 60%; }
.fixes-table .col-action { width: 15%; min-width: 80px; text-align: right; }

.fix-row.rolled-back { opacity: 0.6; background: var(--color-bg-light); }
.fix-row.rolled-back td { text-decoration: line-through; color: #6c757d; }
.fix-row.rolled-back .col-action { text-decoration: none; }

.fix-identifier-small { display: block; font-size: 11px; color: var(--color-text-light); margin-top: 2px; }
.new-value-text { color: var(--color-success); line-height: 1.4; display: block; max-height: 60px; overflow: hidden; text-overflow: ellipsis; }

.action-buttons { display: flex; gap: 4px; justify-content: flex-end; }

.icon-btn {
    background: transparent;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.icon-btn:hover { background: var(--color-border); }
.icon-btn.edit-fix-btn:hover { background: #e7f3ff; }
.icon-btn.rollback-fix-btn:hover { background: #ffe7e7; }
.icon-btn.undo-rollback-btn:hover { background: #e7ffe7; }

/* Fix Edit Row */
.fix-edit-row td { background: var(--color-bg-light); padding: 12px; }

.fix-edit-inline { display: flex; gap: 12px; align-items: stretch; }
.fix-edit-inline .fix-edit-textarea { flex: 1; margin-bottom: 0; min-height: 50px; }
.fix-edit-inline .fix-edit-buttons { display: flex; flex-direction: column; gap: 6px; justify-content: flex-end; min-width: 90px; }
.fix-edit-inline .fix-edit-btn { padding: 6px 12px; white-space: nowrap; width: 100%; }

.fix-readonly-textarea { background: #f1f3f4; color: var(--color-text-muted); cursor: not-allowed; border-color: #ddd; }
.fix-readonly-textarea:focus { box-shadow: none; border-color: #ddd; }

.rollback-preview { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.rollback-label { font-size: 12px; font-weight: 500; color: var(--color-text-muted); text-transform: uppercase; }
.fix-rollback-row .rollback-label { color: var(--color-danger); }
.fix-undo-row .rollback-label { color: var(--color-success); }

/* Blog Selector */
.blog-selector { margin-bottom: 16px; display: flex; align-items: center; gap: 12px; }
.blog-selector label { font-weight: 500; color: var(--color-text); }
.blog-selector select { min-width: 250px; width: 250px; }

/* Bulk Actions */
.bulk-actions {
    background: #f1f3fd;
    border: 1px solid #9caec6;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#selected-count { font-weight: 500; color: var(--color-text); }

/* Articles Table */
.articles-table-container { margin: 16px 0; overflow-x: auto; min-height: 200px; }
.articles-table { border: 1px solid var(--color-border); }
.articles-table th, .articles-table td { padding: 12px; }
.articles-table .checkbox-col { width: 40px; text-align: center; }
.articles-table .date-col { width: 120px; }
.articles-table .status-col { width: 80px; text-align: center; }
.articles-table .title-col { min-width: 200px; }
.articles-table input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.articles-table tbody tr.selected { background: #e7f3ff; }
.articles-table tbody tr.uploaded { background: var(--color-bg-light); }
.uploaded-check { color: var(--color-success); font-size: 17px; }

/* Issues Notification Bar */
.issues-notification-bar {
    display: none;
    margin: 20px 40px;
    background: #FFF9E6;
    border-left: 4px solid #E6A100;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    border-radius: var(--radius-md);
}

.issues-notification-bar.visible { display: block; }
.issues-notification-bar a { color: #0066CC; text-decoration: underline; }
.issues-notification-bar a:hover { color: #004499; }

/* Website Not Found Message */
.website-not-found-message {
    background: #fff3cd;
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin: 20px 0;
    text-align: center;
}

.website-not-found-message h3 { color: #856404; font-size: 16px; font-weight: 500; line-height: 1.5; margin: 0; }
.website-not-found-message a { color: #0066CC; text-decoration: underline; font-weight: 600; }
.website-not-found-message a:hover { color: #004499; }

/* Scanning Message - shown when website is being crawled */
.scanning-message {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid #2196f3;
    border-radius: var(--radius-xl);
    padding: 40px 30px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 4px 20px rgba(33, 150, 243, 0.2);
}

.scanning-message .scanning-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.scanning-message h3 {
    color: #1565c0;
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 12px 0;
}

.scanning-message p {
    color: #1976d2;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 8px 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.scanning-message .button-scanning-refresh {
    margin-top: 20px;
    background: #1976d2;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.scanning-message .button-scanning-refresh:hover {
    background: #1565c0;
    color: white;
}

/* Responsive */
@media (max-width: 1024px) {
    .health-issues-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    .health-issues-container { grid-template-columns: 1fr; }
    .input-group, .processing-actions, .tab-nav, .session-details { flex-direction: column; }
    .tab-btn { text-align: left; }
    .fix-change { grid-template-columns: 1fr; gap: 12px; }
    .fix-header, .session-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .fix-actions { align-self: flex-end; }
    .fixes-table .col-url { width: 30%; }
    .fixes-table .col-new { width: 50%; }
    .new-value-text { max-height: 40px; }
    .fix-edit-inline { flex-direction: column; }
    .fix-edit-inline .fix-edit-buttons { flex-direction: row; justify-content: flex-end; }
    .blog-selector { flex-direction: column; align-items: flex-start; gap: 8px; }
    .blog-selector select { width: 100%; min-width: unset; }
    .bulk-actions { flex-direction: column; gap: 12px; text-align: center; }
    .articles-table .date-col { display: none; }
    .pagination { flex-wrap: wrap; }
}

/* ============================================================================
   Rank Booster Tab
   ============================================================================ */

/* Sub-tab navigation */
.rb-subtab-nav {
    display: flex;
    align-items: center;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 16px;
}

.rb-subtab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: var(--transition);
}

.rb-subtab-btn:hover { background: var(--color-bg-light); }

.rb-subtab-btn.active {
    color: var(--color-brand);
    border-bottom-color: var(--color-brand);
}

.rb-beta-pill {
    margin-left: auto;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rb-subtab-content { display: none; flex: 1; flex-direction: column; }
.rb-subtab-content.active { display: flex; }

/* Credits display — uses shared .ai-credits-display from issues tab */

/* URL Input textarea */
.rb-url-textarea {
    width: 100%;
    max-width: 700px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    line-height: 1.5;
}

.rb-url-textarea:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px rgba(86, 58, 201, 0.1);
}

/* Spinner */
.rb-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Info panel (how it works + PRO ENGINE) */
.rb-info-panel {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 100px;
    max-width: 1100px;
}

.rb-steps { flex: 1; }
.rb-steps h4 {
    margin: 0 0 14px;
    font-size: 15px;
    color: var(--color-text);
}

.rb-step-list {
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--color-brand);
    margin-left: 2px;
}

.rb-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
}

.rb-step:last-child { border-bottom: none; }

.rb-step-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    background: var(--color-brand);
    color: #fff!important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.rb-step strong { font-size: 13px; }
.rb-step span { font-size: 12px; color: #666; }
.rb-step b { color: var(--color-brand); font-weight: 600; }

/* PRO ENGINE card */
.rb-engine-card {
    flex: 0 0 340px;
}

.rb-engine-inner {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    border-top: 4px solid #26f8d3;
    position: relative;
    overflow: hidden;
}

.rb-engine-inner h4 {
    margin: 0 0 6px;
    color: #26f8d3;
    font-size: 18px;
    letter-spacing: 1px;
}

.rb-engine-inner > p {
    margin: 0 0 10px;
    font-size: 12px;
    color: #aab;
    line-height: 1.4;
}

.rb-engine-inner ul {
    margin: 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.7;
    list-style: none;
}

.rb-engine-sub { color: #888; font-size: 12px; margin-left: 20px; }

/* Prepared URL Table */
.rb-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.rb-back-link {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.rb-back-link:hover { color: var(--color-brand); }

.rb-table-footer {
    margin-top: auto;
    padding-top: 16px;
}

.rb-table-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rb-credit-label {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* Bulk bar */
.rb-bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: var(--color-bg-light);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    font-size: 13px;
}

/* URL table */
.rb-url-table, .rb-status-table, .rb-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rb-url-table th, .rb-url-table td,
.rb-status-table th, .rb-status-table td,
.rb-history-table th, .rb-history-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: middle;
}

.rb-url-table th, .rb-status-table th, .rb-history-table th {
    font-weight: 600;
    background: var(--color-bg-light);
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rb-col-check { width: 40px; text-align: center; }

.rb-url-table td:first-child,
.rb-url-table th:first-child {
    text-align: center;
}

.rb-url-table input[type="checkbox"] {
    margin: 0;
    vertical-align: middle;
}

.rb-col-url { }
.rb-col-status { width: 180px; }
.rb-col-action { width: 300px; text-align: right; }

.rb-cell-url {
    word-break: break-all;
    color: inherit;
    text-decoration: none;
}

a.rb-cell-url:hover { color: var(--color-brand); text-decoration: underline; }

.rb-cell-action { text-align: right; white-space: nowrap; }
.rb-cell-actions { white-space: nowrap; }

.rb-action-cell-inner {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  white-space: normal;
  max-width: 100%;
}

.rb-action-buttons {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.rb-custom-prompt-link {
  font-size: 12px;
  color: var(--color-brand);
  text-decoration: none;
  line-height: 1.3;
}

.rb-custom-prompt-link:hover {
  text-decoration: underline;
}

.rb-row-notfound { opacity: 0.5; }

/* Mode toggle */
.rb-mode-toggle {
    display: inline-flex;
    margin-right: 6px;
}

.rb-mode-toggle > .rb-mode-btn,
.rb-mode-toggle > .rb-fixes-dropdown-wrapper > .rb-mode-btn {
    border: 1px solid #ccc;
}

.rb-mode-toggle > .rb-mode-btn:first-child {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
    border-right: none;
}

.rb-mode-toggle > .rb-fixes-dropdown-wrapper > .rb-mode-btn {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.rb-mode-btn {
    padding: 5px 12px;
    border: none;
    background: var(--color-bg-light);
    color: #666;
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.rb-mode-btn:first-child { border-right: 1px solid #ccc; }

.rb-mode-btn.active {
    background: var(--color-brand);
    color: white;
}

.rb-mode-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Fixes dropdown (per-row) */
.rb-fixes-dropdown-wrapper { position: relative; display: inline-block; z-index: 100; }

.rb-fixes-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 101;
    background: white;
    border: 1px solid #ccc;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 240px;
    padding: 6px 0;
    max-height: 320px;
    overflow-y: auto;
}

.rb-check-item {
    display: block;
    padding: 4px 14px;
    font-size: 12px;
    cursor: pointer;
}

.rb-check-item:hover { background: #f0f6fc; }
.rb-check-disabled { opacity: 0.4; cursor: not-allowed; }
.rb-check-disabled:hover { background: transparent; }

/* Bulk dropdown */
.rb-dropdown-wrapper { position: relative; display: inline-block; }

.rb-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: white;
    border: 1px solid #ccc;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 280px;
    padding: 10px 0;
}

.rb-dropdown-section { padding: 6px 14px; }
.rb-dropdown hr { margin: 6px 0; border: none; border-top: 1px solid #eee; }
.rb-dropdown-footer { padding: 8px 14px; display: flex; gap: 8px; }

.rb-settings-btn, .rb-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    opacity: 0.6;
    transition: var(--transition);
}

.rb-settings-btn:hover { opacity: 1; }
.rb-remove-btn { color: #d63638; }
.rb-remove-btn:hover { opacity: 1; }

.rb-kw-loading { color: #999; font-size: 12px; }

.rb-kw-link {
    color: var(--color-brand);
    text-decoration: underline dotted;
    font-size: 12px;
    cursor: pointer;
}

/* Processing view */
.rb-proc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.rb-proc-layout {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

/* Processing log terminal */
.rb-proc-log {
    flex: 1;
    background: #1d2327;
    color: #c3c4c7;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    height: 314px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    padding: 12px;
    line-height: 1.6;
}

.rb-log-entry { padding: 1px 0; }
.rb-log-success { color: #00a32a; }
.rb-log-error { color: #d63638; }
.rb-log-running { color: #dba617; }
.rb-animated-dots { display: inline; }

/* Processing info sidebar */
.rb-proc-info {
    flex: 0 0 260px;
    background: #f0f6fc;
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 13px;
}

.rb-proc-info p { margin: 0 0 6px; }
.rb-proc-info ul { margin: 0 0 10px; padding-left: 18px; line-height: 1.6; }

/* Modals */
.rb-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rb-modal {
    background: white;
    border-radius: var(--radius-xl);
    width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.rb-modal-wide { width: 910px; max-height: 95vh; }

.rb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.rb-modal-header h4 { margin: 0; font-size: 16px; }

.rb-draft-modal-url {
    padding: 8px 20px 4px;
    border-bottom: 1px solid var(--color-border);
    font-size: 11px;
}

.rb-draft-modal-url a {
    color: var(--color-text-muted);
    text-decoration: none;
    word-break: break-all;
}

.rb-draft-modal-url a:hover {
    color: var(--color-brand);
    text-decoration: underline;
}

.rb-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.rb-modal-close:hover { color: #333; }

.rb-modal-body { padding: 20px; }
.rb-modal-body ul, .rb-modal-body ol { padding-left: 28px; margin: 8px 0; }
.rb-modal-body li { margin-bottom: 8px; line-height: 1.5; }
.rb-modal-body li + li { margin-top: 4px; }

.rb-summary-instructions {
    margin-top: 16px;
    padding: 12px 14px;
    background: #f9f9fb;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
}

.rb-summary-instructions-label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #1e1e2e;
}

.rb-summary-instructions-text {
    font-style: italic;
    color: #444;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.rb-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Draft review fields */
.rb-draft-fields { display: flex; flex-direction: column; gap: 16px; }

.rb-draft-field {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.rb-draft-field-header {
    background: var(--color-bg-light);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
}

.rb-draft-field-header label { cursor: pointer; }

.rb-draft-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rb-draft-field-title {
    font-weight: 500;
    font-size: 13px;
}

.rb-skip-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rb-skip-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
}

.rb-skip-btn:hover {
    background: #f5f7fa;
    border-color: #bbb;
    color: #555;
}

/* When only one editable field is visible, skipping it would leave
   nothing to push — hide the Skip button on that field. */
.rb-single-field .rb-skip-btn,
.rb-single-field .rb-metafield-editor-row .rb-skip-btn {
    display: none !important;
}

.rb-skip-state {
    font-size: 11px;
    color: var(--color-text-muted);
}

.rb-skip-undo {
    background: none;
    border: none;
    color: var(--color-brand);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    text-decoration: underline;
}

.rb-skip-undo:hover { color: #1a4480; }

.rb-draft-field[data-skipped="1"] {
    opacity: 0.55;
}

.rb-draft-field[data-skipped="1"] .rb-draft-comparison {
    background: repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0,0,0,0.03) 4px, rgba(0,0,0,0.03) 8px);
}

.rb-metafield-editor-row[data-skipped="1"] {
    opacity: 0.55;
}

.rb-metafield-editor-row[data-skipped="1"] textarea {
    background: #fafafa;
}

.rb-char-counter {
    font-size: 10px;
    color: var(--color-text-muted);
    text-align: right;
    margin-top: 4px;
}

.rb-draft-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--color-border);
}

.rb-draft-field[data-field="content"] .rb-draft-comparison {
    grid-template-columns: 0.9fr 1.3fr;
}

.rb-draft-original, .rb-draft-new {
    padding: 10px 12px;
    background: white;
    font-size: 12px;
}

.rb-draft-original small, .rb-draft-new small {
    display: block;
    margin-bottom: 4px;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.rb-draft-value {
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.5;
}

.rb-draft-field[data-field="content"] .rb-draft-value {
    max-height: 500px;
}

.rb-view-all {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 10px;
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-brand);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
}

.rb-view-all:hover {
    background: #eef3f8;
    border-color: var(--color-brand);
}

/* Custom metafields section needs full height for its own internal layout */
.rb-draft-field[data-field="customMetafields"] .rb-draft-value {
    max-height: none;
}

.rb-draft-edit {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12px;
    resize: vertical;
}

.rb-draft-edit:focus {
    outline: none;
    border-color: var(--color-brand);
}

/* Row settings modal */
.rb-settings-section { margin-bottom: 16px; }
.rb-settings-section label { font-size: 13px; }
.rb-settings-section small { color: var(--color-text-muted); }

.rb-custom-prompt-section {
  display: none;
  margin-bottom: 16px;
}

.rb-custom-prompt-section.is-visible {
  display: block;
}

.rb-custom-prompt-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.rb-custom-prompt-label strong {
  display: block;
  margin-bottom: 2px;
}

.rb-custom-prompt-input {
  display: block;
  width: 100%;
  min-height: 140px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #c9cccf;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  font-family: inherit;
}

.rb-custom-prompt-input:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 1px var(--color-brand);
}

.rb-custom-prompt-section .rb-char-count {
  display: block;
  margin-top: 6px;
  text-align: right;
  font-size: 12px;
  color: var(--color-text-muted);
}

.rb-keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.rb-kw-tag {
    background: #f0f6fc;
    border: 1px solid #d0e3f7;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rb-kw-remove {
    background: none;
    border: none;
    color: #d63638;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.rb-keyword-input-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.rb-keyword-input-row input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* History footer */
.rb-history-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.rb-pagination {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.rb-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.rb-metafields-editor textarea.rb-metafield-edit {
    min-height: 80px;
    font-family: inherit;
}

/* Responsive */
@media (max-width: 768px) {
    .rb-info-panel { flex-direction: column; }
    .rb-engine-card { flex: 1; }
    .rb-proc-layout { flex-direction: column; }
    .rb-proc-info { flex: 1; }
    .rb-draft-comparison { grid-template-columns: 1fr; }
    .rb-col-action { width: auto; }
}
/* ============================================================================
   Rank Booster — Custom Fields sub-tab
   ============================================================================ */
.rb-cf-header { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:8px; }
.rb-cf-group { margin-bottom:24px; padding:16px; border:1px solid #e5e5e5; border-radius:8px; background:#fafafa; }
.rb-cf-group-title { margin:0 0 12px 0; font-size:14px; font-weight:600; color:#333; }
.rb-cf-count { color:#888; font-weight:400; font-size:12px; }
.rb-cf-list { display:flex; flex-direction:column; gap:8px; }
.rb-cf-row { display:flex; gap:12px; align-items:flex-start; padding:10px 12px; border:1px solid #e5e5e5; border-radius:6px; background:#fff; cursor:pointer; }
.rb-cf-row:hover { border-color:#bbb; }
.rb-cf-row input[type="checkbox"] { margin-top:3px; cursor:pointer; }
.rb-cf-row-info { flex:1; min-width:0; }
.rb-cf-row-label { font-weight:500; color:#222; }
.rb-cf-row-meta { display:flex; gap:8px; align-items:center; margin-top:3px; font-size:12px; color:#666; flex-wrap:wrap; }
.rb-cf-row-meta code { background:#f0f0f0; padding:1px 6px; border-radius:3px; font-size:11px; }
.rb-cf-type-badge { background:#e7f3ff; color:#1f5dab; padding:1px 6px; border-radius:3px; font-size:11px; }
.rb-cf-row-inactive { opacity:0.55; }
.rb-cf-inactive-note { color:#a0501a; font-size:11px; font-weight:400; margin-left:6px; }

/* Analysis results link in log */
.rb-analysis-link {
    font-weight: 700;
    text-decoration: underline;
    color: var(--color-primary, #2563eb);
    cursor: pointer;
}
.rb-analysis-link:hover { color: var(--color-primary-hover, #1d4ed8); }

/* Analysis modal table */
.rb-analysis-summary { margin-bottom: 16px; line-height: 1.5; color: #555; }
.rb-analysis-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rb-analysis-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--color-border, #e5e7eb); font-weight: 600; color: #333; }
.rb-analysis-table td { padding: 8px 10px; border-bottom: 1px solid var(--color-border, #e5e7eb); vertical-align: top; }
.rb-analysis-table tr:last-child td { border-bottom: none; }
.rb-analysis-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.rb-analysis-yes { background: #dcfce7; color: #166534; }
.rb-analysis-no { background: #fef2f2; color: #991b1b; }
