/* PX Reviews Frontend Styles */

/* Product Rating Display (below price) */
.px-product-rating-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.px-product-rating-display .px-rating-stars {
    display: flex;
    align-items: center;
    gap: 3px;
}

.px-product-rating-display .px-star {
    font-size: 20px;
    color: #ddd;
    line-height: 1;
}

.px-product-rating-display .px-star.filled {
    color: #ffc107;
}

.px-product-rating-display .px-rating-text {
    font-size: 16px;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
    white-space: nowrap;
}

.px-product-rating-display .px-rating-text:hover {
    color: #333;
}

.px-reviews-section {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.px-reviews-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.px-reviews-title {
    font-size: 28px;
    font-weight: 700;
    color: #000;
    letter-spacing: 1px;
    margin: 0;
}

.px-reviews-write-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.px-reviews-write-btn:hover {
    background: #333;
}

/* Inline Review Form */
.px-review-form-container {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 40px;
}

.px-review-form-container .px-form-group {
    margin-bottom: 25px;
}

.px-review-form-container .px-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 16px;
    text-align: left; /* Explicitly set left alignment */
}

.px-review-form-container .px-form-row {
    display: flex;
    gap: 20px;
}

.px-review-form-container .px-form-group.px-half {
    flex: 1;
}

.px-review-form-container .px-form-group.px-full {
    flex: 1;
    width: 100%;
}

.px-review-form-container input,
.px-review-form-container textarea,
.px-review-form-container select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
    text-align: left; /* Ensure input text is left-aligned */
    background-color: #fff;
}

.px-review-form-container input:focus,
.px-review-form-container textarea:focus,
.px-review-form-container select:focus {
    outline: none;
    border-color: #000;
}

.px-review-form-container select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

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

.px-star-rating {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    justify-content: flex-start; /* Align stars to the left */
}

.px-star-input {
    font-size: 30px;
    color: #ddd;
    cursor: pointer;
    transition: color 0.2s ease;
}

.px-star-input.hover,
.px-star-input.selected {
    color: #ffc107;
}

/* Color Selector Styles */
.px-color-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.px-color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.px-color-option:hover {
    background-color: #f5f5f5;
}


.px-color-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
    margin-bottom: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.px-color-option:hover .px-color-circle {
    transform: scale(1.1);
    border-color: #999;
}

