/* ═══════════════════════════════════════════════════════════════
   WiserReview WooCommerce Plugin — Admin Styles
   ═══════════════════════════════════════════════════════════════ */

html { scroll-behavior: smooth; }

/* ─── Page Layout ─── */
.wr-page {
    max-width: 1080px;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
}
.wr-form-contents { display: contents; }

/* ─── Header ─── */
.wr-header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    margin: 0 -20px 24px;
    padding: 18px 40px;
}
.wr-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1080px;
}
.wr-header-logo { height: 28px; }
.wr-header-sep { width: 1px; height: 24px; background: #ddd; }
.wr-header-ver { font-size: 12px; color: #999; font-weight: 500; }
.wr-header-links { display: flex; gap: 18px; align-items: center; margin-left: 12px; }
.wr-header-link { font-size: 13px; color: #2271b1; font-weight: 500; }
.wr-header-link:hover { text-decoration: underline; }
.wr-header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
}
.wr-rate-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 16px; font-size: 12px; font-weight: 600;
    color: #d4850a; border: 1.5px solid #e9a23b; border-radius: 4px;
    text-decoration: none; transition: all .2s; background: #fff;
}
.wr-rate-btn:hover { background: #fef8ec; border-color: #d4850a; color: #b36d00; text-decoration: none; }
.wr-rate-btn:hover svg { fill: currentColor; }

/* ─── Section Card ─── */
.wr-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
}
.wr-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    border-radius: 6px 6px 0 0;
}
.wr-section-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.wr-section-head .badge {
    font-size: 10px; font-weight: 700; padding: 2px 7px;
    border-radius: 3px; text-transform: uppercase; letter-spacing: .3px;
}
.wr-section-head .head-link { margin-left: auto; font-size: 12px; font-weight: 500; }
.badge--required { background: #fcf0f1; color: #d63638; border: 1px solid #f0b8b8; }
.badge--done { background: #edfaef; color: #00822b; border: 1px solid #a7d7ab; }
.wr-section-body { padding: 18px 20px; }

/* ─── Two-column row ─── */
.wr-row { display: flex; gap: 20px; align-items: flex-start; }
.wr-row-action { flex: 1; min-width: 0; }
.wr-row-guide {
    width: 260px; flex-shrink: 0; font-size: 13px; color: #757575;
    line-height: 1.6; border-left: 1px solid #f0f0f0; padding-left: 20px;
}
.wr-row-guide a { font-weight: 500; }
.wr-guide-title {
    font-size: 11px; font-weight: 700; color: #50575e;
    text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}

/* ─── Sub text ─── */
.wr-sub { font-size: 13px; color: #757575; line-height: 1.6; margin-bottom: 14px; }

/* ─── Notice ─── */
.wr-notice {
    display: flex; gap: 8px; padding: 8px 12px; border-radius: 4px;
    font-size: 12px; line-height: 1.5; margin-bottom: 10px; align-items: flex-start;
}
.wr-notice svg { flex-shrink: 0; margin-top: 1px; }
.wr-notice p { margin: 0; }
.wr-notice--info { background: #f0f6fc; border: 1px solid #c3d4e6; }
.wr-notice--warning { background: #fcf9e8; border: 1px solid #e0c850; }

/* ─── Tooltip ─── */
.wr-tooltip-wrap {
    position: relative; display: inline;
    color: #2271b1; border-bottom: 1px dashed #2271b1; cursor: help; font-style: normal;
}
.wr-tooltip-box {
    visibility: hidden; opacity: 0;
    position: absolute; bottom: calc(100% + 8px); left: 0;
    width: 320px; padding: 10px 12px;
    background: #1d2327; color: #f0f0f1; font-size: 12px; line-height: 1.6;
    border-radius: 4px; font-style: normal; font-weight: 400;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    transition: opacity .15s, visibility .15s; z-index: 100001;
}
.wr-tooltip-box::after {
    content: ""; position: absolute; top: 100%; left: 20px;
    border-width: 6px; border-style: solid;
    border-color: #1d2327 transparent transparent transparent;
}
.wr-tooltip-wrap:hover .wr-tooltip-box { visibility: visible; opacity: 1; }

/* ─── Buttons (high specificity to override WooCommerce admin) ─── */
.wr-page .btn,
.wr-page input[type="submit"].btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 14px; font-size: 13px; line-height: 1.8;
    border: 1px solid #2271b1 !important; border-radius: 4px; cursor: pointer;
    text-decoration: none !important; white-space: nowrap; font-family: inherit;
    background-image: none !important; box-shadow: none !important;
}
.wr-page .btn--primary,
.wr-page input[type="submit"].btn--primary {
    background: #2271b1 !important; color: #fff !important;
}
.wr-page .btn--primary:hover,
.wr-page input[type="submit"].btn--primary:hover {
    background: #135e96 !important; color: #fff !important;
}
.wr-page .btn--secondary,
.wr-page input[type="submit"].btn--secondary {
    background: #f6f7f7 !important; color: #2271b1 !important;
}
.wr-page .btn--secondary:hover,
.wr-page input[type="submit"].btn--secondary:hover {
    background: #f0f0f1 !important;
}
.wr-page .btn--small,
.wr-page input[type="submit"].btn--small {
    padding: 4px 10px; font-size: 12px; line-height: 1.6;
}

/* ─── Messages ─── */
.wr-msg {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 3px;
}
.wr-msg--ok { background: #edfaef; color: #00822b; }
.wr-msg--err { background: #fcf0f1; color: #d63638; }
.wr-msg--warn { background: #fcf9e8; color: #9d7600; }

/* ─── API Key ─── */
.wr-api-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.wr-api-row input[type="text"] {
    padding: 5px 10px; font-size: 13px; border: 1px solid #8c8f94;
    border-radius: 4px; width: 280px; outline: none;
}
.wr-api-row input[type="text"]:focus { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; }
.wr-connect-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.wr-connect-label { font-size: 13px; font-weight: 500; }
.wr-api-section { border-top: 1px solid #f0f0f0; padding-top: 12px; }
.wr-api-label { font-size: 12px; font-weight: 600; color: #50575e; display: block; margin-bottom: 4px; }
.wr-api-label .wiserrw_required_star { color: #d63638; }
.wr-api-links { font-size: 12px; color: #757575; line-height: 1.8; margin-top: 2px; }

/* ─── Widget Row ─── */
.wr-widget-row { display: flex; align-items: stretch; border-bottom: 1px solid #f0f0f0; }
.wr-widget-row:last-child { border-bottom: none; }
.wr-widget-thumb-side {
    width: 160px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    border-right: 1px solid #f0f0f0; overflow: hidden;
}
.wr-widget-thumb-side img { max-width: 85%; max-height: 90px; object-fit: contain; }
.wr-widget-main { flex: 1; padding: 16px 20px; display: flex; gap: 20px; }
.wr-widget-action { flex: 1; min-width: 0; }
.wr-widget-title { font-size: 13px; font-weight: 600; color: #1d2327; margin-bottom: 3px; }
.wr-widget-desc { font-size: 12px; color: #757575; line-height: 1.5; margin-bottom: 8px; }
.wr-widget-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wr-customize { font-size: 12px; color: #2271b1; font-weight: 500; text-decoration: none; }
.wr-customize:hover { text-decoration: underline; }
.wr-widget-sc-note { font-size: 12px; color: #757575; font-style: italic; margin-top: 6px; display: block; }
.wr-widget-guide {
    width: 260px; flex-shrink: 0; border-left: 1px solid #f0f0f0;
    padding-left: 20px; font-size: 12px; color: #757575; line-height: 1.6;
}
.wr-widget-guide strong { color: #50575e; }
.wr-more-widgets-note {
    padding: 14px 20px; border-top: 1px solid #f0f0f0;
    font-size: 12px; color: #757575; line-height: 1.6;
}

/* ─── Star Rating combined ─── */
.wr-rating-sub-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.wr-rating-sub-row + .wr-rating-sub-row { border-top: 1px dashed #eee; }
.wr-rating-name { font-size: 13px; font-weight: 600; color: #1d2327; }

/* ─── Feature rows ─── */
.wr-feature-row { display: flex; gap: 20px; padding: 14px 0; border-bottom: 1px solid #f0f0f0; align-items: flex-start; }
.wr-feature-row:last-child { border-bottom: none; }
.wr-feature-action { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: flex-start; }
.wr-fname { font-size: 14px; font-weight: 600; color: #1d2327; margin-bottom: 3px; }
.wr-fdesc { font-size: 12px; color: #757575; font-style: italic; line-height: 1.5; margin-bottom: 4px; }
.wr-feature-guide {
    width: 260px; flex-shrink: 0; border-left: 1px solid #f0f0f0;
    padding-left: 20px; font-size: 12px; color: #757575; line-height: 1.6;
}

/* ─── Tabs ─── */
.wr-tabs { display: inline-flex; gap: 0; margin-bottom: 14px; }
.wr-tab {
    padding: 6px 16px; font-size: 13px; font-weight: 500; cursor: pointer;
    border: 1px solid #c3c4c7; background: #fff; color: #50575e; transition: all .15s;
}
.wr-tab:first-child { border-radius: 4px 0 0 4px; }
.wr-tab:last-child { border-radius: 0 4px 4px 0; margin-left: -1px; }
.wr-tab.active { background: #2271b1; color: #fff; border-color: #2271b1; z-index: 1; position: relative; }
.wr-order-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wr-order-row select,
.wr-order-row input[type="date"] { padding: 4px 8px; font-size: 13px; border: 1px solid #8c8f94; border-radius: 4px; }
.wr-order-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

/* ─── Actions bar ─── */
.wr-actions-bar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
    padding: 12px 20px; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px;
}
.wr-actions-bar-label { font-size: 13px; color: #757575; }

/* ─── URL input ─── */
.wr-url-input {
    width: 100%; max-width: 380px; padding: 5px 10px; font-size: 12px;
    border: 1px solid #8c8f94; border-radius: 4px; outline: none; margin-bottom: 3px;
}
.wr-url-input:focus { border-color: #2271b1; box-shadow: 0 0 0 1px #2271b1; }

/* ─── Shortcode (new design) ─── */
.wr-sc {
    display: inline-flex; align-items: center; gap: 3px;
    background: #f6f7f7; border: 1px solid #ddd; border-radius: 3px;
    padding: 2px 6px; font-size: 11px; font-family: Consolas, Monaco, monospace;
    color: #50575e; cursor: pointer; transition: border-color .15s; white-space: nowrap;
}
.wr-sc:hover { border-color: #2271b1; }
.wr-sc-copied { display: none; font-size: 10px; color: #00a32a; font-weight: 600; margin-left: 4px; }

/* ─── Note ─── */
.wr-note { font-size: 12px; color: #757575; font-style: italic; line-height: 1.5; margin-top: 8px; }

/* ─── CSS order for visual section reordering ─── */
.wr-order-1 { order: 1; }
.wr-order-2 { order: 2; }
.wr-order-3 { order: 3; }
.wr-order-4 { order: 4; }
.wr-order-5 { order: 5; }
.wr-order-6 { order: 6; }
.wr-order-7 { order: 7; }
.wr-order-8 { order: 8; }

/* ─── FAQ ───
 * !important is used on every visual property because <summary> /
 * <details> elements are styled by browser defaults AND by many
 * WordPress admin themes that target 'summary' and 'details' globally
 * (e.g., to format core WP "Help" tabs or theme info panels). Without
 * !important, the default browser disclosure triangle (▶) shows and
 * our '+' / '−' marker is overridden by the theme's specificity.
 */
.wr-faq-item {
    border-bottom: 1px solid #f0f0f0 !important;
    padding: 0 !important;
    background: transparent !important;
}
.wr-faq-item:last-child { border-bottom: none !important; }
.wr-faq-q {
    padding: 14px 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1d2327 !important;
    cursor: pointer !important;
    list-style: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}
.wr-faq-q::-webkit-details-marker { display: none !important; }
.wr-faq-q::marker { content: "" !important; }
.wr-faq-q::after {
    content: "+" !important;
    font-size: 18px !important;
    font-weight: 400 !important;
    color: #757575 !important;
    flex-shrink: 0 !important;
    margin-left: 12px !important;
    transition: transform .2s !important;
}
details[open] > .wr-faq-q::after {
    content: "\2212" !important;
}
.wr-faq-q:hover { background: #fafafa !important; }
.wr-faq-a {
    padding: 0 20px 16px !important;
    font-size: 13px !important;
    color: #50575e !important;
    line-height: 1.7 !important;
}
.wr-faq-a p { margin: 0 0 10px !important; }
.wr-faq-a p:last-child { margin-bottom: 0 !important; }
.wr-faq-a ul { margin: 6px 0 10px 18px !important; padding: 0 !important; }
.wr-faq-a li { margin-bottom: 4px !important; }
.wr-faq-a a { font-weight: 500 !important; }

/* ═══════════════════════════════════════════════════════════════
   EXISTING FUNCTIONAL CLASSES (preserved for JS compatibility)
   ═══════════════════════════════════════════════════════════════ */

/* Toggle Switch (JS targets .wiserrw_toggle input[type='checkbox'])
 * !important is used on every visual property because '.switch' and
 * '.slider' are extremely generic class names — theme stylesheets,
 * Bootstrap-based admin themes, and other plugins (carousels, form
 * switches) frequently define their own '.switch' / '.slider' rules
 * with higher specificity. Forcing our values prevents the toggle
 * from rendering as a crescent / collapsed circle on those stores.
 */
.wiserrw_toggle { position: relative !important; display: inline-block !important; }
.wiserrw_toggle .switch {
    position: relative !important;
    display: inline-block !important;
    width: 40px !important;
    height: 25px !important;
}
.wiserrw_toggle .switch input { opacity: 0 !important; width: 0 !important; height: 0 !important; }
.wiserrw_toggle .slider {
    position: absolute !important;
    cursor: pointer !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    background-color: #ccc !important;
    transition: .4s !important;
}
.wiserrw_toggle .slider:before {
    position: absolute !important;
    content: "" !important;
    height: 15px !important;
    width: 15px !important;
    left: 5px !important;
    bottom: 5px !important;
    background-color: white !important;
    transition: .4s !important;
}
.wiserrw_toggle input:checked + .slider { background-color: #2271b1 !important; }
.wiserrw_toggle input:focus + .slider { box-shadow: 0 0 1px #2271b1 !important; }
.wiserrw_toggle input:checked + .slider:before { transform: translateX(15px) !important; }
.wiserrw_toggle input:disabled + .slider { opacity: .45 !important; cursor: not-allowed !important; }
.wiserrw_toggle .slider.round { border-radius: 34px !important; }
.wiserrw_toggle .slider.round:before { border-radius: 50% !important; }

/* Tooltip (JS: .wiserrw_toggle:hover .wiserrw-tooltip) */
.wiserrw-tooltip {
    visibility: hidden; opacity: 0; background-color: #333; color: #fff;
    text-align: center; border-radius: 5px; padding: 6px 8px; font-size: 12px;
    position: absolute; z-index: 100001; bottom: 125%; left: 50%;
    transform: translateX(-50%); transition: opacity 0.2s; white-space: nowrap;
}
.wiserrw-tooltip::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid;
    border-color: #333 transparent transparent transparent;
}
.wiserrw_toggle:hover .wiserrw-tooltip { visibility: visible; opacity: 1; }

/* Shortcode copy (JS: .wiserrw_copy_shortcode, .wiserrw_copied, .wiserrw_shortcode_input) */
.wiserrw_copy_shortcode_wrapper { display: inline-flex; align-items: center; gap: 6px; }
.wiserrw_shortcode_input {
    border: 1px solid #ddd !important; background: #f6f7f7 !important;
    font-family: Consolas, Monaco, monospace !important; font-size: 11px !important;
    color: #50575e !important; width: auto !important; max-width: 220px !important;
    padding: 3px 6px !important; border-radius: 3px !important;
    box-shadow: none !important; outline: none !important;
}
.wiserrw_copy_shortcode {
    cursor: pointer; color: #2271b1; font-size: 16px !important; transition: color .15s;
}
.wiserrw_copy_shortcode:hover { color: #135e96; }
.wiserrw_copied { display: none; font-size: 11px; color: #00a32a; font-weight: 600; }

/* Duration/Range containers (JS: .wiserrw_duration_type_range, .wiserrw_duration_type_duration) */
.wiserrw_duration_type_range,
.wiserrw_duration_type_duration { margin-top: 12px; }
.wiserrw_duration_type_range { display: none; }

/* Count display */
.wiserrw_count { font-weight: 600; color: #2271b1; margin: 6px 0; }

/* Progress (JS: #export-progress) */
.wiserrw_progress_wrap { margin-top: 10px; opacity: 0; }
.wiserrw_progress_bar { width: 250px; }

/* Sync/Reset response containers */
.wiserrw_sych_response,
.wiserrw_reset_response { margin-top: 10px; }
.wiserrw_sych_response .notice,
.wiserrw_reset_response .notice {
    padding: 8px 12px; background: #f0f6fc;
    border-left: 4px solid #2271b1; border-radius: 4px; font-size: 13px;
}

/* API Key Input States (JS: #wiserrw_api_key) */
#wiserrw_api_key { transition: all 0.3s ease; }
#wiserrw_api_key.wiserrw-api-verified {
    border-color: #00a32a !important; box-shadow: 0 0 0 1px #00a32a !important;
    background-color: #f0f9ff !important;
}
#wiserrw_api_key.error {
    border-color: #d63638 !important; box-shadow: 0 0 0 1px #d63638 !important;
    background-color: #fff8f8 !important;
}
#wiserrw_api_key:focus { outline: none; }

/* Validation messages (JS: #api_error, #api_success) */
#api_error {
    display: block; margin-top: 8px; padding: 8px 12px;
    background: #fff8f8; border-left: 4px solid #d63638; border-radius: 4px;
    color: #d63638; font-size: 13px;
}
#api_success {
    display: block; margin-top: 8px; padding: 8px 12px;
    background: #f0f9ff; border-left: 4px solid #00a32a; border-radius: 4px;
    color: #00a32a; font-size: 13px;
    animation: wiserrw_fadeOut 6s ease-in-out forwards;
}
@keyframes wiserrw_fadeOut {
    0%, 83.33% { opacity: 1; }
    100% { opacity: 0; }
}

/* Review Form URL status */
#wiserrw_review_form_url_status { margin-top: 5px; font-size: 12px; font-weight: 500; }
.wiserrw_url_ok { color: #00a32a; }
.wiserrw_url_warn { color: #dba617; }
.wiserrw_url_ok .dashicons,
.wiserrw_url_warn .dashicons { font-size: 14px; vertical-align: middle; }

/* Frontend: Inline review link (enqueued separately via wp_add_inline_style) */

/* ─── Responsive ─── */
@media (max-width: 860px) {
    .wr-header-inner { flex-wrap: wrap; gap: 8px; }
    .wr-row, .wr-widget-main { flex-direction: column; }
    .wr-row-guide, .wr-widget-guide, .wr-feature-guide {
        width: auto !important; border-left: none; padding-left: 0;
        border-top: 1px solid #f0f0f0; padding-top: 10px; margin-top: 10px;
    }
    .wr-widget-thumb-side { width: 100px; }
    .wr-api-row { flex-direction: column; }
    .wr-api-row input[type="text"] { width: 100%; }
    .wr-url-input { max-width: 100%; }
}
