/* Modern Frontend CSS */
/* Unified Single Row Layout */
.wpcpv-unified-upload-container {
	display: flex;
	flex-wrap: nowrap;
	gap: 6px;
	margin: 20px 0;
	align-items: center;
	width: 100%;
    min-width: 0;
}

.wpcpv-upload-button-wrap,
.wpcpv-preview-item {
    flex: 0 1 100px;
    width: 100px;
    min-width: 40px;
    aspect-ratio: 1 / 1;
}

.wpcpv-upload-button {
	width: 100%;
    aspect-ratio: 1 / 1;
	border: 2px dashed #cbd5e1;
	border-radius: 8px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.2s;
	background: #f8fafc;
	color: #64748b;
    box-sizing: border-box;
    text-align: center;
}

.wpcpv-upload-button:hover {
	border-color: #3b82f6;
	background: #eff6ff;
	color: #3b82f6;
}

.wpcpv-upload-icon {
    line-height: 1;
}

.wpcpv-upload-icon svg {
    width: 30px;
    height: 30px;
    max-width: 80%;
}

.wpcpv-upload-label {
	font-size: 10px;
	font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90%;
}

/* Previews also shrink */
.wpcpv-preview-item {
	flex: 0 1 100px;
    width: 100px;
    min-width: 40px;
    aspect-ratio: 1 / 1;
	border-radius: 8px;
	overflow: hidden;
	position: relative;
	border: 1px solid #e2e8f0;
	background: #f8fafc;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpcpv-preview-item.wpcpv-loading {
	background: #f1f5f9;
}

.wpcpv-preview-spinner {
	width: 24px;
	height: 24px;
	border: 3px solid #cbd5e1;
	border-top-color: #3b82f6;
	border-radius: 50%;
	animation: wpcpv-spin 0.8s linear infinite;
}

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

.wpcpv-preview-item img, 
.wpcpv-preview-item video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wpcpv-preview-video-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #fff;
	pointer-events: none;
	background: rgba(0,0,0,0.3);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 5;
}

.wpcpv-preview-remove {
	position: absolute;
	top: 5px;
	right: 5px;
	background: rgba(0,0,0,0.5);
	color: #fff;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
}

/* Status below grid */
.wpcpv-upload-status {
	margin-top: 10px;
	font-size: 13px;
	line-height: 1.4;
    min-height: 20px;
}

.wpcpv-upload-status.success {
	color: #10b981;
}

.wpcpv-upload-status.error {
	color: #ef4444;
}

.wpcpv-review-media {
	margin-top: 15px;
}

.wpcpv-media-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 8px;
}

.wpcpv-media-link {
	display: block;
	width: 110px;
	height: 110px;
	border-radius: 8px;
	overflow: hidden;
	background: #f1f1f1;
	cursor: pointer;
}

.wpcpv-media-link img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s;
}

.wpcpv-media-link:hover img {
	transform: scale(1.1);
}

.wpcpv-video-thumb {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #1e293b;
	color: #fff;
}

/* Lightbox Theater Mode - Improved */
.wpcpv-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
}

.wpcpv-lightbox-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.9);
    cursor: zoom-out;
}

.wpcpv-lightbox-wrap {
	position: relative;
	width: 90%;
	max-width: 1100px;
	height: 80vh;
	background: #000;
	display: flex;
	border-radius: 12px;
	box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    z-index: 10;
}

.wpcpv-lightbox-main {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
	position: relative;
    user-select: none;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    overflow: hidden;
}

