/**
 * Aura TrustMate Reviews Widget Styles
 * Design: Clean masonry grid, warm beige cards, no shadows
 */

/* ============================================
   Variables
   ============================================ */
:root {
    --atr-widget-bg: #FAF7F5;
    --atr-card-bg: #FFFFFF;
    --atr-card-radius: 12px;
    --atr-text-primary: #1A1A1A;
    --atr-text-secondary: #666666;
    --atr-text-muted: #999999;
    --atr-star-filled: #FFD700;
    --atr-star-empty: #D4D4D4;
    --atr-verified-color: #1A1A1A;
    --atr-trustmate-color: #E65100;
    --atr-border-color: #E8E4E1;
    --atr-gap: 16px;
    --atr-padding: 20px;
}

/* ============================================
   Widget Container
   ============================================ */
.atr-widget {
    width: 100%;
    max-width: 1400px;
    margin: 30px auto;
    padding: 30px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--atr-widget-bg);
    border-radius: 16px;
}

/* ============================================
   Header
   ============================================ */
.atr-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--atr-border-color);
}

.atr-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.atr-summary-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.atr-reviews-count {
    font-size: 15px;
    font-weight: 600;
    color: var(--atr-text-primary);
}

/* TrustMate Badge in Header - Orange */
.atr-trustmate-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--atr-trustmate-color);
    border: 1px solid rgba(230, 81, 0, 0.2);
}

.atr-trustmate-badge svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Header Right - flex container */
.atr-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ============================================
   Sorting Dropdown
   ============================================ */
.atr-sort-dropdown {
    position: relative;
}

.atr-sort-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--atr-border-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--atr-text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.atr-sort-toggle:hover {
    border-color: var(--atr-text-secondary);
    background: rgba(0,0,0,0.02);
}

.atr-sort-toggle svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.atr-sort-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    padding: 8px 0;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.atr-sort-dropdown.open .atr-sort-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.atr-sort-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    border: none;
    font-size: 14px;
    color: var(--atr-text-primary);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease;
}

.atr-sort-option:hover {
    background: rgba(0,0,0,0.04);
}

.atr-sort-option .atr-check {
    opacity: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.atr-sort-option.active .atr-check {
    opacity: 1;
}

/* ============================================
   Masonry Grid Layout
   ============================================ */
.atr-reviews-masonry {
    column-count: 4;
    column-gap: var(--atr-gap);
}

/* ============================================
   Review Card
   ============================================ */
.atr-review-card {
    background: var(--atr-card-bg);
    border-radius: var(--atr-card-radius);
    padding: var(--atr-padding);
    margin-bottom: var(--atr-gap);
    break-inside: avoid;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Hidden cards (for pagination) */
.atr-review-card.atr-hidden {
    display: none;
}

/* ============================================
   Review Header (Author + Rating)
   ============================================ */
.atr-review-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.atr-review-author {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.atr-author-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--atr-text-primary);
}

/* Verified Badge - Subtle and elegant */
.atr-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--atr-verified-color);
    font-size: 11px;
    font-weight: 500;
    opacity: 0.85;
}

.atr-verified-badge svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.atr-verified-badge span {
    /* Hide text on small cards, show only icon */
}

/* ============================================
   Star Rating
   ============================================ */
.atr-stars {
    display: inline-flex;
    align-items: center;
    gap: 1px;
}

