/* SA Review System — Frontend Styles */

/* ── Catalog rating ─────────────────────────── */
.sa-catalog-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0 6px;
    font-size: 14px;
}
.sa-star-full  { color: #FFB800 !important; }
.sa-star-half  { color: #FFB800 !important; opacity: .6; }
.sa-star-empty { color: #FFB800 !important; opacity: .25; }
.sa-catalog-count { color: #6b7280; font-size: 12px; }

/* ── Rating summary ─────────────────────────── */
.sa-rating-summary {
    display: flex;
    gap: 24px;
    align-items: center;
    background: #fffbf0;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 18px 22px;
    margin: 16px 0 24px;
    flex-wrap: wrap;
}
.sa-rating-big {
    text-align: center;
    min-width: 90px;
}
.sa-rating-number {
    display: block;
    font-size: 48px;
    font-weight: 800;
    color: #1f2937;
    line-height: 1;
}
.sa-rating-stars-big { font-size: 22px; margin: 4px 0; }
.sa-rating-stars-big .sa-star-full,
.sa-review-stars .sa-star-full  { color: #FFB800 !important; }
.sa-rating-stars-big .sa-star-half,
.sa-review-stars .sa-star-half  { color: #FFB800 !important; opacity: .6; }
.sa-rating-stars-big .sa-star-empty,
.sa-review-stars .sa-star-empty { color: #FFB800 !important; opacity: .25; }
.sa-rating-count { font-size: 13px; color: #6b7280; }

.sa-rating-bars { flex: 1; min-width: 200px; }
.sa-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 13px;
}
.sa-bar-label { width: 28px; color: #f59e0b; text-align: right; }
.sa-bar-track {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
.sa-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFB800, #FFD54F);
    border-radius: 4px;
    transition: width .6s ease;
}
.sa-bar-count { width: 24px; color: #6b7280; font-size: 12px; }
.sa-bar-label { width: 28px; color: #FFB800 !important; text-align: right; font-size: 12px; font-weight: 700; }

/* ── Reviews section ────────────────────────── */
.sa-reviews-section { margin: 40px 0; }
.sa-reviews-title {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f3f4f6;
}

.sa-reviews-grid { display: grid; gap: 16px; }

.sa-review-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    transition: box-shadow .2s;
}
.sa-review-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.09); }

.sa-review-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.sa-reviewer-avatar {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    border-radius: 50%;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px;
    flex-shrink: 0;
}
.sa-reviewer-info { flex: 1; }
.sa-reviewer-name { display: block; font-weight: 700; color: #1f2937; }
.sa-reviewer-city { font-size: 12px; color: #6b7280; }
.sa-review-meta   { text-align: right; }
.sa-review-stars  { font-size: 16px; }
.sa-review-date   { font-size: 11px; color: #9ca3af; display: block; }

.sa-review-text {
    color: #374151;
    line-height: 1.6;
    margin: 0 0 12px;
    font-size: 14px;
}

.sa-review-photos { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.sa-review-photo  {
    width: 72px; height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: transform .2s;
}
.sa-review-photo:hover { transform: scale(1.05); }

.sa-review-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.sa-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.sa-badge-verified { background: #dcfce7; color: #166534; }
.sa-badge-purchase { background: #dbeafe; color: #1e40af; }
.sa-badge-photo    { background: #fce7f3; color: #9d174d; }

/* ── Submit form ────────────────────────────── */
.sa-submit-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 28px;
    margin: 32px 0;
}
.sa-submit-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
}

.sa-form-group { margin-bottom: 16px; }
.sa-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.sa-required { color: #ef4444; }

.sa-form-group input[type="text"],
.sa-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}
.sa-form-group input:focus,
.sa-form-group textarea:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249,115,22,.1);
    outline: none;
}
.sa-form-group textarea { resize: vertical; }

/* Star picker */
.sa-star-picker { display: flex; gap: 6px; cursor: pointer; }
.sa-star-pick {
    font-size: 32px;
    color: #d1d5db;
    transition: color .15s, transform .15s;
    user-select: none;
}
.sa-star-pick:hover,
.sa-star-pick.active { color: #f59e0b; transform: scale(1.15); }

.sa-btn-submit {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    display: inline-block;
}
.sa-btn-submit:hover { opacity: .9; transform: translateY(-1px); }
.sa-btn-submit:disabled { opacity: .6; cursor: not-allowed; }

#sa-form-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}
#sa-form-message.success { background: #dcfce7; color: #166534; display: block; }
#sa-form-message.error   { background: #fee2e2; color: #991b1b; display: block; }

/* ── My Account Orders column ───────────────── */
.sa-order-review-btns { display: flex; flex-direction: column; gap: 8px; }

.sa-review-item, .sa-review-item-done {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sa-review-thumb-wrap { flex-shrink: 0; }
.sa-review-thumb {
    width: 40px; height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}
.sa-review-thumb-placeholder {
    width: 40px; height: 40px;
    background: #f3f4f6;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

.sa-btn-open-review {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    white-space: nowrap;
}
.sa-btn-open-review:hover { opacity: .88; transform: translateY(-1px); }

.sa-reviewed-badge {
    background: #dcfce7;
    color: #166534;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.sa-review-na { color: #9ca3af; font-size: 13px; }

/* ── Modal ──────────────────────────────────── */
.sa-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
    animation: saFadeIn .2s ease;
}
@keyframes saFadeIn { from { opacity: 0; } to { opacity: 1; } }

.sa-modal-box {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: saSlideUp .25s ease;
}
@keyframes saSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.sa-modal-close {
    position: absolute;
    top: 14px; right: 14px;
    background: #f3f4f6;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
    z-index: 1;
}
.sa-modal-close:hover { background: #e5e7eb; }

.sa-modal-product-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 22px 16px;
    border-bottom: 1px solid #f3f4f6;
}
.sa-modal-thumb {
    width: 56px; height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}
.sa-modal-label { font-size: 11px; color: #9ca3af; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.sa-modal-product-name { font-size: 15px; font-weight: 700; color: #1f2937; line-height: 1.3; }

.sa-modal-body { padding: 20px 22px 24px; }

.sa-mform-group { margin-bottom: 16px; }
.sa-mform-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
}
.sa-req { color: #ef4444; }

.sa-mform-group textarea,
.sa-mform-group input[type="file"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
    resize: vertical;
}
.sa-mform-group textarea:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249,115,22,.1);
    outline: none;
}

/* Star picker (modal) */
.sa-star-picker { display: flex; gap: 6px; }
.sa-star-pick {
    font-size: 34px;
    color: #d1d5db;
    cursor: pointer;
    transition: color .12s, transform .12s;
    user-select: none;
    line-height: 1;
}
.sa-star-pick:hover,
.sa-star-pick.active { color: #f59e0b; transform: scale(1.2); }

#sa-modal-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}
#sa-modal-message.success { background: #dcfce7; color: #166534; display: block; }
#sa-modal-message.error   { background: #fee2e2; color: #991b1b; display: block; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 600px) {
    .sa-rating-summary { flex-direction: column; }
    .sa-review-header  { flex-wrap: wrap; }
    .sa-review-meta    { text-align: left; }
    .sa-modal-box      { border-radius: 16px; }
}

/* ── Toast Popup ────────────────────────────── */
#sa-toast-container {
    position: fixed;
    bottom: 24px;
    left: 20px;
    z-index: 99990;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
    max-width: 300px;
}

.sa-toast {
    background: #FFFFFF;
    border: 1px solid #E8D5B0;
    border-left: 4px solid #7B1F1F;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 8px 28px rgba(44,16,16,.18);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    cursor: default;
    animation: saToastIn .35s cubic-bezier(.34,1.56,.64,1);
    max-width: 300px;
}

.sa-toast.sa-toast-out {
    animation: saToastOut .3s ease forwards;
}

@keyframes saToastIn {
    from { transform: translateX(-110%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}
@keyframes saToastOut {
    from { transform: translateX(0);     opacity: 1; }
    to   { transform: translateX(-110%); opacity: 0; }
}

.sa-toast-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7B1F1F, #5A1515);
    color: #E2C170;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
}

.sa-toast-body { flex: 1; min-width: 0; }

.sa-toast-name {
    font-weight: 800;
    font-size: 13px;
    color: #2C1010;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sa-toast-city {
    font-size: 11px;
    color: #A07070;
    margin-bottom: 3px;
}

.sa-toast-product {
    font-size: 12px;
    color: #6B3030;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.sa-toast-stars { font-size: 12px; color: #C9A84C; letter-spacing: 1px; }

.sa-toast-time {
    font-size: 10px;
    color: #C9A84C;
    font-weight: 700;
    flex-shrink: 0;
    text-align: right;
    line-height: 1.3;
}

.sa-toast-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    font-size: 11px;
    color: #A07070;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    display: none;
}
.sa-toast:hover .sa-toast-close { display: block; }

@media (max-width: 480px) {
    #sa-toast-container {
        bottom: 16px;
        left: 12px;
        right: 12px;
        max-width: none;
    }
    .sa-toast { max-width: 100%; }
}

/* ── Order Review Section (Hook 3 & 4) ──────── */
.sa-pending-review-section,
.sa-order-detail-review {
    margin: 32px 0;
    padding: 20px;
    background: #FDF8EE;
    border: 1px solid #E8D5B0;
    border-radius: 14px;
}

.sa-review-section-heading {
    font-size: 17px;
    font-weight: 800;
    color: #7B1F1F;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #E8D5B0;
}

.sa-order-review-block {
    margin-bottom: 20px;
}

.sa-order-review-label {
    font-size: 12px;
    color: #A07070;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.sa-review-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #2C1010;
    flex: 1;
    line-height: 1.3;
}

.sa-review-item,
.sa-review-item-done {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #F0E4C8;
}
.sa-review-item:last-child,
.sa-review-item-done:last-child {
    border-bottom: none;
}

/* ── Rating summary clickable anchor ────────── */
.sa-rating-anchor {
    text-decoration: none;
    display: block;
}
.sa-rating-anchor:hover .sa-rating-number { color: #7B1F1F; }
.sa-rating-anchor:hover .sa-rating-stars-big { opacity: .8; }

.sa-rating-cta {
    display: block;
    font-size: 11px;
    color: #7B1F1F;
    font-weight: 700;
    margin-top: 4px;
    text-decoration: underline;
    letter-spacing: .3px;
}

.sa-bar-row:hover .sa-bar-fill { opacity: .75; }
.sa-bar-row:hover .sa-bar-label { color: #7B1F1F; }

/* ── Reviews section — scroll target ─────────── */
#sa-reviews-section {
    scroll-margin-top: 100px; /* offset for sticky header */
}

/* ── Inline order list review result ─────────── */
.sa-inline-review-wrap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #E8D5B0;
}
.sa-inline-reviewed {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.sa-inline-reviewed .sa-stars-inline {
    color: #C9A84C;
    font-size: 15px;
    letter-spacing: 1px;
}
.sa-inline-reviewed .sa-review-snippet {
    font-size: 12px;
    color: #6B3030;
    font-style: italic;
}

/* ── sa-order-card inject (custom My Account layout) ── */
.sa-order-right .sa-inline-review-wrap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #E8D5B0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sa-order-right .sa-btn-open-review {
    background: linear-gradient(135deg, #7B1F1F, #5A1515);
    color: #E2C170;
    border: none;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(91,21,21,.25);
    width: fit-content;
}
.sa-order-right .sa-btn-open-review:hover {
    opacity: .88;
    transform: translateY(-1px);
}