.px-color-option.selected .px-color-circle {
    border-color: #2196f3;
    border-width: 3px;
    transform: scale(1.1);
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.px-color-name {
    font-size: 12px;
    color: #666;
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Size Selector Styles */
.px-size-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.px-size-option {
    cursor: pointer;
    transition: all 0.3s ease;
}

.px-size-option:hover .px-size-circle {
    transform: scale(1.1);
    border-color: #999;
}

.px-size-option.selected .px-size-circle {
    background-color: #2196f3;
    color: white;
    border-color: #2196f3;
    transform: scale(1.1);
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

.px-size-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background-color: white;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Color backgrounds for common colors */
.px-color-option[data-color*="red"] .px-color-circle { background-color: #f44336; }
.px-color-option[data-color*="blue"] .px-color-circle { background-color: #2196f3; }
.px-color-option[data-color*="green"] .px-color-circle { background-color: #4caf50; }
.px-color-option[data-color*="yellow"] .px-color-circle { background-color: #ffeb3b; }
.px-color-option[data-color*="orange"] .px-color-circle { background-color: #ff9800; }
.px-color-option[data-color*="purple"] .px-color-circle { background-color: #9c27b0; }
.px-color-option[data-color*="pink"] .px-color-circle { background-color: #e91e63; }
.px-color-option[data-color*="black"] .px-color-circle { background-color: #212121; }
.px-color-option[data-color*="white"] .px-color-circle { background-color: #ffffff; }
.px-color-option[data-color*="gray"] .px-color-circle,
.px-color-option[data-color*="grey"] .px-color-circle { background-color: #9e9e9e; }
.px-color-option[data-color*="brown"] .px-color-circle { background-color: #795548; }
.px-color-option[data-color*="navy"] .px-color-circle { background-color: #1a237e; }
.px-color-option[data-color*="teal"] .px-color-circle { background-color: #009688; }
.px-color-option[data-color*="lime"] .px-color-circle { background-color: #cddc39; }
.px-color-option[data-color*="cyan"] .px-color-circle { background-color: #00bcd4; }
.px-color-option[data-color*="indigo"] .px-color-circle { background-color: #3f51b5; }
.px-color-option[data-color*="amber"] .px-color-circle { background-color: #ffc107; }
.px-color-option[data-color*="gold"] .px-color-circle { background-color: #ffd700; }
.px-color-option[data-color*="silver"] .px-color-circle { background-color: #c0c0c0; }
.px-color-option[data-color*="maroon"] .px-color-circle { background-color: #800000; }
.px-color-option[data-color*="olive"] .px-color-circle { background-color: #808000; }

.px-form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.px-btn-cancel {
    background: #fff;
    color: #666;
    border: 2px solid #e0e0e0;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.px-btn-cancel:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.px-btn-submit {
    background: #000;
    color: #fff;
    border: 2px solid #000;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.px-btn-submit:hover {
    background: #333;
}

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

/* AJAX Message Styles */
.px-message {
    margin: 15px 0;
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid;
    animation: slideIn 0.3s ease-out;
}

.px-message-success {
    background-color: #e8f5e8;
    border-left-color: #4caf50;
    color: #2e7d32;
}

.px-message-error {
    background-color: #ffeaea;
    border-left-color: #f44336;
    color: #c62828;
}

.px-message-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.px-message-icon {
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

.px-message-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

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

/* Error Styles */
.px-review-form-container input.error,
.px-review-form-container textarea.error,
.px-review-form-container select.error,
.px-star-rating.error {
    border-color: #dc3545 !important;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    text-align: left; /* Left-align error messages */
}

/* Summary */
.px-reviews-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.px-reviews-rating {
    display: flex;
    align-items: center;
    gap: 15px;
}

.px-reviews-score {
    font-size: 48px;
    font-weight: 700;
    color: #000;
    line-height: 1;
}

.px-reviews-stars {
    display: flex;
    gap: 2px;
}

.px-star {
    font-size: 20px;
    color: #ddd;
}

.px-star.filled {
    color: #ffc107;
}

.px-reviews-count {
    font-size: 14px;
    color: #666;
    margin-left: 10px;
}

.px-reviews-tabs {
    display: flex;
}

.px-tab {
    padding: 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    border-bottom: 3px solid transparent;
    cursor: pointer;
}

.px-tab.active {
    color: #000;
    border-bottom-color: #000;
}

/* Reviews List */
.px-reviews-list {
    margin-top: 30px;
}

.px-review-item {
    display: flex;
    gap: 20px;
    padding: 30px 0;
    border-bottom: 1px solid #e0e0e0;
    align-items: flex-start;
}

.px-review-item:last-child {
    border-bottom: none;
}

.px-review-divider {
    width: 1px;
    background-color: #e0e0e0;
    flex-shrink: 0;
    align-self: stretch;
    margin: 0 5px;
}

.px-review-avatar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 80px;
}

.px-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #e6e5e5;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.px-avatar-info {
    text-align: center;
}

.px-customer-info {
    margin-bottom: 6px;
}

.px-verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #000;
    font-weight: 400;
    line-height: 1.2;
}

.px-verified.unverified {
    color: #666;
}

.px-author-name {
    font-size: 16px;
    color: #000;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.2;
}

.px-author-location {
    font-size: 12px;
    color: #999;
}

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

.px-review-header {
    margin-bottom: 15px;
}

.px-review-stars {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
}

.px-review-stars .px-star {
    font-size: 16px;
}

.px-review-product {
    font-size: 16px;
    font-weight: 600;
    color: #000;
    margin: 0 0 0 0;
    line-height: 1.4;
}

.px-review-message {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    margin: 0 0 20px 0;
}

.px-review-reply-section {
    margin: 20px 0;
}

.px-review-reply-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.px-review-reply {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    margin: 0;
    padding-left: 0;
}

.px-review-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 15px;
}

.px-review-date {
    font-size: 12px;
    color: #999;
}

.px-no-reviews {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .px-reviews-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .px-reviews-summary {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .px-reviews-score {
        font-size: 36px;
    }
    
    .px-review-form-container .px-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .px-form-actions {
        flex-direction: column;
    }
    
    .px-review-form-container {
        padding: 20px;
    }
}