/**
 * Appsbay Testimonials - Public & Customer Styles
 *
 * @package Appsbay_Testimonials
 */

/* =========================================
   Customer Dashboard (My Account)
   ========================================= */

.appsbay-customer-dashboard {
    max-width: 960px;
}

/* Earnings summary */
.appsbay-earnings-summary {
    margin-bottom: 30px;
}

.appsbay-earnings-summary h2 {
    font-size: 22px;
    margin-bottom: 16px;
}

.appsbay-earnings-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.appsbay-earn-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.appsbay-earn-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.appsbay-earn-label {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 500;
}

.appsbay-earn-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

.appsbay-earn-total .appsbay-earn-value { color: #10b981; }
.appsbay-earn-approved .appsbay-earn-value { color: #3b82f6; }
.appsbay-earn-pending .appsbay-earn-value { color: #f59e0b; }
.appsbay-earn-review-status .appsbay-earn-value { color: #3b82f6; font-size: 24px; }
.appsbay-earn-rate .appsbay-earn-value { color: #8b5cf6; }
.appsbay-earn-usage .appsbay-earn-value { color: #0f766e; font-size: 20px; }

.appsbay-earnings-tip {
    margin-top: 14px;
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #166534;
    font-size: 14px;
}

/* Product grid */
.appsbay-products-to-review {
    margin-bottom: 30px;
}

.appsbay-products-to-review h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.appsbay-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.appsbay-product-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: box-shadow 0.2s;
}

.appsbay-product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.appsbay-product-image img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.appsbay-product-info h4 {
    font-size: 15px;
    margin: 0 0 6px;
}

.appsbay-product-price {
    font-size: 14px;
    color: #64748b;
}

.appsbay-review-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 20px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.appsbay-review-btn:hover {
    background: #6d28d9;
}

.appsbay-no-products {
    padding: 30px;
    text-align: center;
    background: #f8fafc;
    border-radius: 12px;
    color: #64748b;
    margin-bottom: 30px;
}

/* Review Modal */
.appsbay-review-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.appsbay-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.appsbay-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.appsbay-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    line-height: 1;
}

.appsbay-modal-close:hover {
    color: #334155;
}

.appsbay-modal-content h3 {
    margin: 0 0 4px;
    font-size: 22px;
}

.appsbay-modal-product-name {
    color: #7c3aed;
    font-weight: 600;
    margin-bottom: 20px;
}

.appsbay-form-group {
    margin-bottom: 18px;
}

.appsbay-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #334155;
}

.appsbay-form-group label .required {
    color: #ef4444;
}

.appsbay-form-group label .optional {
    color: #94a3b8;
    font-weight: 400;
    font-size: 13px;
}

.appsbay-form-group input[type="text"],
.appsbay-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.appsbay-form-group input[type="text"]:focus,
.appsbay-form-group textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.appsbay-form-group input[type="file"] {
    font-size: 14px;
}

/* Star rating */
.appsbay-star-rating {
    display: flex;
    gap: 4px;
    font-size: 28px;
    cursor: pointer;
}

.appsbay-star {
    color: #d1d5db;
    transition: color 0.15s;
    user-select: none;
}

.appsbay-star.active,
.appsbay-star:hover,
.appsbay-star-rating:hover .appsbay-star {
    color: #f59e0b;
}

.appsbay-star-rating:hover .appsbay-star:hover ~ .appsbay-star {
    color: #d1d5db;
}

/* Photo preview */
.appsbay-photo-preview {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.appsbay-photo-preview-item {
    position: relative;
    display: inline-block;
}

.appsbay-photo-preview-item img {
    max-width: 120px;
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.appsbay-photo-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.appsbay-photo-remove:hover {
    background: #dc2626;
}

/* Submit button */
.appsbay-form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.appsbay-submit-btn {
    padding: 12px 24px;
    background: #7c3aed;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.appsbay-submit-btn:hover {
    background: #6d28d9;
}

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

.appsbay-earn-hint {
    font-size: 13px;
    color: #10b981;
    font-weight: 500;
    text-align: center;
}

/* Form message */
.appsbay-form-message {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.appsbay-form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.appsbay-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Checkout rewards summary */
.appsbay-checkout-rewards {
    margin-bottom: 18px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.appsbay-checkout-rewards-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    cursor: pointer;
    user-select: none;
}

.appsbay-checkout-rewards-header label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    margin: 0;
    cursor: pointer;
}

.appsbay-checkout-rewards-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #10b981;
    cursor: pointer;
    flex-shrink: 0;
}

.appsbay-checkout-rewards-amount {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.appsbay-checkout-rewards-body {
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.6;
    border-top: 1px solid #e2e8f0;
}

.appsbay-checkout-rewards-body.is-hidden {
    display: none;
}

.appsbay-rewards-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.appsbay-rewards-row:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

.appsbay-rewards-row-label {
    color: #475569;
    font-size: 13px;
}

.appsbay-rewards-row-value {
    font-weight: 600;
    color: #1e293b;
    font-size: 14px;
}

.appsbay-rewards-row-total .appsbay-rewards-row-label {
    font-weight: 700;
    color: #1e293b;
    font-size: 14px;
}

.appsbay-rewards-row-total .appsbay-rewards-row-value {
    color: #7c3aed;
    font-size: 15px;
}

/* Hide loyalty plugin elements on checkout when testimonial plugin is active */
.woocommerce-checkout .loyalty-points-checkbox,
.woocommerce-checkout .loyalty-excluded-notice {
    display: none !important;
}

/* My reviews list */
.appsbay-my-reviews {
    margin-top: 30px;
}

.appsbay-my-reviews h2 {
    font-size: 20px;
    margin-bottom: 16px;
}

.appsbay-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.appsbay-review-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    transition: box-shadow 0.2s;
}

.appsbay-review-item:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.appsbay-review-status-approved {
    border-left: 4px solid #10b981;
}

.appsbay-review-status-pending {
    border-left: 4px solid #f59e0b;
}

.appsbay-review-status-rejected {
    border-left: 4px solid #ef4444;
    opacity: 0.7;
}

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

.appsbay-review-product {
    font-weight: 700;
    font-size: 16px;
}

.appsbay-review-badge {
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.appsbay-badge-approved { background: #d4edda; color: #155724; }
.appsbay-badge-pending  { background: #fff3cd; color: #856404; }
.appsbay-badge-rejected { background: #f8d7da; color: #721c24; }

.appsbay-review-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.appsbay-review-photo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

.appsbay-review-photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
    max-width: 180px;
}

.appsbay-review-content {
    flex: 1;
}

.appsbay-review-stars {
    font-size: 16px;
    margin-bottom: 6px;
}

.appsbay-review-text {
    color: #475569;
    font-style: italic;
    margin: 0 0 6px;
    line-height: 1.5;
}

.appsbay-review-nickname {
    color: #64748b;
    font-size: 13px;
    margin: 0;
}

.appsbay-review-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    font-size: 13px;
}

.appsbay-review-date {
    color: #94a3b8;
}

.appsbay-review-earned {
    color: #10b981;
    font-weight: 600;
}

.appsbay-review-pending-hint {
    color: #f59e0b;
    font-style: italic;
}

.appsbay-edit-review-btn {
    border: 1px solid #7c3aed;
    background: #fff;
    color: #7c3aed;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
}

.appsbay-edit-review-btn:hover {
    background: #f5f3ff;
}

/* =========================================
   Public Testimonials Page
   ========================================= */

.appsbay-testimonials-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 0 20px;
}

.appsbay-no-testimonials {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
    font-size: 18px;
}

.appsbay-testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.appsbay-testimonial-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.appsbay-open-review-modal {
    cursor: pointer;
}

.appsbay-open-review-modal:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}

.appsbay-testimonial-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.appsbay-testimonial-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.appsbay-testimonial-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
}

.appsbay-testimonial-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.appsbay-testimonial-body {
    padding: 20px;
}

.appsbay-testimonial-stars {
    font-size: 18px;
    margin-bottom: 10px;
}

.appsbay-testimonial-quote {
    font-size: 15px;
    line-height: 1.6;
    color: #334155;
    font-style: italic;
    margin: 0 0 16px;
    border-left: 3px solid #7c3aed;
    padding-left: 14px;
}

.appsbay-testimonial-author {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.appsbay-testimonial-author strong {
    font-size: 15px;
    color: #1e293b;
}

.appsbay-testimonial-product {
    font-size: 13px;
    color: #7c3aed;
}

.appsbay-testimonial-product a {
    color: inherit;
    text-decoration: underline;
}

.appsbay-testimonial-product a:hover {
    text-decoration: none;
}

.appsbay-testimonial-date {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
}

.appsbay-testimonials-pagination {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
}

.appsbay-testimonials-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 3px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #334155;
    text-decoration: none;
    transition: all 0.2s;
}

.appsbay-testimonials-pagination .page-numbers.current {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

.appsbay-testimonials-pagination .page-numbers:hover:not(.current) {
    background: #f1f5f9;
}

/* =========================================
   Homepage Section
   ========================================= */

.appsbay-homepage-testimonials {
    background: none !important;
    padding: 30px 0;
    margin: 0;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    box-sizing: border-box;
}

.appsbay-homepage-testimonials-inner {
    max-width: 100%;
    margin: 0 auto;
}

.appsbay-homepage-testimonials-title {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 20px;
}

.appsbay-homepage-testimonials-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    cursor: grab;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.appsbay-homepage-testimonials-grid.appsbay-is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

.appsbay-homepage-testimonial-card {
    flex: 0 0 280px;
    min-width: 280px;
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}

.appsbay-homepage-testimonial-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.appsbay-homepage-photos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.appsbay-homepage-photo {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #e0e7ff;
}

.appsbay-homepage-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.appsbay-homepage-stars {
    font-size: 16px;
    margin-bottom: 10px;
}

.appsbay-homepage-quote {
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
    font-style: italic;
    margin: 0 0 12px;
}

.appsbay-homepage-product {
    color: #7c3aed;
    font-size: 13px;
    margin: 0 0 10px;
}

.appsbay-homepage-product a {
    color: inherit;
    text-decoration: underline;
}

.appsbay-homepage-product a:hover {
    text-decoration: none;
}

.appsbay-homepage-author {
    color: #7c3aed;
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}

.appsbay-homepage-cta {
    text-align: center;
    margin-top: 36px;
}

.appsbay-homepage-cta-btn {
    display: inline-block;
    padding: 14px 36px;
    background: #7c3aed;
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    transition: background 0.2s;
}

.appsbay-homepage-cta-btn:hover {
    background: #6d28d9;
    color: #fff;
}

/* Public review modal */
.appsbay-public-modal-open {
    overflow: hidden;
}

.appsbay-public-review-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: none;
}

.appsbay-public-review-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
}

.appsbay-public-review-content {
    position: relative;
    width: min(1120px, 96vw);
    max-height: 88vh;
    overflow-y: auto;
    margin: 4vh auto;
    padding: 30px;
    border-radius: 16px;
    background: #fff;
    z-index: 1;
}

.appsbay-public-review-close {
    position: absolute;
    right: 12px;
    top: 8px;
    border: none;
    background: transparent;
    font-size: 32px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
}

.appsbay-public-review-stars {
    font-size: 20px;
    margin-bottom: 8px;
}

.appsbay-public-review-product {
    margin: 0 0 12px;
    color: #7c3aed;
    font-weight: 600;
    font-size: 14px;
}

.appsbay-public-review-product a {
    color: inherit;
    text-decoration: underline;
}

.appsbay-public-review-product a:hover {
    text-decoration: none;
}

.appsbay-public-review-quote {
    margin: 0 0 14px;
    font-size: 16px;
    line-height: 1.7;
    color: #334155;
    border-left: 3px solid #7c3aed;
    padding-left: 14px;
}

.appsbay-public-review-author {
    margin: 0;
    color: #0f172a;
    font-weight: 700;
}

.appsbay-public-review-date {
    margin: 4px 0 14px;
    color: #64748b;
    font-size: 13px;
}

.appsbay-public-review-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.appsbay-public-review-photos img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    cursor: zoom-in;
}

.appsbay-public-gallery {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(2, 6, 23, 0.92);
    display: none;
}

.appsbay-public-gallery-image {
    position: absolute;
    max-width: min(94vw, 1600px);
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 10px;
}

.appsbay-public-gallery-close {
    position: absolute;
    top: 14px;
    right: 20px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 42px;
    line-height: 1;
    cursor: pointer;
}

.appsbay-public-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: rgba(15, 23, 42, 0.62);
    color: #fff;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
}

.appsbay-public-gallery-prev {
    left: 20px;
}

.appsbay-public-gallery-next {
    right: 20px;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 768px) {
    .appsbay-earnings-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .appsbay-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .appsbay-modal-content {
        padding: 20px;
        margin: 10px;
    }

    .appsbay-testimonials-grid {
        grid-template-columns: 1fr;
    }

    .appsbay-review-body {
        flex-direction: column;
    }

    .appsbay-public-review-content {
        padding: 20px;
        margin: 5vh auto;
    }

    .appsbay-public-review-photos {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .appsbay-public-gallery-nav {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .appsbay-earnings-cards {
        grid-template-columns: 1fr;
    }

    .appsbay-product-grid {
        grid-template-columns: 1fr;
    }

    .appsbay-homepage-testimonial-card {
        flex-basis: 240px;
        min-width: 240px;
    }
}
