/* ═══════════════════════════════════════
   Rank Booster Styles
   ═══════════════════════════════════════ */

/* Allow dropdowns to escape the .rank-section overflow:hidden */
.rank-booster-section { overflow: visible !important; }

/* --- Sub-tabs --- */
.rank-booster-subtabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #c3c4c7;
}
.rank-booster-subtab {
    background: none;
    border: 1px solid transparent;
    border-bottom: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #50575e;
    margin-bottom: -1px;
}
.rank-booster-subtab:hover { color: #135e96; }
.rank-booster-subtab.active {
    border-color: #c3c4c7;
    border-bottom-color: #fff;
    background: #fff;
    color: #1d2327;
    font-weight: 600;
}

/* --- Banner --- */
.rb-banner {
    padding: 12px 16px;
    border-left: 4px solid #2271b1;
    background: #f0f6fc;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.rb-banner-info { border-left-color: #2271b1; }
.rb-banner-success { border-left-color: #00a32a; background: #edfaef; }
.rb-banner-warning { border-left-color: #bd8600; background: #fcf6e1; }
.rb-banner-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
    line-height: 1;
}
.rb-banner-close:hover { color: #d63638; }

/* --- Optimize bar (top/bottom) --- */
.rb-optimize-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
}
.rb-optimize-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rb-total-credits { font-weight: 600; color: #50575e; }
.rb-settings-link { text-decoration: none; font-size: 13px; }

/* --- Bulk bar --- */
.rb-bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    margin-bottom: 10px;
    position: relative;
}
#rb-selected-count { font-weight: 600; }
#rb-bulk-dropdown { top: 100%; left: 0; margin-top: 4px; }

/* --- Table --- */
#rb-table td { vertical-align: middle; }
#rb-table th.check-column,
#rb-table td.check-column { width: 40px; padding: 8px 10px !important; text-align: center; vertical-align: middle; }
#rb-table th.check-column input[type="checkbox"],
#rb-table td.check-column input[type="checkbox"] { margin: 0; }

.rb-status-ready { color: #00a32a; }
.rb-kw-count {
    display: inline-block;
    font-size: 11px;
    color: #2271b1;
    border-bottom: 1px dotted #2271b1;
    cursor: pointer;
}
.rb-kw-count:hover { color: #135e96; }
.rb-status-not_found { color: #d63638; }
.rb-status-unsupported { color: #bd8600; }

/* --- Action column --- */
.rb-action-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rb-action-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rb-custom-prompt-row { width: 100%; text-align: right; line-height: 1.3; }
.rb-add-custom-prompt {
    font-size: 12px;
    color: #2271b1;
    text-decoration: none;
    border-bottom: 1px dotted #2271b1;
}
.rb-add-custom-prompt:hover { color: #135e96; }
.rb-custom-prompt-error {
    display: block;
    font-size: 11px;
    color: #d63638;
    margin-top: 2px;
}
.rb-custom-prompt-wrap { position: relative; margin-top: 6px; }
.rb-custom-prompt-wrap textarea { width: 100%; box-sizing: border-box; padding-bottom: 22px; }
.rb-char-count {
    position: absolute;
    right: 8px;
    bottom: 6px;
    font-size: 11px;
    color: #646970;
    pointer-events: none;
}
.rb-inline-error { color: #d63638; font-size: 12px; margin: 6px 0 0; }
#rb-table th:last-child, #rb-table td:last-child { text-align: right; }

.rb-toggle-group {
    display: inline-flex;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    overflow: hidden;
}
.rb-toggle-btn {
    padding: 4px 10px;
    border: none;
    background: #f0f0f1;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.4;
}
.rb-toggle-btn:first-child { border-right: 1px solid #c3c4c7; }
.rb-toggle-btn.active {
    background: #2271b1;
    color: #fff;
}
.rb-toggle-btn:hover:not(.active) { background: #dcdcde; }

.rb-settings-btn {
    background: none;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
}
.rb-settings-btn:hover { background: #f0f0f1; }

/* --- Dropdown (choose fixes / bulk edit) --- */
.rb-dropdown {
    position: absolute;
    z-index: 100;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    padding: 8px 0;
    min-width: 240px;
    max-height: 350px;
    overflow-y: auto;
    text-align: left;
}
.rb-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}
.rb-dropdown-item input[type="checkbox"],
.rb-dropdown-item input[type="radio"] {
    flex-shrink: 0;
    margin: 2px 0 0;
}
.rb-dropdown-label {
    flex: 1;
    line-height: 1.4;
    min-width: 0;
}
.rb-dropdown-item:hover { background: #f0f6fc; }
.rb-dropdown hr { margin: 4px 0; border: 0; border-top: 1px solid #dcdcde; }
.rb-dropdown-actions { padding: 8px 14px; text-align: right; border-top: 1px solid #dcdcde; margin-top: 4px; }

.rb-choose-fixes-btn {
    padding: 4px 10px;
    border: 1px solid #c3c4c7;
    background: #f0f0f1;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
}
.rb-choose-fixes-btn:hover { background: #dcdcde; }

/* --- Processing log --- */
.rb-processing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.rb-abort-btn { color: #d63638 !important; border-color: #d63638 !important; }
.rb-abort-btn:hover { background: #d63638 !important; color: #fff !important; }

.rb-processing-log {
    background: #1d2327;
    color: #c3c4c7;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 16px;
    border-radius: 4px;
    height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}
.rb-log-entry { padding: 2px 0;font-size: 13px;font-family: courier; }
.rb-log-time { color: #72aee6; }
.rb-log-success { color: #00a32a; }
.rb-log-error { color: #d63638; }
.rb-log-running { color: #dba617; }

/* --- Action buttons in completed rows --- */
.rb-action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
/* History (Pages Optimized) + processing tables: float action buttons right. */
#rb-history-table .rb-action-btns,
#rb-locked-table-area .rb-action-btns { justify-content: flex-end; align-items: center; }
.rb-action-btns .button { font-size: 12px; padding: 2px 8px; }
.rb-live-link { color: #00a32a; font-weight: 600; text-decoration: none; }
.rb-live-link:hover { text-decoration: underline; }

/* --- Modal --- */
.rb-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100000;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}
.rb-modal-content {
    background: #fff;
    border-radius: 6px;
    width: 480px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
.rb-modal-large { width: 640px; }
.rb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #dcdcde;
}
.rb-modal-header h3 { margin: 0; }
.rb-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #50575e;
    padding: 0 4px;
}
.rb-modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.rb-summary-custom-prompt {
    margin-top: 16px;
    padding: 12px 14px;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
}
.rb-summary-custom-prompt-label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #1d2327;
}
.rb-summary-custom-prompt-text {
    color: #50575e;
    white-space: pre-wrap;
    word-break: break-word;
}
.rb-content-rendered { border: 1px solid #dcdcde; border-radius: 4px; padding: 16px; background: #fff; }
.rb-content-rendered img { max-width: 100%; height: auto; }
.rb-modal-footer { padding: 12px 20px; border-top: 1px solid #dcdcde; text-align: right; }

/* --- Row settings popup --- */
.rb-popup {
    position: absolute;
    z-index: 101;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 340px;
    padding: 0;
}
.rb-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #dcdcde;
}
.rb-popup-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #50575e;
}
.rb-popup-body { padding: 14px; }
.rb-popup-footer { padding: 10px 14px; border-top: 1px solid #dcdcde; text-align: right; }

/* --- Keywords list (tag-style) --- */
.rb-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.rb-keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    padding: 3px 8px;
    font-size: 12px;
}
.rb-keyword-tag small { color: #72aee6; }
.rb-keyword-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #d63638;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

/* --- Pagination --- */
.rb-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

/* --- Locked table (during processing) --- */
.rb-table-locked {
    opacity: 0.7;
    pointer-events: none;
}
.rb-table-locked::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}
