/* 
 * Frontend styles for Drevko Reviews v2.0.0-beta.1
 * Mobile-first responsive design with Drevko standards
 */

/* ---------- CSS Custom Properties ---------- */
:root {
    --drevko-color-primary: #b59e8b;
    --drevko-color-secondary: #907e6f;
    --drevko-color-text: #222222;
    --drevko-color-light: #f6f3f0;
    --drevko-color-border: #d2c4b9;
    --drevko-color-star: #ffb900;
    --drevko-font-primary: 'Nunito', sans-serif;
    --drevko-font-heading: 'Merriweather', serif;
    --drevko-breakpoint-mobile: 689.98px;
    --drevko-breakpoint-tablet: 999.98px;
}

/* ---------- General ---------- */
.drevko-reviews-rating,
.drevko-reviews-gallery,
.drevko-reviews,
.drevko-review-form,
.drevko-all-reviews {
    font-family: var(--drevko-font-primary);
    color: var(--drevko-color-text);
    margin-bottom: 30px;
}

/* ---------- Stars styling ---------- */
.drevko-reviews-rating__stars,
.drevko-reviews__stars,
.drevko-review-form__stars,
.drevko-all-reviews__stars,
.drevko-reviews-gallery__item-rating,
.drevko-reviews-gallery-caption__rating {
    color: var(--drevko-color-star);
    font-size: 1.4em;
    font-weight: 400;
    line-height: 1;
}

/* ---------- Rating display - ENHANCED ---------- */
.drevko-reviews-rating {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.drevko-reviews-rating__link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: opacity 0.2s ease;
    font-size: 18px;
    line-height: 1;
}

.drevko-reviews-rating__link:hover {
    color: var(--drevko-color-text);
}

.drevko-reviews-rating__average {
    font-size: 17px;
    font-weight: 600;
}

.drevko-reviews-rating__count {
    font-size: 0.8em;
}

/* ---------- Gallery - RESPONSIVE WITH LAZY LOADING ---------- */
.drevko-reviews-gallery {
    margin-bottom: 40px;
}

.drevko-reviews-gallery__title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Mobile Gallery (≤999.98px) - 3 photos per row */
.drevko-reviews-gallery__container {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 15px;
}

.drevko-reviews-gallery__item {
    flex: 0 0 auto;
    width: calc(33.333% - 6px);
    overflow: hidden;
    position: relative;
}

/* Mobile and Tablet full-width container */
@media (max-width: 999.98px) {    
    .drevko-reviews-gallery__title {
        font-size: 17px;
    }

    .drevko-reviews-gallery__container {
        width: 100vw;
        margin: 0 -5vw;
        padding: 0 5vw;
        scrollbar-width: none;
    }
    
    .drevko-reviews-gallery__item {
        width: 42%;
        max-width: 225px;
    }

    .drevko-reviews-gallery__nav {
        display: none;
    }
}

/* Desktop (≥1000px) - Horizontal scroll with arrow navigation */
@media (min-width: 1000px) {
    .drevko-reviews-gallery {
        position: relative;
    }
    
    .drevko-reviews-gallery__container {
        overflow-x: auto;
        scroll-behavior: smooth;
        gap: 12px;
        /* Hide scrollbar */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .drevko-reviews-gallery__container::-webkit-scrollbar {
        display: none;
    }
    
    .drevko-reviews-gallery__item {
        width: 190px;
        max-width: 190px;
    }
    
    /* Navigation arrows - only on desktop */
    .drevko-reviews-gallery__nav {
        position: absolute;
        top: calc(50% + 13px);
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 10;
        opacity: 0;
        transition: all 0.2s ease;
        color: var(--drevko-color-text);
    }
    
    .drevko-reviews-gallery:hover .drevko-reviews-gallery__nav {
        opacity: 1;
    }
    
    .drevko-reviews-gallery__nav:hover {
        background: var(--drevko-color-primary);
        color: #ffffff;
    }
    
    .drevko-reviews-gallery__nav--prev {
        left: 20px;
    }
    
    .drevko-reviews-gallery__nav--next {
        right: 20px;
    }
    
    .drevko-reviews-gallery__nav:disabled {
        display: none;
    }
}

.drevko-reviews-gallery__item a {
    display: block;
    position: relative;
    padding-bottom: 133.33%; /* 3:4 aspect ratio */
    overflow: hidden;
}

.drevko-reviews-gallery__item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Lazy loading styles */
.drevko-gallery-lazy {
    opacity: 0.7;
}

.drevko-gallery-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--drevko-color-light);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.drevko-gallery-loader {
    width: 30px;
    height: 30px;
    border: 3px solid var(--drevko-color-border);
    border-top: 3px solid var(--drevko-color-primary);
    animation: drevkoSpin 1s linear infinite;
    border-radius: 50%;
}

