/**
 * Vendco Reviews - Frontend Stylesheet
 * Strict adherence to Vendco's visual specification and RTL rules.
 * No external UI libraries or dependencies.
 */

:root {
    --vendco-primary: #b11116;
    --vendco-card-bg: #ffffff;
    --vendco-radius: 10px;
}

/* Master Section Wrapper */
.vendco-reviews-section {
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    margin: 40px 0;
    padding: 0;
    font-family: inherit;
    clear: both;
}

.vendco-reviews-section *,
.vendco-reviews-section *::before,
.vendco-reviews-section *::after {
    box-sizing: border-box;
}

/* Section Header */
.vendco-section-header {
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid #ebebeb;
}

.vendco-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.vendco-section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1f1f1f;
    line-height: 1.4;
}

.vendco-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    background-color: #fceeee;
    color: var(--vendco-primary);
    border-radius: 20px;
    line-height: 1.4;
}

.vendco-section-subtitle {
    margin: 6px 0 0;
    font-size: 13.5px;
    color: #777777;
    line-height: 1.6;
}

/* -------------------------------------------------------------
 * EXACT REVIEW CARD DESIGN (Section 5 Reference Specification)
 * ----------------------------------------------------------- */

/* Review list: RTL layout, Vertical flex layout, 16px gap, 24px vertical margin */
.vendco-review-list {
    direction: rtl;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 24px 0;
    padding: 0;
    list-style: none;
    font-family: inherit;
}

/* Review card */
.vendco-review {
    position: relative;
    background: var(--vendco-card-bg, #ffffff);
    border: 1px solid #e9e9e9;
    border-right: 4px solid var(--vendco-primary, #b11116);
    border-radius: var(--vendco-radius, 12px);
    padding: 30px 32px 24px;
    min-height: 185px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.035);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    overflow: hidden;
}

.vendco-review:hover {
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.065);
    transform: translateY(-2px);
}

