/* ===========================
   VARIABLES CSS
   =========================== */
:root {
    --primary: #6A0572;        /* Morado */
    --secondary: #F74436;       /* Rojo */
    --accent: #F08E03;          /* Naranja */
    --dark-bg: #1E1E2F;         /* Azul oscuro */
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --medium-gray: #6c757d;
    --dark-gray: #343a40;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 12px;
    --header-height: 80px; /* Espacio reservado para el header del layout */
}

/* ===========================
   RESET Y BASE
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* ===========================
   CONTENEDOR PRINCIPAL
   =========================== */
.courses-page {
    padding-top: var(--header-height); /* Espacio para header fijo */
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

/* ===========================
   HEADER DE PÁGINA
   =========================== */
.page-header {
    text-align: center;
    padding: 60px 0 40px;
    position: relative;
    z-index: 3;
}

.page-header h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.divider {
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    margin: 0 auto 20px;
    border-radius: 2px;
    position: relative;
}

.divider::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -10px;
    right: -10px;
    height: 8px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    border-radius: 4px;
    opacity: 0.3;
}

.page-subtitle {
    font-size: 1.25rem;
    color: var(--medium-gray);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

/* ===========================
   PARTÍCULAS DECORATIVAS
   =========================== */
.course-particles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.course-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    border-radius: 50%;
    opacity: 0.6;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.3;
    }
}

/* ===========================
   SECCIÓN DE FILTROS
   =========================== */
.filters-section {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-bar {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    background: var(--white);
    font-size: 1rem;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--medium-gray);
    font-size: 1.1rem;
    transition: var(--transition);
}

.search-input:focus + .search-icon {
    color: var(--primary);
}

/* ===========================
   GRID DE CURSOS
   =========================== */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

/* ===========================
   TARJETAS DE CURSOS
   =========================== */
.course-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
}

.course-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

/* Imagen de la tarjeta */
.card-image {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.course-card:hover .card-image img {
    transform: scale(1.1);
}

/* Badges */
.badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--white);
    z-index: 2;
}

.badge-featured {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.badge-new {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
}

/* Overlay de la tarjeta */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(106, 5, 114, 0.9), rgba(247, 68, 54, 0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.course-card:hover .card-overlay {
    opacity: 1;
}

.preview-btn {
    background: var(--white);
    color: var(--primary);
    padding: 12px 24px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    transform: translateY(20px);
}

.course-card:hover .preview-btn {
    transform: translateY(0);
}

.preview-btn:hover {
    background: var(--light-gray);
    transform: scale(1.05);
}

/* Contenido de la tarjeta */
.card-content {
    padding: 25px;
}

.course-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.course-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-gray);
    line-height: 1.3;
    flex: 1;
}

.course-category {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.course-description {
    color: var(--medium-gray);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Meta información del curso */
.course-meta {
    margin-bottom: 20px;
}

.course-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--medium-gray);
}

.stat-item i {
    color: var(--primary);
    font-size: 0.9rem;
}

.instructor-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--medium-gray);
}

.instructor-info i {
    color: var(--accent);
}

/* Precios */
.course-price {
    margin-bottom: 20px;
}

.price-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.original-price {
    font-size: 0.9rem;
    color: var(--medium-gray);
    text-decoration: line-through;
}

.current-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.discount-badge {
    background: var(--secondary);
    color: var(--white);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Acciones de la tarjeta */
.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-primary.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.btn-primary.error {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

/* ===========================
   ESTADO VACÍO
   =========================== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--medium-gray);
}

.empty-state i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
    opacity: 0.7;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--dark-gray);
}

.empty-state p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ===========================
   PAGINACIÓN
   =========================== */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

/* ===========================
   NOTIFICACIONES
   =========================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    transition: var(--transition);
    z-index: 1000;
    max-width: 350px;
    border-left: 4px solid var(--primary);
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left-color: #28a745;
}

.notification-success i {
    color: #28a745;
}

.notification-error {
    border-left-color: #dc3545;
}

.notification-error i {
    color: #dc3545;
}

/* ===========================
   ANIMACIONES
   =========================== */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: slideInUp 0.6s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 1200px) {
    .course-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .page-header {
        padding: 40px 0 30px;
    }
    
    .course-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .course-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .course-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .price-container {
        justify-content: space-between;
    }
    
    .notification {
        right: 15px;
        left: 15px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 2rem;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
    
    .card-image {
        height: 180px;
    }
    
    .card-content {
        padding: 20px;
    }
    
    .course-header h3 {
        font-size: 1.1rem;
    }
}

/* ===========================
   MEJORAS DE ACCESIBILIDAD
   =========================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .course-card:hover {
        transform: none;
    }
    
    .course-particle {
        animation: none;
    }
}

/* Focus states para accesibilidad */
.btn:focus,
.search-input:focus,
.preview-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===========================
   UTILIDADES
   =========================== */
.text-center {
    text-align: center;
}

.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.p-0 {
    padding: 0 !important;
}