@keyframes drevkoSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.drevko-gallery-lazy-img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drevko-gallery-lazy-img.loaded {
    opacity: 1;
}

/* ---------- Reviews List - WITH TEXT TRUNCATION ---------- */
#reviews.drevko-reviews {
    background-color: var(--drevko-color-light);
    padding: 40px;
    margin-bottom: 40px;
}

.drevko-reviews__title {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 30px;
    font-family: var(--drevko-font-heading);
    font-size: 20px;
    font-weight: 700;
}

.drevko-reviews__verified {
    font-size: 13px;
    line-height: 1;
    font-family: var(--drevko-font-primary);
    font-weight: 600;
    color: #275c37;
    background-color: #e3ede5;
    padding: 6px 12px;
}

.drevko-reviews__summary {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.drevko-reviews__rating {
    font-size: 23px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.drevko-reviews__stars {
    font-size: 1.3em;
}

.drevko-reviews__count {
    font-size: 16px;
    font-weight: 400;
}

.drevko-reviews__list {
    margin-bottom: 30px;
}

.drevko-reviews__item {
    background-color: #ffffff;
    padding: 30px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
}

.drevko-reviews__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #e8e1dc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--drevko-color-secondary);
    flex-shrink: 0;
}

.drevko-reviews__content {
    flex-grow: 1;
}

.drevko-reviews__header {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
    margin-bottom: 15px;
    align-items: flex-end;
}

.drevko-reviews__author {
    font-weight: 700;
    font-size: 17px;
    width: 100%;
}

.drevko-reviews__date {
    color: #666;
    font-size: 13px;
}

.drevko-reviews__text {
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Text truncation system */
.drevko-text-truncate__content p{
    display: inline;
}

.drevko-text-truncate__more {
    color: var(--drevko-color-primary);
    cursor: pointer;
    font-weight: 600;
}

.drevko-text-truncate__more:hover {
    color: var(--drevko-color-secondary);
}

.drevko-reviews__images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.drevko-reviews__image-link {
    display: block;
    width: 80px;
    height: 80px;
    overflow: hidden;
}

.drevko-reviews__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drevko-reviews__product {
    font-size: 13px;
    font-weight: 600;
}

.drevko-reviews__product a {
    font-weight: 400;
}

.drevko-reviews__product a:hover {
    color: var(--drevko-color-secondary);
}

.drevko-reviews__show-all {
    display: inline-block;
    height: 55px;
    line-height: 55px;
    padding: 0 30px;
    background-color: var(--drevko-color-primary);
    color: #ffffff;
    font-family: var(--drevko-font-primary);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
}

.drevko-reviews__show-all:hover {
    background-color: var(--drevko-color-secondary);
    color: #ffffff;
}

/* ---------- Review Form - ENHANCED UI ---------- */
.drevko-review-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    background-color: var(--drevko-color-light);
}

/* Product Header */
.drevko-review-form__header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e1d8d0;
}

