/**
 * Sistema de Reviews - Estilos
 * Tecnosatelites
 * @version 1.0
 */

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */
.reviews-section {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

/* ============================================
   ESTADÍSTICAS Y RESUMEN
   ============================================ */
.reviews-stats {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stats-summary {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3rem;
    align-items: center;
}

.stats-overall {
    text-align: center;
    border-right: 1px solid #e0e0e0;
    padding-right: 3rem;
}

.overall-rating {
    font-size: 4rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.overall-stars {
    font-size: 2rem;
    color: #fbbf24;
    margin-bottom: 0.5rem;
}

.overall-count {
    font-size: 0.95rem;
    color: #666;
}

.stats-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-row {
    display: grid;
    grid-template-columns: 50px 1fr 60px 60px;
    align-items: center;
    gap: 1rem;
}

.stat-label {
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
}

.stat-bar {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
    transition: width 0.3s ease;
}

.stat-percent {
    font-size: 0.9rem;
    color: #666;
    text-align: right;
}

.stat-count {
    font-size: 0.85rem;
    color: #999;
}

/* ============================================
   FORMULARIO PARA AGREGAR REVIEW
   ============================================ */
.add-review-section {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.add-review-section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
}

.review-form {
    max-width: 700px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.85rem;
    color: #666;
}

/* Star Rating Input */
.star-rating-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 0.25rem;
    font-size: 2.5rem;
}

.star-rating-input input {
    display: none;
}

.star-rating-input label {
    cursor: pointer;
    color: #d1d5db;
    transition: color 0.2s;
}

.star-rating-input label:hover,
.star-rating-input label:hover ~ label {
    color: #fbbf24;
}

.star-rating-input input:checked ~ label {
    color: #fbbf24;
}

.rating-value {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: #666;
    font-weight: 500;
}

/* Contador de caracteres */
.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: #999;
    margin-top: 0.375rem;
}

/* Botón de envío */
.review-form .btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.review-form .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.review-form .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.review-form .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mensajes del formulario */
.form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.form-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.form-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ============================================
   CONTROLES (FILTROS Y ORDENAMIENTO)
   ============================================ */
.reviews-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.reviews-filter,
.reviews-sort {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.reviews-filter label,
.reviews-sort label {
    font-weight: 500;
    color: #666;
    font-size: 0.9rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.filter-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.reviews-sort select {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

/* ============================================
   LISTA DE REVIEWS
   ============================================ */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.review-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}

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

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.review-author {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.author-name {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 1rem;
}

.verified-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    background: #d1fae5;
    color: #065f46;
    font-size: 0.75rem;
    border-radius: 4px;
    font-weight: 500;
}

.review-date {
    font-size: 0.85rem;
    color: #666;
}

.review-rating {
    font-size: 1.25rem;
    color: #fbbf24;
}

.review-body {
    margin-bottom: 1rem;
}

.review-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.review-comment {
    color: #4b5563;
    line-height: 1.6;
    font-size: 0.95rem;
}

.review-footer {
    display: flex;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.helpful-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.helpful-btn:hover {
    background: #f9fafb;
    border-color: #3b82f6;
}

/* ============================================
   PAGINACIÓN
   ============================================ */
.reviews-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.page-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.page-dots {
    padding: 0.5rem;
    color: #999;
}

/* ============================================
   ESTADOS ESPECIALES
   ============================================ */
.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1rem;
}

.error {
    text-align: center;
    padding: 3rem;
    color: #dc2626;
    font-size: 1rem;
}

.no-reviews {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.no-reviews p:first-child {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Skeleton loading */
.stats-loading {
    padding: 2rem;
}

.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-text {
    height: 20px;
    border-radius: 4px;
    margin-bottom: 1rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   ESTRELLAS (COMPONENTE REUTILIZABLE)
   ============================================ */
.stars {
    color: #fbbf24;
    letter-spacing: 2px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .reviews-section {
        padding: 0 1rem;
        margin: 2rem auto;
    }

    .stats-summary {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .stats-overall {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding-right: 0;
        padding-bottom: 2rem;
    }

    .reviews-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .reviews-filter {
        flex-wrap: wrap;
    }

    .filter-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    .review-header {
        flex-direction: column;
        gap: 1rem;
    }

    .review-rating {
        align-self: flex-start;
    }

    .reviews-stats,
    .add-review-section,
    .review-card {
        padding: 1.25rem;
    }

    .overall-rating {
        font-size: 3rem;
    }

    .overall-stars {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stat-row {
        grid-template-columns: 40px 1fr 50px;
        font-size: 0.85rem;
    }

    .stat-count {
        display: none;
    }

    .star-rating-input {
        font-size: 2rem;
    }

    .reviews-pagination {
        gap: 0.25rem;
    }

    .page-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
}

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

/* Focus visible para navegación por teclado */
.filter-btn:focus-visible,
.page-btn:focus-visible,
.helpful-btn:focus-visible,
.review-form input:focus-visible,
.review-form textarea:focus-visible,
.review-form button:focus-visible {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}