/* Decorative quotation mark: upper-left corner (in RTL), red, Georgia font, 60px, opacity .16 */
.vendco-review-quote {
    position: absolute;
    top: 12px;
    left: 24px;
    color: var(--vendco-primary, #b11116);
    font-family: Georgia, serif;
    font-size: 60px;
    line-height: 1;
    opacity: 0.16;
    user-select: none;
    pointer-events: none;
}

/* Review body */
.vendco-review-text {
    color: #353535;
    font-size: 15.5px;
    line-height: 2.25;
    font-weight: 400;
    word-break: break-word;
    overflow-wrap: break-word;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Review footer */
.vendco-review-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

/* Source icon */
.vendco-review-source-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 8px;
    background: #f8eeee;
    color: var(--vendco-primary, #b11116);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vendco-review-source-wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

/* Source label */
.vendco-review-source-label {
    font-size: 11px;
    color: #999999;
    line-height: 1.2;
}

/* Source name */
.vendco-review-source {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    font-weight: 600;
    color: #555555;
    line-height: 1.4;
    margin-top: 2px;
}

.vendco-review-source-text {
    color: #444444;
}

.vendco-review-source-link {
    color: var(--vendco-primary, #b11116);
    text-decoration: none;
    transition: color 0.2s ease;
}

.vendco-review-source-link:hover {
    text-decoration: underline;
    color: #8c0c10;
}

.vendco-review-exp-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 1px 7px;
    background-color: #f1f1f1;
    color: #666666;
    border-radius: 4px;
}

.vendco-review-date {
    font-size: 11.5px;
    color: #a0a0a0;
    margin-right: auto;
}

/* -------------------------------------------------------------
 * MOBILE BREAKPOINT (<= 600px)
 * ----------------------------------------------------------- */
@media screen and (max-width: 600px) {
    .vendco-reviews-section {
        margin-left: 5px !important;
        margin-right: 5px !important;
    }

    .vendco-review {
        padding: 24px 20px 20px;
        min-height: 165px;
        border-radius: 10px;
    }

    .vendco-review-text {
        font-size: 14.5px;
        line-height: 2.1;
        margin-bottom: 16px;
    }

    .vendco-review-quote {
        font-size: 48px;
        top: 8px;
        left: 14px;
    }

    .vendco-section-title {
        font-size: 18px;
    }
}

/* -------------------------------------------------------------
 * EMPTY STATE
 * ----------------------------------------------------------- */
.vendco-empty-state {
    text-align: center;
    padding: 36px 20px;
    background: #fafafa;
    border: 1px dashed #dcdcdc;
    border-radius: 8px;
    margin: 16px 0;
}

.vendco-empty-icon {
    margin-bottom: 12px;
}

.vendco-empty-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
}

.vendco-empty-desc {
    margin: 0;
    font-size: 13.5px;
    color: #777777;
    line-height: 1.6;
}

/* -------------------------------------------------------------
 * PAGINATION / LOAD MORE
 * ----------------------------------------------------------- */
.vendco-load-more-wrap {
    text-align: center;
    margin: 20px 0 30px;
}

.vendco-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #dcdcdc;
    color: #333333;
    padding: 10px 24px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 40px;
}

.vendco-load-more-btn:hover {
    border-color: var(--vendco-primary, #b11116);
    color: var(--vendco-primary, #b11116);
    background: #fffafa;
}

.vendco-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* -------------------------------------------------------------
 * REVIEW SUBMISSION FORM
 * ----------------------------------------------------------- */
.vendco-section-form-wrap {
    margin-top: 36px;
}

.vendco-form-wrapper {
    background: #ffffff;
    border: 1px solid #e9e9e9;
    border-radius: 10px;
    padding: 24px 28px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.vendco-form-header {
    margin-bottom: 20px;
}

.vendco-form-title {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: #222222;
}

.vendco-form-desc {
    margin: 0;
    font-size: 13px;
    color: #888888;
}

.vendco-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}

@media screen and (max-width: 600px) {
    .vendco-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .vendco-form-wrapper {
        padding: 20px 16px;
    }
}

.vendco-field-group {
    margin-bottom: 16px;
}

.vendco-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #444444;
}

.vendco-required {
    color: var(--vendco-primary, #b11116);
    margin-right: 3px;
}

.vendco-optional {
    font-size: 11.5px;
    font-weight: normal;
    color: #999999;
    margin-right: 4px;
}

select {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    direction: rtl;
    text-align: right;
    line-height: normal;
}

select option {
    background-color: #ffffff;
    color: #222222;
    padding: 8px 12px;
    direction: rtl;
    text-align: right;
}

.vendco-input,
.vendco-select,
.vendco-textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 12px 16px;
    font-size: 13.5px;
    font-family: inherit;
    color: #222222;
    background-color: #fbfbfb;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    outline: none;
}

.vendco-input,
.vendco-select {
    height: 48px;
    min-height: 48px;
}

.vendco-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    direction: rtl;
    text-align: right;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 14px center;
    background-size: 16px;
    padding-left: 38px;
    padding-right: 14px;
    cursor: pointer;
}

/* Custom Dropdown for Mac & Cross-Platform Reliability */
.vendco-custom-dropdown {
    position: relative;
    width: 100%;
}

.vendco-dropdown-trigger {
    width: 100%;
    height: 48px;
    padding: 12px 14px 12px 38px;
    background-color: #fbfbfb;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    font-size: 13.5px;
    font-family: inherit;
    color: #222222;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.vendco-dropdown-trigger:hover,
.vendco-dropdown-trigger:focus,
.vendco-custom-dropdown.is-open .vendco-dropdown-trigger {
    background-color: #ffffff;
    border-color: var(--vendco-primary, #b11116);
    box-shadow: 0 0 0 3px rgba(177, 17, 22, 0.12);
}

.vendco-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    padding: 6px 0;
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    direction: rtl;
}

.vendco-dropdown-item {
    width: 100%;
    padding: 10px 16px;
    text-align: right;
    font-size: 13.5px;
    color: #333333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.vendco-dropdown-item:hover,
.vendco-dropdown-item:focus {
    background-color: #fef2f2;
    color: var(--vendco-primary, #b11116);
}

.vendco-dropdown-item.is-selected {
    background-color: #fef2f2;
    color: var(--vendco-primary, #b11116);
    font-weight: 700;
}

.vendco-input:focus,
.vendco-select:focus,
.vendco-textarea:focus {
    background-color: #ffffff;
    border-color: var(--vendco-primary, #b11116);
    box-shadow: 0 0 0 3px rgba(177, 17, 22, 0.12);
}

.vendco-textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.8;
}

.vendco-field-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 11.5px;
    color: #999999;
}

.vendco-field-hint-sub {
    display: block;
    font-size: 11px;
    color: #888888;
    margin-top: 4px;
}

/* Anti-Spam Captcha */
.vendco-captcha-group {
    margin-top: 6px;
    margin-bottom: 16px;
}

.vendco-captcha-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.vendco-captcha-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f7f9fa;
    border: 1px solid #d5dfe6;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 13.5px;
    user-select: none;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.015) 10px, rgba(0,0,0,0.015) 20px);
}

.vendco-captcha-label {
    font-size: 11.5px;
    color: #666;
    font-weight: 500;
}

.vendco-captcha-equation {
    font-size: 15px;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: 1px;
    direction: rtl;
}

.vendco-captcha-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    color: #475569;
    padding: 0;
    transition: all 0.2s ease;
}