.atr-star {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.atr-star-filled {
    color: var(--atr-star-filled);
}

.atr-star-empty {
    color: var(--atr-star-empty);
}

.atr-review-rating {
    display: flex;
    align-items: center;
}

/* Review Meta - Rating + Date row */
.atr-review-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Review Date - Minimalist style */
.atr-review-date {
    font-size: 11px;
    color: var(--atr-text-muted);
    font-weight: 400;
    white-space: nowrap;
}

/* Summary stars in header (bigger) */
.atr-summary-rating .atr-stars .atr-star {
    width: 18px;
    height: 18px;
}

/* ============================================
   Review Content
   ============================================ */
.atr-review-content {
    font-size: 13px;
    line-height: 1.55;
    color: var(--atr-text-primary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   Review Photos
   ============================================ */
.atr-review-photos {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.atr-review-photo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.atr-review-photo:hover {
    opacity: 0.85;
}

/* ============================================
   Review Video
   ============================================ */
.atr-review-video {
    margin-top: 10px;
}

.atr-video-thumbnail {
    position: relative;
    display: inline-block;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
}

.atr-video-thumbnail img {
    display: block;
    width: 100px;
    height: 70px;
    object-fit: cover;
}

.atr-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--atr-text-primary);
}

/* ============================================
   Widget Footer
   ============================================ */
.atr-widget-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
}

/* Load More Button */
.atr-load-more {
    background: transparent;
    border: 1px solid var(--atr-border-color);
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--atr-text-primary);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.atr-load-more:hover {
    background: var(--atr-card-bg);
    border-color: var(--atr-text-secondary);
}

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

/* ============================================
   Responsive Design - Masonry columns
   ============================================ */

/* Desktop Large */
@media (max-width: 1400px) {
    .atr-reviews-masonry {
        column-count: 4;
    }
}

/* Desktop */
@media (max-width: 1200px) {
    .atr-reviews-masonry {
        column-count: 3;
    }
}

/* Tablet */
@media (max-width: 900px) {
    .atr-reviews-masonry {
        column-count: 2;
    }

    .atr-widget-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .atr-reviews-masonry {
        column-count: 1;
    }

    .atr-widget {
        margin: 20px 0;
    }

    .atr-review-card {
        padding: 16px;
    }

    .atr-trustmate-badge {
        font-size: 11px;
        padding: 5px 10px;
    }

    :root {
        --atr-padding: 16px;
        --atr-gap: 12px;
    }
}

/* ============================================
   Loading State
   ============================================ */
.atr-loading .atr-load-more {
    pointer-events: none;
}

.atr-loading .atr-load-more::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid var(--atr-text-secondary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: atr-spin 0.8s linear infinite;
}

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

/* ============================================
   Accessibility
   ============================================ */
.atr-load-more:focus {
    outline: 2px solid var(--atr-text-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .atr-review-card,
    .atr-video-play {
        transition: none;
    }

    .atr-loading .atr-load-more::after {
        animation: none;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .atr-widget-footer {
        display: none;
    }

    .atr-review-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .atr-reviews-masonry {
        column-count: 2;
    }
}

/* ============================================
   TrustMate Logo on Review Cards
   ============================================ */
.atr-card-trustmate {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--atr-border-color);
}

.atr-card-trustmate img {
    height: 14px !important;
    display: inline-block !important;
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

.atr-card-trustmate:hover img {
    opacity: 0.8;
}


/* ============================================
   Slider Widget
   ============================================ */
.atr-slider {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--atr-widget-bg);
    border-radius: 16px;
    position: relative;
}

/* Slider Header */
.atr-slider__header {
    margin-bottom: 20px;
}

.atr-slider__header-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.atr-slider__title {
    font-size: 13px;
    font-weight: 500;
    color: var(--atr-text-secondary);
}

.atr-slider__logo {
    height: 18px !important;
    width: auto !important;
    max-width: none !important;
    display: inline-block !important;
}

.atr-slider__stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.atr-slider__stats .atr-stars .atr-star {
    width: 16px;
    height: 16px;
}

.atr-slider__count {
    font-size: 13px;
    color: var(--atr-text-muted);
    font-weight: 400;
}

/* Slider Viewport */
.atr-slider__viewport {
    overflow: hidden;
    position: relative;
}

.atr-slider__track {
    display: flex;
    gap: 12px;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Slider Card */
.atr-slider__card {
    flex: 0 0 calc((100% - 24px) / 3);
    min-width: 0;
    background: var(--atr-card-bg);
    border-radius: var(--atr-card-radius);
    padding: 18px;
    box-sizing: border-box;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.atr-slider__card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.atr-slider__author {
    font-size: 14px;
    font-weight: 600;
    color: var(--atr-text-primary);
}

.atr-slider__badge {
    height: 14px !important;
    width: auto !important;
    max-width: none !important;
    display: inline-block !important;
    opacity: 0.5;
}

.atr-slider__card-stars {
    margin-bottom: 8px;
}

.atr-slider__card-stars .atr-stars .atr-star {
    width: 14px;
    height: 14px;
}

.atr-slider__card-text {
    font-size: 13px;
    line-height: 1.55;
    color: var(--atr-text-primary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Slider Controls */
.atr-slider__controls {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 16px;
}

.atr-slider__btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--atr-border-color);
    background: var(--atr-card-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--atr-text-secondary);
    transition: background-color 0.2s ease, border-color 0.2s ease;
    padding: 0;
}

.atr-slider__btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

.atr-slider__btn svg {
    width: 14px;
    height: 14px;
}

/* Slider Responsive */
@media (max-width: 768px) {
    .atr-slider {
        padding: 20px 16px;
    }

    .atr-slider__card {
        flex: 0 0 calc((100% - 12px) / 2);
        padding: 14px;
    }

    .atr-slider__card-text {
        font-size: 12.5px;
        -webkit-line-clamp: 3;
    }
}

@media (max-width: 480px) {
    .atr-slider__card {
        flex: 0 0 100%;
        padding: 16px;
    }

    .atr-slider__card-text {
        -webkit-line-clamp: 4;
    }
}

@media (prefers-reduced-motion: reduce) {
    .atr-slider__track {
        transition: none;
    }
}
