/* ============================================================================
   Traveler Reviews
   Matches the Sahara theme tokens defined in theme.css
   ========================================================================== */

.reviews-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

/* ---- Top bar: summary + add-review button ------------------------------- */
.reviews-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.reviews-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: 99px;
    font-family: var(--font-display, 'Oswald', sans-serif);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--accent, #D98E48) 0%, var(--accent-deep, #B86B33) 100%);
    box-shadow: 0 6px 16px rgba(184, 107, 51, 0.28);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.reviews-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(184, 107, 51, 0.38);
}

.reviews-add-btn svg {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .reviews-topbar {
        justify-content: center;
        text-align: center;
    }
    .reviews-add-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ---- Summary (average rating) ------------------------------------------- */
.reviews-summary {
    display: flex;
}

.reviews-summary-score {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface, #fff);
    border: 1px solid rgba(17, 33, 45, 0.08);
    border-left: 3px solid var(--accent, #D98E48);
    border-radius: var(--radius, 16px);
    padding: 14px 22px;
    box-shadow: var(--shadow, 0 10px 30px rgba(17, 33, 45, 0.08));
}

.reviews-avg {
    font-family: var(--font-display, 'Oswald', sans-serif);
    font-size: 2.2rem;
    line-height: 1;
    font-weight: 700;
    color: var(--ink, #11212D);
}

.reviews-avg-stars {
    display: inline-flex;
    gap: 3px;
    font-size: 1.4rem;
    color: var(--accent, #D98E48);
    letter-spacing: 2px;
}

.reviews-avg-stars .star-empty {
    color: rgba(17, 33, 45, 0.2);
}

.reviews-count {
    font-size: 0.9rem;
    color: var(--muted, #6E6557);
}

/* ---- Add-review modal --------------------------------------------------- */
.review-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    background: rgba(17, 33, 45, 0.55);
    backdrop-filter: blur(3px);
    animation: reviewOverlayIn 0.2s ease both;
}

/* Native hidden attribute must win over display:flex */
.review-modal-overlay[hidden] {
    display: none;
}

@keyframes reviewOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.review-modal {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface, #fff);
    border-radius: var(--radius, 16px);
    border-top: 4px solid var(--accent, #D98E48);
    padding: 32px 28px 28px;
    box-shadow: 0 24px 60px rgba(17, 33, 45, 0.35);
    animation: reviewModalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes reviewModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.review-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--sand-2, #EFE6D8);
    color: var(--ink, #11212D);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
}

.review-modal-close:hover {
    background: var(--accent, #D98E48);
    color: #fff;
    transform: rotate(90deg);
}

/* Form card sits flush inside the modal (modal provides the surface) */
.review-modal .reviews-form-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    position: static;
}

.reviews-form-title {
    font-family: var(--font-display, 'Oswald', sans-serif);
    color: var(--ink, #11212D);
    font-size: 1.5rem;
    margin: 0 0 4px;
}

.reviews-form-subtitle {
    color: var(--muted, #6E6557);
    font-size: 0.92rem;
    margin: 0 0 20px;
}

.review-form .form-field {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-form label {
    font-weight: 600;
    color: var(--ink, #11212D);
    font-size: 0.9rem;
}

.review-form input[type="text"],
.review-form textarea,
.review-form select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(17, 33, 45, 0.18);
    border-radius: 10px;
    font: inherit;
    color: var(--ink, #11212D);
    background: var(--sand, #F5EFE6);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.review-form select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6557' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

.review-form input[type="text"]:focus,
.review-form textarea:focus,
.review-form select:focus {
    outline: none;
    border-color: var(--accent, #D98E48);
    box-shadow: 0 0 0 3px var(--accent-soft, rgba(217, 142, 72, 0.12));
    background-color: #fff;
}

.review-form textarea {
    resize: vertical;
    min-height: 110px;
}

/* ---- Star rating input -------------------------------------------------- */
.rating-input {
    display: inline-flex;
    gap: 4px;
}

.rating-star {
    background: none;
    border: none;
    padding: 0 2px;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: rgba(17, 33, 45, 0.22);
    transition: color 0.15s ease, transform 0.15s ease;
}

.rating-star:hover {
    transform: scale(1.12);
}

.rating-star.filled {
    color: var(--accent, #D98E48);
}

/* ---- Photo upload ------------------------------------------------------- */
.review-form input[type="file"] {
    font: inherit;
    color: var(--muted, #6E6557);
}

.review-photo-preview {
    position: relative;
    display: inline-block;
    margin-top: 8px;
}

/* Keep the preview hidden until a photo is actually chosen */
.review-photo-preview[hidden] {
    display: none;
}

.review-photo-preview img {
    max-width: 140px;
    max-height: 140px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(17, 33, 45, 0.12);
}

.review-photo-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--ink, #11212D);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ---- Submit button ------------------------------------------------------ */
.reviews-submit-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 99px;
    font-family: var(--font-display, 'Oswald', sans-serif);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent, #D98E48) 0%, var(--accent-deep, #B86B33) 100%);
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.reviews-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(184, 107, 51, 0.35);
}

.reviews-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.review-form-status {
    margin: 12px 0 0;
    font-size: 0.9rem;
    min-height: 1.2em;
}

.review-form-status.error { color: #C0392B; }
.review-form-status.success { color: var(--secondary, #1E6E6B); }

/* ---- Reviews list ------------------------------------------------------- */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.reviews-loading,
.reviews-empty {
    color: var(--muted, #6E6557);
    text-align: center;
    padding: 32px 0;
}

.review-card {
    background: var(--surface, #fff);
    border: 1px solid rgba(17, 33, 45, 0.08);
    border-radius: var(--radius, 16px);
    padding: 20px 22px;
    box-shadow: 0 6px 18px rgba(17, 33, 45, 0.06);
    animation: reviewFadeIn 0.4s ease both;
}

@keyframes reviewFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.review-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.review-card-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.review-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent, #D98E48), var(--secondary, #1E6E6B));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display, 'Oswald', sans-serif);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.review-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--ink, #11212D);
}

.review-flag {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(17, 33, 45, 0.12);
    flex-shrink: 0;
}

.review-date {
    font-size: 0.82rem;
    color: var(--muted, #6E6557);
}

.review-card-stars {
    color: var(--accent, #D98E48);
    font-size: 1rem;
    letter-spacing: 1px;
    white-space: nowrap;
}

.review-card-stars .star-empty {
    color: rgba(17, 33, 45, 0.2);
}

.review-comment {
    color: var(--ink-soft, #2B3A45);
    line-height: 1.6;
    margin: 6px 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.review-photo {
    margin-top: 12px;
}

.review-photo img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 12px;
    object-fit: cover;
    cursor: zoom-in;
    border: 1px solid rgba(17, 33, 45, 0.1);
}