.wpcpv-lightbox-media {
	max-width: 100%;
	max-height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpcpv-lightbox-media img, 
.wpcpv-lightbox-media video {
	max-width: 100%;
	max-height: 80vh;
	display: block;
    object-fit: contain;
}

.wpcpv-lightbox-sidebar {
	width: 350px;
	background: #fff;
	padding: 30px;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
    color: #1e293b;
    border-left: 1px solid #ddd;
    text-align: left;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.wpcpv-lightbox-author {
	font-weight: 700;
	font-size: 1.2rem;
	margin-bottom: 5px;
}

.wpcpv-lightbox-rating {
	color: #f59e0b;
	margin-bottom: 15px;
	font-size: 1.1rem;
}

.wpcpv-lightbox-review {
	color: #475569;
	line-height: 1.6;
	font-size: 14px;
}

.wpcpv-lightbox-close {
	position: absolute;
	top: 15px;
	right: 15px;
	background: none;
	border: none;
	color: #64748b;
	font-size: 32px;
	cursor: pointer;
	z-index: 101;
	line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.wpcpv-lightbox-close:hover {
    transform: scale(1.1);
}

.wpcpv-lightbox-nav span {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255,255,255,0.1);
	border: none;
	color: #fff;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	font-size: 30px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
    z-index: 102;
}

.wpcpv-lightbox-nav span:hover {
	background: rgba(255,255,255,0.3);
}

.wpcpv-lightbox-prev { 
    left: -80px; 
}
.wpcpv-lightbox-next { 
    right: -80px; 
}

@media (max-width: 1300px) {
    .wpcpv-lightbox-prev { left: 10px; }
    .wpcpv-lightbox-next { right: 10px; }
}

@media (max-width: 1200px) {
    .wpcpv-lightbox-nav span {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

@media (max-width: 900px) {
    .wpcpv-lightbox-wrap {
        flex-direction: column;
        height: 95vh;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }
    .wpcpv-lightbox-sidebar {
        width: 100%;
        height: auto;
        min-height: 200px;
        order: 2;
    }
    .wpcpv-lightbox-main {
        order: 1;
    }
    .wpcpv-lightbox-next {
        right: 20px;
    }
    .wpcpv-lightbox-close {
        color: #fff;
        top: 10px;
        right: 10px;
    }
}

body.wpcpv-lightbox-open {
    overflow: hidden !important;
}

.wpcpv-media-link {
    display: block;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f1f1;
    cursor: pointer;
    position: relative;
}

.wpcpv-media-link img {
    transition: transform 0.3s ease !important;
}

.wpcpv-media-link:hover img {
    transform: scale(1.1) !important;
}

/* Media Gallery Styles */
.wpcpv-media-gallery-wrap {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
}

.wpcpv-media-gallery-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1e293b;
}

.wpcpv-media-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wpcpv-media-gallery .wpcpv-review-media {
    margin-top: 0;
    width: 100px;
    height: 100px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.wpcpv-media-gallery .wpcpv-media-link {
    width: 100%;
    height: 100%;
    display: block;
}

.wpcpv-media-gallery .wpcpv-video-thumb svg {
    width: 40px;
    height: 40px;
}

.wpcpv-review-media.wpcpv-hidden {
    display: none !important;
}

.wpcpv-review-media.wpcpv-view-all {
    position: relative;
}

.wpcpv-view-all-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    border-radius: 8px;
    text-align: center;
}

.wpcpv-view-all-count {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.1;
    display: block;
}

.wpcpv-view-all-text {
    font-size: 11px;
    font-weight: 700;
    display: block;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* Review Filters Styles */
.wpcpv-review-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 25px;
    gap: 20px;
}

.wpcpv-filter-media {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    user-select: none;
}

.wpcpv-filter-media input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wpcpv-filter-right {
    display: flex;
    gap: 12px;
}

.wpcpv-filter-right select {
    padding: 8px 35px 8px 12px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #fff;
    color: #334155;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.wpcpv-filter-right select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Loading State for Ajax */
.wpcpv-filtering {
    opacity: 0.5;
    pointer-events: none;
}

.no-comments {
    padding: 40px;
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
    color: #64748b;
    font-style: italic;
    list-style: none;
}

@media (max-width: 650px) {
    .wpcpv-review-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .wpcpv-filter-right {
        width: 100%;
        flex-direction: column;
    }
    
    .wpcpv-filter-right select {
        width: 100%;
    }
}
.wpcpv-review-summary-wrap {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    gap: 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.wpcpv-review-summary-left {
    text-align: center;
    min-width: 140px;
}

.wpcpv-summary-avg {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    color: #1e293b;
    margin-bottom: 8px;
}

.wpcpv-summary-stars {
    margin-bottom: 8px;
}

.wpcpv-summary-stars .star-rating {
    margin: 0 auto;
    font-size: 16px;
}

.wpcpv-summary-count {
    font-size: 13px;
    color: #64748b;
}

.wpcpv-review-summary-right {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpcpv-summary-bar-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 2px 0;
    transition: background 0.2s;
    border-radius: 4px;
}

.wpcpv-summary-bar-row.wpcpv-has-reviews {
    cursor: pointer;
}

.wpcpv-summary-bar-row.wpcpv-has-reviews:hover {
    background: #f8fafc;
}

.wpcpv-bar-label {
    min-width: 50px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.wpcpv-bar-container {
    flex-grow: 1;
    height: 10px;
    background: #f1f5f9;
    border-radius: 5px;
    overflow: hidden;
}

.wpcpv-bar-fill {
    height: 100%;
    background: #f59e0b; /* Yellow/Gold */
    border-radius: 5px;
    transition: width 0.6s ease;
}

.wpcpv-bar-pct {
    min-width: 35px;
    font-size: 12px;
    color: #94a3b8;
    text-align: right;
}

@media (max-width: 600px) {
    .wpcpv-review-summary-wrap {
        flex-direction: column;
        gap: 25px;
        padding: 20px;
    }
    
    .wpcpv-review-summary-left {
        width: 100%;
    }
}

/* Hidden native file input (the upload button triggers it) */
.wpcpv-upload-button input[type="file"] {
    display: none;
}

/* Media rendered inside the lightbox */
.wpcpv-lightbox-media img.wpcpv-lightbox-img,
.wpcpv-lightbox-media video.wpcpv-lightbox-video {
    max-width: 100%;
    max-height: 100%;
}

.wpcpv-lightbox-media img.wpcpv-lightbox-img {
    object-fit: contain;
}

/* Customer media wall (shortcode, block and Elementor widget) */
.wpcpv-media-wall {
    --wpcpv-cols: 4;
    --wpcpv-gap: 12px;
    position: relative;
    margin: 20px 0;
}

.wpcpv-media-wall.wpcpv-cols-2 { --wpcpv-cols: 2; }
.wpcpv-media-wall.wpcpv-cols-3 { --wpcpv-cols: 3; }
.wpcpv-media-wall.wpcpv-cols-4 { --wpcpv-cols: 4; }
.wpcpv-media-wall.wpcpv-cols-5 { --wpcpv-cols: 5; }
.wpcpv-media-wall.wpcpv-cols-6 { --wpcpv-cols: 6; }

.wpcpv-media-wall .wpcpv-wall-item {
    margin-top: 0;
}

.wpcpv-media-wall .wpcpv-media-link {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

.wpcpv-media-wall .wpcpv-media-link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wpcpv-media-wall .wpcpv-video-thumb {
    aspect-ratio: 1 / 1;
}

.wpcpv-layout-grid .wpcpv-wall-track {
    display: grid;
    grid-template-columns: repeat(var(--wpcpv-cols), minmax(0, 1fr));
    gap: var(--wpcpv-gap);
}

.wpcpv-layout-masonry .wpcpv-wall-track {
    column-count: var(--wpcpv-cols);
    column-gap: var(--wpcpv-gap);
}

.wpcpv-layout-masonry .wpcpv-wall-item {
    break-inside: avoid;
    margin-bottom: var(--wpcpv-gap);
}

.wpcpv-layout-masonry .wpcpv-media-link {
    aspect-ratio: auto;
}

.wpcpv-layout-masonry .wpcpv-media-link img {
    height: auto;
}

.wpcpv-layout-carousel .wpcpv-wall-track {
    display: flex;
    gap: var(--wpcpv-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
}

.wpcpv-layout-carousel .wpcpv-wall-item {
    flex: 0 0 calc((100% - (var(--wpcpv-gap) * (var(--wpcpv-cols) - 1))) / var(--wpcpv-cols));
    scroll-snap-align: start;
}

.wpcpv-wall-nav {
    position: absolute;
    top: 40%;
    z-index: 2;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    font-size: 24px;
    line-height: 36px;
    cursor: pointer;
}

.wpcpv-wall-nav:hover {
    background: rgba(15, 23, 42, 0.9);
}

.wpcpv-wall-prev {
    left: 8px;
}

.wpcpv-wall-next {
    right: 8px;
}

.wpcpv-wall-meta {
    padding: 6px 2px 0;
    font-size: 13px;
}

.wpcpv-wall-meta .star-rating {
    margin: 0 0 4px;
    font-size: 12px;
}

.wpcpv-wall-product {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 782px) {
    .wpcpv-media-wall[class*="wpcpv-cols-"] {
        --wpcpv-cols: 2;
    }
}
