/**
 * Frontend styles for SGReview plugin
 *
 * @package SGReview
 */

/* CSS Variables for theming */
.sgreview-container {
    --sgreview-primary-color: #4285f4;
    --sgreview-secondary-color: #34a853;
    --sgreview-background-color: #ffffff;
    --sgreview-text-color: #333333;
    --sgreview-border-color: #e0e0e0;
    --sgreview-star-color: #ffc107;
    --sgreview-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Dark theme variables */
.sgreview-container.sgreview-theme-dark {
    --sgreview-background-color: #1e1e1e;
    --sgreview-text-color: #ffffff;
    --sgreview-border-color: #333333;
    --sgreview-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

/* Base container styles */
.sgreview-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--sgreview-background-color);
    color: var(--sgreview-text-color);
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
}

.sgreview-container * {
    box-sizing: border-box;
}

/* Grid Layout */
.sgreview-layout-grid .sgreview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* Review Cards */
.sgreview-card {
    background: var(--sgreview-background-color);
    border: 1px solid var(--sgreview-border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--sgreview-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sgreview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.sgreview-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 12px;
}

.sgreview-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.sgreview-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--sgreview-border-color);
}

.sgreview-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sgreview-primary-color), var(--sgreview-secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.sgreview-author-details {
    flex: 1;
}

.sgreview-author-name {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--sgreview-text-color);
}

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

.sgreview-star {
    font-size: 16px;
    color: var(--sgreview-star-color);
}

.sgreview-star.empty {
    color: var(--sgreview-border-color);
}

.sgreview-date {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.sgreview-theme-dark .sgreview-date {
    color: #aaa;
}

.sgreview-content {
    line-height: 1.6;
}

.sgreview-content p {
    margin: 0;
    color: var(--sgreview-text-color);
    font-size: 14px;
}

/* List Layout */
.sgreview-layout-list .sgreview-list {
    padding: 20px;
}

.sgreview-list-item {
    background: var(--sgreview-background-color);
    border: 1px solid var(--sgreview-border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--sgreview-shadow);
}

.sgreview-list-item:last-child {
    margin-bottom: 0;
}

/* Carousel Layout */
.sgreview-layout-carousel .sgreview-carousel {
    position: relative;
    padding: 20px;
    overflow: hidden;
}

.sgreview-carousel-inner {
    display: flex;
    transition: transform 0.3s ease;
}

.sgreview-carousel-slide {
    flex: 0 0 100%;
    padding: 0 10px;
}

@media (min-width: 768px) {
    .sgreview-carousel-slide {
        flex: 0 0 50%;
    }
}

@media (min-width: 1024px) {
    .sgreview-carousel-slide {
        flex: 0 0 33.333%;
    }
}

.sgreview-carousel-prev,
.sgreview-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sgreview-primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    z-index: 2;
}

.sgreview-carousel-prev:hover,
.sgreview-carousel-next:hover {
    background: var(--sgreview-secondary-color);
}

.sgreview-carousel-prev {
    left: 10px;
}

.sgreview-carousel-next {
    right: 10px;
}

/* No reviews message */
.sgreview-no-reviews {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.sgreview-theme-dark .sgreview-no-reviews {
    color: #aaa;
}

/* Error state */
.sgreview-error {
    text-align: center;
    padding: 20px;
    color: #d63638;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    margin: 20px;
}

.sgreview-theme-dark .sgreview-error {
    background: #3c1f1f;
    border-color: #5f2c2c;
    color: #f8b3b3;
}

/* Responsive design */
@media (max-width: 768px) {
    .sgreview-layout-grid .sgreview-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }

    .sgreview-card {
        padding: 15px;
    }

    .sgreview-carousel-prev,
    .sgreview-carousel-next {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .sgreview-container {
        margin: 15px 0;
    }

    .sgreview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sgreview-avatar,
    .sgreview-avatar-placeholder {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Accessibility */
.sgreview-container:focus-within {
    outline: 2px solid var(--sgreview-primary-color);
    outline-offset: 2px;
}

.sgreview-carousel-prev:focus,
.sgreview-carousel-next:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .sgreview-carousel-prev,
    .sgreview-carousel-next {
        display: none;
    }

    .sgreview-card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}