.drevko-review-form__product-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.drevko-review-form__product-info h2 {
    font-family: var(--drevko-font-primary);
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.drevko-notice {
    padding: 15px;
    margin-bottom: 20px;
    border-left: 5px solid;
}

.drevko-notice p {
    margin-block-end: 0;
}

.drevko-notice--success {
    background-color: #f0f9e6;
    border-color: #38844f;
}

.drevko-notice--error {
    background-color: #fce9e9;
    border-color: #c3262c;
}

.drevko-review-form__rating {
    margin-bottom: 24px;
    text-align: center;
}

.drevko-review-form__rating label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.required {
    color: #c3262c;
}

/* Enhanced star rating - larger and no numbers */
.drevko-review-form__stars {
    display: inline-flex;
    flex-direction: row-reverse;
    font-size: 2.5em;
    gap: 5px;
}

.drevko-review-form__stars input {
    display: none;
}

.drevko-review-form__stars label {
    color: #ccc;
    font-size: 40px;
    cursor: pointer;
    font-weight: normal;
    padding: 0;
    margin: 0;
    transition: color 0.2s ease;
}

.drevko-review-form__stars label:before {
    content: "★";
}

.drevko-review-form__stars input:checked ~ label,
.drevko-review-form__stars:not(:checked) > label:hover,
.drevko-review-form__stars:not(:checked) > label:hover ~ label {
    color: var(--drevko-color-star);
}

.drevko-review-form__text {
    margin-bottom: 24px;
}

.drevko-review-form__text label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.drevko-review-form__text textarea {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 1px solid var(--drevko-color-border);
    font-family: var(--drevko-font-primary);
    font-size: 16px;
    line-height: 1.5;
    resize: vertical;
}

.drevko-review-form__text textarea:focus {
    outline: none;
    border-color: var(--drevko-color-primary);
}

.drevko-review-form__images {
    margin-bottom: 20px;
}

.drevko-review-form__images label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.drevko-review-form__images .description {
    font-size: 13px;
}

/* Modern file input */
.drevko-review-form__file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px 20px;
    border: 2px dashed var(--drevko-color-border);
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.drevko-review-form__file-label:hover {
    border-color: var(--drevko-color-primary);
    background: var(--drevko-color-light);
}

.drevko-review-form__file-icon {
    font-size: 24px;
}

.drevko-review-form__file-text {
    font-size: 15px;
    letter-spacing: -.5px;
}

.drevko-review-form__preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.drevko-review-form__preview-item {
    width: 80px;
    height: 80px;
    overflow: hidden;
    position: relative;
}

.drevko-review-form__preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Full-width submit button */
.drevko-review-form__submit {
    width: 100%;
    background-color: var(--drevko-color-primary);
    color: #ffffff;
    border: none;
    height: 60px;
    padding: 0 30px;
    font-family: var(--drevko-font-primary);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.drevko-review-form__submit:hover {
    background-color: var(--drevko-color-secondary);
}

.drevko-review-form__submit--full {
    margin-top: 20px;
}

/* ---------- All Reviews Page - NEW ---------- */
.drevko-all-reviews {
    max-width: 1200px;
    background-color: var(--drevko-color-light);
    margin: 0 auto;
    padding: 40px;
}

.drevko-all-reviews__product-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.drevko-all-reviews__product-image img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.drevko-all-reviews__summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drevko-all-reviews__rating {
    display: flex;
    font-size: 16px;
    align-items: center;
    gap: 10px;
}

.drevko-all-reviews__average {
    font-size: 1.5em;
    font-weight: 600;
}

.drevko-all-reviews__count {
    font-size: .85em;
}

.drevko-all-reviews__verified {
    font-size: 13px;
    line-height: 1;
    font-family: var(--drevko-font-primary);
    font-weight: 600;
    color: #275c37;
    background-color: #e3ede5;
    padding: 6px 12px;
}

.drevko-all-reviews__list {
    margin-bottom: 40px;
}

.drevko-all-reviews__item {
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    background-color: #fff;
}

.drevko-all-reviews__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #e8e1dc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--drevko-color-secondary);
    flex-shrink: 0;
}

.drevko-all-reviews__content {
    flex-grow: 1;
}

.drevko-all-reviews__header {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
    margin-bottom: 15px;
    align-items: center;
    justify-content: space-between;
}

.drevko-all-reviews__content .drevko-all-reviews__header {
    justify-content: flex-start;
    align-items: flex-end;
}

.drevko-all-reviews__author {
    font-weight: 700;
    font-size: 17px;
    width: 100%;
}

.drevko-all-reviews__date {
    font-size: 13px;
    color: #666;
}

.drevko-all-reviews__text {
    margin-bottom: 20px;
    line-height: 1.6;
}

.drevko-all-reviews__images {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 15px;
}

.drevko-all-reviews__image-link {
    display: block;
    width: calc((100% - 8px) / 3);
    max-width: 100px;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: 100px;
    overflow: hidden;
}

.drevko-all-reviews__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drevko-all-reviews__product {
    font-size: 13px;
    font-weight: 600;
}

.drevko-all-reviews__product a {
    font-weight: 400;
}

.drevko-all-reviews__product a:hover {
    color: var(--drevko-color-secondary);
}

.drevko-all-reviews__pagination {
    margin-bottom: 40px;
    text-align: center;
}

.drevko-all-reviews__pagination .page-numbers {
    display: flex;
    padding: 6px 16px;
    justify-content: center;
    list-style: none;
}

.drevko-all-reviews__pagination .page-numbers.current {
    background-color: var(--drevko-color-primary);
    color: #ffffff;
    border-color: var(--drevko-color-primary);
}

.drevko-all-reviews__empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--drevko-color-secondary);
}

