/* Real Time Reviews Plugin CSS */

/* CSS Variables for Customization */
:root {
    --primary-color: #00b67a;
    --text-color: #333333;
    --background-color: #ffffff;
    --star-color: #ffc107;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-gray: #f8f9fa;
    --medium-gray: #6c757d;
    --dark-gray: #343a40;
}

/* Reset and Base Styles */
.realtime-reviews-container * {
    box-sizing: border-box;
}

.realtime-reviews-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Write Review Section */
.write-review-section {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.write-review-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.write-review-btn:hover {
    background: color-mix(in srgb, var(--primary-color) 85%, black);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.write-review-btn:active {
    transform: translateY(0);
}

.write-review-btn svg {
    transition: transform 0.3s ease;
}

.write-review-btn:hover svg {
    transform: rotate(15deg);
}

/* Modal Styles */
.review-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    animation: modalFadeIn 0.3s ease;
}

.review-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--background-color);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 24px 30px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--background-color);
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
}

.close-modal {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: var(--medium-gray);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: var(--light-gray);
    color: var(--text-color);
}

/* Form Styles */
.review-form {
    padding: 30px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--background-color);
    color: var(--text-color);
}

/* Country Dropdown Specific Styles */
.form-group select {
    cursor: pointer;
    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;
    min-height: 50px;
    line-height: 1.4;
}

.form-group select option {
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.5;
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* Mobile-specific dropdown improvements */
@media (max-width: 768px) {
    .form-group select {
        min-height: 54px;
        font-size: 16px;
        padding: 16px 40px 16px 16px;
        touch-action: manipulation;
    }
    
    .form-group select option {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 50px;
        line-height: 1.6;
    }
    
    /* Improve dropdown arrow visibility on mobile */
    .form-group select {
        background-size: 16px;
        background-position: right 16px center;
        padding-right: 50px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .form-group select {
        min-height: 56px;
        padding: 18px 50px 18px 18px;
        font-size: 16px;
    }
    
    .form-group select option {
        padding: 18px 22px;
        font-size: 16px;
        min-height: 52px;
    }
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 182, 122, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--medium-gray);
}

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

/* Rating Input */
.rating-input {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.rating-input .star {
    font-size: 32px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.rating-input .star:hover,
.rating-input .star.active {
    color: var(--star-color);
    transform: scale(1.1);
}

.rating-input .star:active {
    transform: scale(0.95);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.btn-cancel {
    background: var(--light-gray);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-cancel:hover {
    background: #e9ecef;
    border-color: var(--medium-gray);
}

.btn-submit {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

.btn-submit:hover {
    background: color-mix(in srgb, var(--primary-color) 85%, black);
    border-color: color-mix(in srgb, var(--primary-color) 85%, black);
}

.btn-submit:disabled {
    background: var(--medium-gray);
    border-color: var(--medium-gray);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Review Statistics */
.review-stats {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stats-header {
    margin-bottom: 28px;
}

.overall-rating {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
}

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

.rating-number {
    font-size: 56px;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1;
}

.stars-display {
    display: flex;
    gap: 4px;
}

.stars-display .star {
    font-size: 24px;
    color: #ddd;
    transition: color 0.3s ease;
}

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

.rating-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rating-label {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
}

.review-count {
    font-size: 16px;
    color: var(--medium-gray);
}

/* Rating Breakdown */
.rating-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.rating-stars {
    min-width: 120px;
    display: flex;
    gap: 2px;
}

.rating-stars .star {
    font-size: 16px;
    color: #ddd;
}

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

.rating-bar {
    flex: 1;
    height: 12px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.rating-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), color-mix(in srgb, var(--primary-color) 80%, white));
    transition: width 0.8s ease;
    border-radius: 6px;
}

.rating-count {
    min-width: 40px;
    text-align: right;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

/* Reviews Section */
.reviews-section {
    margin-top: 32px;
}

.reviews-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.reviews-header h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
}

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

.no-reviews {
    text-align: center;
    padding: 60px 20px;
    background: var(--light-gray);
    border-radius: 12px;
    color: var(--medium-gray);
}

.no-reviews p {
    font-size: 18px;
    margin: 0;
}

/* Load More Button */
.load-more-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
}

.load-more-btn {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.load-more-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 182, 122, 0.3);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.load-more-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* Success/Error Messages */
.message {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

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

.message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .realtime-reviews-container {
        padding: 0 16px;
    }
    
    .overall-rating {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .rating-number {
        font-size: 48px;
    }
    
    .rating-row {
        gap: 12px;
    }
    
    .rating-stars {
        min-width: 100px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 16px 20px 12px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .review-form {
        padding: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        font-size: 15px;
        margin-bottom: 10px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
        margin-top: 24px;
    }
    
    .btn-cancel,
    .btn-submit {
        width: 100%;
        padding: 16px;
        font-size: 16px;
    }
    
    .rating-input .star {
        font-size: 28px;
    }
    
    .reviews-header h3 {
        font-size: 24px;
    }
    
    .review-stats {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .write-review-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .rating-number {
        font-size: 40px;
    }
    
    .rating-label {
        font-size: 18px;
    }
    
    .review-count {
        font-size: 14px;
    }
    
    .modal-content {
        width: 98%;
        margin: 5px;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 12px 16px 8px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .review-form {
        padding: 16px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .rating-input .star {
        font-size: 24px;
        gap: 4px;
    }
    
    /* Ensure dropdown options are fully visible on small screens */
    .form-group select {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .form-group select option {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .review-item {
        border-width: 2px;
    }
    
    .btn-cancel,
    .btn-submit {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Review Item Styles */
.review-item {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.review-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
/* Review Header - Now contains reviewer info */
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

/* Review Content - Now contains rating and message */
.review-content {
    margin-bottom: 20px;
}

.review-content .review-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    line-height: 1.4;
}

.review-content .review-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

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

.review-rating .star {
    font-size: 16px;
    color: #ddd;
}

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

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

.review-date {
    font-size: 14px;
    color: var(--medium-gray);
}

.review-content {
    margin-bottom: 20px;
}

.review-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 12px 0;
}

.review-message {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
}

.review-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #e0e0e0);
}

/* Reviewer info is now in header */
.review-header .reviewer-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reviewer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.reviewer-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reviewer-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.reviewer-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--medium-gray);
}

.country-flag {
    font-size: 18px;
    line-height: 1;
    margin-right: 6px;
    display: inline-block;
    vertical-align: middle;
}

/* Mobile responsive improvements for country display */
@media (max-width: 768px) {
    .reviewer-location {
        font-size: 15px;
        gap: 8px;
    }
    
    .country-flag {
        font-size: 20px;
        margin-right: 8px;
    }
    
    .reviewer-info {
        gap: 14px;
    }
    
    .reviewer-details {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .reviewer-location {
        font-size: 14px;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .country-flag {
        font-size: 18px;
        margin-right: 6px;
    }
    
    .review-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .review-header .reviewer-info {
        width: 100%;
        gap: 12px;
    }
    
    .review-footer {
        justify-content: center;
    }
    
    .review-actions {
        gap: 16px;
    }
}

.review-actions {
    display: flex;
    gap: 8px;
}

.helpful-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--medium-gray);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.helpful-btn:hover {
    background: var(--light-gray);
    color: var(--text-color);
}

/* Print styles */
@media print {
    .write-review-section,
    .review-actions,
    .load-more-section {
        display: none;
    }
    
    .review-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}