/* ============================================================
   Homewera Reviews — Frontend Styles v2
   ============================================================ */

/* ── Reset ── */
.hw-reviews-wrapper *,
.hw-popup-overlay * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Wrapper ── */
.hw-reviews-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* ── Section Title ── */
.hw-section-title {
    font-size: 22px;
    font-weight: 700;
    color: #C53678;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(197, 54, 120, 0.15);
    text-align: center;
}

/* ── Summary ── */
.hw-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.hw-summary__score {
    text-align: center;
}

.hw-big-rating {
    font-size: 52px;
    font-weight: 700;
    color: #111;
    line-height: 1;
    margin-bottom: 6px;
}

.hw-total-count {
    font-size: 13px;
    color: #777;
    margin-top: 4px;
    text-align: center;
}

/* ── Stars ── */
.hw-stars {
    display: flex;
    gap: 2px;
    justify-content: center;
}
.hw-stars--sm { gap: 1px; }
.hw-stars--lg .hw-star { width: 22px; height: 22px; }
.hw-stars--sm .hw-star { width: 14px; height: 14px; }
.hw-star { width: 18px; height: 18px; flex-shrink: 0; }
.hw-star--filled path { fill: #f5a623; stroke: none; }
.hw-star--half path  { fill: url(#hw-half-grad); stroke: none; }
.hw-star--empty path { fill: #e0e0e0; stroke: none; }

/* ── Bar chart ── */
.hw-summary__bars {
    width: 100%;
    max-width: 320px;
}

.hw-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}

.hw-bar-label {
    font-size: 13px;
    color: #555;
    width: 42px;
    flex-shrink: 0;
    text-align: left;
}

.hw-bar-track {
    flex: 1;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.hw-bar-fill {
    height: 100%;
    background: #f0f0f0;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.hw-bar-fill--active { background: #f5a623; }

.hw-bar-count {
    font-size: 13px;
    color: #777;
    width: 18px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Photo gallery ── */
.hw-photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.hw-gallery-thumb {
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.hw-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.hw-gallery-thumb--more::after {
    content: attr(data-extra);
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Action bar ── */
.hw-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}
.hw-actions--bottom { margin-top: 20px; margin-bottom: 0; }

/* ── Filter button HIDDEN ── */
.hw-btn-filter { display: none !important; }

/* ── Write a Review button ── */
.hw-btn-write {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 28px;
    background: #fff;
    border: 1.5px solid #C53678;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #C53678;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    letter-spacing: 0.3px;
}
.hw-btn-write:hover {
    background: #C53678;
    color: #fff;
}

/* ── Review Grid ── */
.hw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
    text-align: left;
}

/* ── Review Card ── */
.hw-review-card {
    background: #fff;
    border: 1px solid rgba(197, 54, 120, 0.22);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(197, 54, 120, 0.09);
    transition: box-shadow 0.2s, transform 0.2s;
}
.hw-review-card:hover {
    box-shadow: 0 6px 22px rgba(197, 54, 120, 0.18);
    transform: translateY(-2px);
}

.hw-card-photos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    max-height: 160px;
    overflow: hidden;
}
.hw-card-photos img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}
.hw-card-photos img:only-child {
    grid-column: 1 / -1;
}

.hw-card-body { padding: 14px; }

.hw-card-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 10px;
}

.hw-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(197, 54, 120, 0.1);
    color: #C53678;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hw-author-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
}

.hw-review-text {
    font-size: 13px;
    line-height: 1.55;
    color: #444;
}

/* ── No reviews ── */
.hw-no-reviews {
    text-align: center;
    padding: 40px 20px;
    color: #777;
}
.hw-no-reviews p { margin-bottom: 16px; }

/* ════════════════════════════════════
   POPUP
   ════════════════════════════════════ */
.hw-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.hw-popup-overlay.hw-open {
    opacity: 1;
    visibility: visible;
}

.hw-popup {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(24px) scale(0.97);
    transition: transform 0.25s;
    position: relative;
    text-align: left;
}
.hw-popup-overlay.hw-open .hw-popup {
    transform: translateY(0) scale(1);
}

.hw-popup__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    border-radius: 12px 12px 0 0;
}
.hw-popup__header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111;
}

.hw-popup__close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
    transition: color 0.15s;
}
.hw-popup__close:hover { color: #C53678; }

.hw-popup__product {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    font-weight: 500;
    color: #222;
}
.hw-popup__product img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.hw-review-form { padding: 20px 24px 24px; }

.hw-field { margin-bottom: 18px; }

.hw-field__label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}
.hw-required { color: #C53678; }

.hw-star-picker { display: flex; gap: 6px; }
.hw-star-btn {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    transition: transform 0.1s;
}
.hw-star-btn:hover { transform: scale(1.15); }
.hw-star-btn svg { width: 32px; height: 32px; display: block; }
.hw-star-btn svg path { fill: #ddd; stroke: none; transition: fill 0.15s; }
.hw-star-btn.hw-active svg path,
.hw-star-btn.hw-hover svg path { fill: #f5a623; }

.hw-textarea {
    width: 100%;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
    display: block;
}
.hw-textarea:focus { outline: none; border-color: #C53678; }

.hw-char-count { text-align: right; font-size: 12px; color: #aaa; margin-top: 4px; }

.hw-input {
    width: 100%;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    color: #333;
    font-family: inherit;
    transition: border-color 0.2s;
    display: block;
}
.hw-input:focus { outline: none; border-color: #C53678; }
.hw-input.hw-error,
.hw-textarea.hw-error { border-color: #e53935; }

.hw-photo-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hw-photo-add-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 80px;
    height: 80px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    font-size: 12px;
    color: #888;
    transition: border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}
.hw-photo-add-btn:hover { border-color: #C53678; background: #fdf0f5; color: #C53678; }
.hw-photo-count { font-size: 11px; color: #aaa; }
.hw-photo-previews { display: flex; flex-wrap: wrap; gap: 8px; }
.hw-preview-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}
.hw-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hw-preview-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.hw-field__error,
.hw-form-error { font-size: 12px; color: #e53935; margin-top: 4px; display: none; }
.hw-form-error.hw-visible { display: block; }

.hw-btn-submit {
    width: 100%;
    padding: 13px;
    background: #C53678;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
    font-family: inherit;
}
.hw-btn-submit:hover { background: #a82c64; }
.hw-btn-submit:disabled { background: #e0a0bd; cursor: not-allowed; }

.hw-privacy-note {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 12px;
    line-height: 1.5;
}
.hw-privacy-note a { color: #C53678; text-decoration: none; }
.hw-privacy-note a:hover { text-decoration: underline; }

.hw-popup__success { padding: 48px 24px; text-align: center; }
.hw-success-icon svg { width: 64px; height: 64px; margin: 0 auto 16px; display: block; }
.hw-success-icon circle { fill: none; stroke: #C53678; stroke-width: 2; }
.hw-success-icon path   { fill: none; stroke: #C53678; stroke-width: 2.5; stroke-linecap: round; }
.hw-popup__success h4 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.hw-success-msg { font-size: 14px; color: #666; }

/* ── Responsive ── */
@media (max-width: 600px) {
    .hw-grid { grid-template-columns: 1fr 1fr; }
    .hw-popup { border-radius: 12px 12px 0 0; max-height: 95vh; }
    .hw-popup-overlay { align-items: flex-end; padding: 0; }
    .hw-review-form { padding: 16px; }
    .hw-popup__header,
    .hw-popup__product { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 400px) {
    .hw-grid { grid-template-columns: 1fr; }
}
