/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2em;
}

h2 {
    color: #34495e;
    margin: 30px 0 20px;
    font-size: 1.5em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* Class Selector */
.class-selector {
    margin-bottom: 30px;
}

.class-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.class-selector select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.class-selector select:hover,
.class-selector select:focus {
    border-color: #3498db;
    outline: none;
}

/* Review Summary */
.review-summary {
    margin: 30px 0;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.average-rating {
    text-align: center;
}

.rating-number {
    font-size: 3em;
    font-weight: bold;
    display: block;
}

.summary-card .stars {
    font-size: 1.5em;
    margin: 10px 0;
}

.summary-card .stars .star {
    color: #ffd700;
}

.review-count {
    display: block;
    font-size: 0.9em;
    opacity: 0.9;
    margin-top: 5px;
}

.rating-distribution {
    flex: 1;
    margin-left: 40px;
    min-width: 300px;
}

.distribution-bar {
    display: flex;
    align-items: center;
    margin: 8px 0;
}

.distribution-bar .label {
    width: 60px;
    font-size: 0.9em;
}

.distribution-bar .bar-container {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin: 0 10px;
}

.distribution-bar .bar-fill {
    height: 100%;
    background: #ffd700;
    transition: width 0.5s ease;
}

.distribution-bar .count {
    width: 40px;
    text-align: right;
    font-size: 0.9em;
}

/* Form Styles */
.review-form {
    margin: 30px 0;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.required {
    color: #e74c3c;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: #3498db;
    outline: none;
}

/* Star Rating Input */
.star-rating {
    font-size: 2.5em;
    cursor: pointer;
    user-select: none;
}

.star-rating .star {
    color: #ddd;
    transition: color 0.2s;
}

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

/* Character Counter */
.char-counter {
    text-align: right;
    font-size: 0.9em;
    color: #777;
    margin-top: 5px;
}

.char-counter .warning {
    color: #e74c3c;
    margin-left: 10px;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-primary:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #ecf0f1;
    color: #2c3e50;
    display: block;
    margin: 20px auto;
}

.btn-secondary:hover {
    background-color: #bdc3c7;
}

/* Messages */
.message {
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    font-weight: 500;
}

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

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

.message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

#reviewsContainer {
    display: grid;
    gap: 20px;
}

.review-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.3s;
}

.review-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.review-author {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1em;
}

.review-rating {
    font-size: 1.2em;
}

.review-rating .star {
    color: #ddd;
}

.review-rating .star.filled {
    color: #ffd700;
}

.review-date {
    color: #999;
    font-size: 0.9em;
    margin-top: 5px;
}

.review-comment {
    color: #555;
    line-height: 1.8;
    margin-top: 10px;
}

.no-reviews {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    .summary-card {
        flex-direction: column;
        text-align: center;
    }

    .rating-distribution {
        margin-left: 0;
        margin-top: 20px;
        width: 100%;
    }

    .review-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .star-rating {
        font-size: 2em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    .review-form {
        padding: 20px;
    }

    .btn {
        width: 100%;
    }
}
