/**
 * Estilos Frontend para Tutor LMS Reports Dashboard v4.1
 * Para uso en páginas públicas con shortcodes
 */

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */
.tlrd-frontend-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
}

/* ========================================
   HEADER
   ======================================== */
.tlrd-header {
    margin-bottom: 30px;
    text-align: center;
}

.tlrd-header h1 {
    font-size: 32px;
    margin: 0 0 10px 0;
    color: #333;
}

.tlrd-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* ========================================
   SECCIONES
   ======================================== */
.tlrd-section {
    background: #fff;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tlrd-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    color: #333;
}

.tlrd-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 20px;
    color: #333;
}

/* ========================================
   TARJETAS DE ESTADÍSTICAS
   ======================================== */
.tlrd-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.tlrd-stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tlrd-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.tlrd-stat-card .stat-icon {
    font-size: 48px;
    opacity: 0.9;
}

.tlrd-stat-card .stat-content h3 {
    margin: 0;
    font-size: 36px;
    font-weight: 700;
    color: #fff;
}

.tlrd-stat-card .stat-content p {
    margin: 5px 0 0 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Variantes de colores */
.tlrd-stat-card-1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.tlrd-stat-card-2 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.tlrd-stat-card-3 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.tlrd-stat-card-4 {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.tlrd-stat-card-secondary {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #333;
}

.tlrd-stat-card-secondary .stat-content h3 {
    color: #333;
}

/* ========================================
   FORMULARIOS Y FILTROS
   ======================================== */
.tlrd-filter-form .filter-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 220px;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.filter-group select,
.filter-group input[type="date"],
.filter-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background-color: #fff;
    color: #333;
    
    /* FIX CRÍTICO: Asegurar que el texto sea visible */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* FIX: Flecha personalizada para select */
.filter-group select {
    background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}

/* FIX: Options del select */
.filter-group select option {
    padding: 10px;
    background-color: #fff;
    color: #333;
    font-size: 14px;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus,
.filter-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================================
   BOTONES
   ======================================== */
.tlrd-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.tlrd-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.tlrd-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.tlrd-btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.tlrd-btn-secondary:hover {
    background: #d0d0d0;
}

.tlrd-btn-success {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #fff;
}

.tlrd-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(67, 233, 123, 0.3);
}

/* ========================================
   TABLAS
   ======================================== */
.tlrd-table-wrapper {
    overflow-x: auto;
    margin-top: 15px;
}

.tlrd-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e0e0e0;
}

.tlrd-table thead {
    background: #f8f9fa;
}

.tlrd-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.tlrd-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.tlrd-table tbody tr:hover {
    background: #f8f9fa;
}

.tlrd-table .text-center {
    text-align: center;
}

/* ========================================
   BARRAS DE PROGRESO
   ======================================== */
.tlrd-progress-bar {
    position: relative;
    background: #e9ecef;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
}

.tlrd-progress-fill {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    height: 100%;
    transition: width 0.5s ease;
}

.tlrd-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #333;
    font-size: 13px;
    z-index: 2;
}

/* ========================================
   BARRAS DE COMPARACIÓN
   ======================================== */
.tlrd-rate-bar {
    position: relative;
    background: #e9ecef;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
}

.tlrd-rate-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.tlrd-rate-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #000;
    font-size: 13px;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    z-index: 2;
}

/* ========================================
   BADGES
   ======================================== */
.tlrd-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tlrd-badge-completado {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.tlrd-badge-en-progreso {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.tlrd-badge-aprobado {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.tlrd-badge-no-aprobado {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========================================
   ESTADO VACÍO
   ======================================== */
.tlrd-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.tlrd-empty-state p {
    font-size: 16px;
    margin: 10px 0;
}

.tlrd-empty-state a {
    color: #667eea;
    text-decoration: underline;
}

/* ========================================
   PERMISOS DENEGADOS
   ======================================== */
.tlrd-permission-denied {
    max-width: 600px;
    margin: 40px auto;
}

.tlrd-alert {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

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

.tlrd-alert strong {
    display: block;
    font-size: 18px;
    margin-bottom: 10px;
}

.tlrd-alert p {
    margin: 10px 0;
}

/* ========================================
   ENLACES RÁPIDOS
   ======================================== */
.tlrd-quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tlrd-quick-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.tlrd-quick-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    color: #fff;
}

.tlrd-quick-link .icon {
    font-size: 32px;
}

.tlrd-quick-link .text {
    font-size: 16px;
    font-weight: 600;
}

/* ========================================
   LEYENDA
   ======================================== */
.tlrd-legend {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.tlrd-legend h3 {
    margin-bottom: 15px;
    font-size: 16px;
}

.tlrd-legend-items {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.tlrd-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.tlrd-legend-color {
    display: inline-block;
    width: 40px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* ========================================
   ACCIONES
   ======================================== */
.tlrd-actions {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================================
   PORCENTAJES
   ======================================== */
.tlrd-percentage {
    font-weight: 600;
    font-size: 14px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .tlrd-frontend-wrapper {
        padding: 15px;
    }
    
    .tlrd-header h1 {
        font-size: 24px;
    }
    
    .tlrd-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tlrd-filter-form .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .tlrd-quick-links {
        grid-template-columns: 1fr;
    }
    
    .tlrd-legend-items {
        flex-direction: column;
        gap: 15px;
    }
    
    .tlrd-table-wrapper {
        overflow-x: scroll;
    }
}

/* ========================================
   DETALLES DEL CURSO
   ======================================== */
.tlrd-course-details {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
}

.tlrd-course-details h3 {
    color: #667eea;
    margin-bottom: 20px;
}