.drevko-button {
    display: inline-block;
    height: 55px;
    line-height: 55px;
    padding: 0 30px;
    background-color: var(--drevko-color-primary);
    color: #ffffff;
    font-family: var(--drevko-font-primary);
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
}

.drevko-button:hover {
    background-color: var(--drevko-color-secondary);
    color: #ffffff;
}

/* ---------- Success Message Modal ---------- */
.drevko-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drevko-success-modal {
    background: white;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    margin: 20px;
}

.drevko-success-content h2 {
    font-size: 26px;
}

.drevko-success-close {
    background: var(--drevko-color-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    margin-top: 20px;
    font-family: var(--drevko-font-primary);
    font-weight: 600;
}

.drevko-success-close:hover {
    background: var(--drevko-color-secondary);
}

/* ---------- PhotoSwipe Customization ---------- */
.drevko-reviews-gallery-caption {
    text-align: left;
    padding: 10px 0;
}

.drevko-reviews-gallery-caption__rating {
    margin-bottom: 8px;
    color: var(--drevko-color-star);
}

.drevko-reviews-gallery-caption__product {
    font-size: 12px;
}

.drevko-caption-text {
    margin-bottom: 8px;
    font-size: 14px;
    word-wrap: break-word;
}

.caption-more,
.caption-less {
    color: var(--drevko-color-primary);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    user-select: none;
}

/* ---------- Responsive Styles ---------- */

/* Mobile and Tablet (≤999.98px) */
@media (max-width: 999.98px) {
    .drevko-reviews,
    .drevko-all-reviews,
    .drevko-review-form {
        width: 100vw !important;
        padding: 24px 5vw;
    }
    
    .drevko-reviews__item,
    .drevko-all-reviews__item {
        gap: 12px;
        padding: 20px;
        padding-left: 16px;
    }
    
    .drevko-review-form__header {
        gap: 15px;
    }
    
    .drevko-review-form__product-info h2 {
        font-size: 16px;
    }
    
    .drevko-all-reviews__header {
        gap: 0 12px;
    }
    
    .drevko-review-form__stars {
        font-size: 2em;
    }
    
    .drevko-success-modal {
        padding: 30px 20px;
        margin: 10px;
    }

    .drevko-reviews__avatar {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .drevko-all-reviews__avatar {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .drevko-reviews__show-all {
        width: 100%;
        text-align: center;
        font-size: 16px;
    }

    .drevko-all-reviews__back {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 2;
    }

    .drevko-all-reviews__back a {
        width: 100%;
        text-align: center;
        height: 60px;
    }

    .drevko-reviews-gallery-caption__rating {
        font-size: 1.2em;
    }

    .drevko-caption-text {
        font-size: 13px;
    }

    .drevko-reviews-gallery-caption__product {
        font-size: 11px;
    }
}

/* ---------- Loading States ---------- */
.drevko-review-form__submit.drevko-submitting {
    background-color: var(--drevko-color-secondary) !important;
    cursor: not-allowed !important;
    opacity: 0.9;
}

.drevko-loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: drevkoSpin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}