.vendco-captcha-refresh-btn:hover {
    color: var(--vendco-primary, #b11116);
    border-color: var(--vendco-primary, #b11116);
    transform: rotate(45deg);
}

.vendco-captcha-refresh-btn.is-spinning svg {
    animation: vendco-spin 0.6s linear infinite;
}

.vendco-captcha-input-wrap {
    width: 140px;
    min-width: 120px;
}

.vendco-captcha-input {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
}

.vendco-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.vendco-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--vendco-primary, #b11116);
    color: #ffffff;
    border: none;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    min-height: 44px;
}

.vendco-submit-btn:hover {
    background-color: #930d11;
}

.vendco-submit-btn:active {
    transform: translateY(1px);
}

.vendco-submit-btn:disabled {
    background-color: #c77b7e;
    cursor: not-allowed;
}

/* Spinner */
.vendco-spinner,
.vendco-load-more-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: vendco-spin 0.7s linear infinite;
    display: inline-block;
}

.vendco-load-more-spinner {
    border-color: rgba(177, 17, 22, 0.2);
    border-top-color: var(--vendco-primary, #b11116);
}

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

/* Inline feedback messages */
.vendco-form-feedback {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13.5px;
    line-height: 1.6;
    margin-bottom: 18px;
}

.vendco-form-feedback.is-success {
    background-color: #eef7ee;
    color: #276729;
    border: 1px solid #cce5cc;
}

.vendco-form-feedback.is-error {
    background-color: #fdf0f0;
    color: #b11116;
    border: 1px solid #fad2d3;
}

/* Instagram-style Instant Comment Pop-in Animation */
@keyframes vendcoInstagramPopIn {
    0% {
        opacity: 0;
        transform: translateY(-24px) scale(0.95);
        background-color: #fef2f2;
        box-shadow: 0 0 0 3px rgba(177, 17, 22, 0.4);
    }
    45% {
        opacity: 1;
        transform: translateY(2px) scale(1.01);
        background-color: #fff7f7;
        box-shadow: 0 0 0 4px rgba(177, 17, 22, 0.2);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        background-color: var(--vendco-card-bg, #ffffff);
        box-shadow: 0 3px 14px rgba(0, 0, 0, 0.025);
    }
}

.vendco-review.vendco-newly-added {
    animation: vendcoInstagramPopIn 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border-right-color: #b11116;
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .vendco-review,
    .vendco-submit-btn,
    .vendco-load-more-btn {
        transition: none !important;
        transform: none !important;
    }
    .vendco-spinner,
    .vendco-load-more-spinner {
        animation: none !important;
    }
}

/* -------------------------------------------------------------
 * AVATAR SELECTOR & CARD DISPLAY
 * ----------------------------------------------------------- */
.vendco-avatar-group {
    margin-bottom: 18px;
}

.vendco-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.vendco-avatar-option {
    cursor: pointer;
    position: relative;
    user-select: none;
    display: block;
}

.vendco-avatar-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.vendco-avatar-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.vendco-avatar-box:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.vendco-avatar-option input[type="radio"]:checked + .vendco-avatar-box {
    border-color: var(--vendco-primary, #b11116);
    background: #fef2f2;
    box-shadow: 0 0 0 2px rgba(177, 17, 22, 0.12);
}

.vendco-avatar-icon {
    font-size: 18px;
    line-height: 1;
}

.vendco-avatar-title {
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    line-height: 1.3;
}

/* Avatar inside Review Card Footer */
.vendco-review-avatar-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    flex-shrink: 0;
}

.vendco-avatar-circle-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    font-size: 16px;
}

.vendco-avatar-circle-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}
