/* === VARIABLES === */
:root {
    --primary: #e8363d;
    --primary-dark: #c0272d;
    --accent: #f5a623;
    --bg: #f7f6f3;
    --white: #ffffff;
    --dark: #1a1a1a;
    --gray: #6b7280;
    --gray-light: #e5e7eb;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 12px 40px rgba(0,0,0,0.15);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* === HEADER === */
#header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-light);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 72px;
    display: flex;
    align-items: center;
    gap: 40px;
}
#logo {
    height: 42px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}
.header-nav {
    display: none;
    gap: 28px;
    flex: 1;
}
@media (min-width: 768px) {
    .header-nav { display: flex; }
}
.header-nav a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray);
    transition: color var(--transition);
}
.header-nav a:hover { color: var(--dark); }
.header-actions { margin-left: auto; }

/* Carrito */
.carrito-wrap { position: relative; }
.btn-carrito {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--gray-light);
    transition: background var(--transition);
}
.btn-carrito:hover { background: var(--gray-light); }
.btn-carrito img { width: 20px; filter: invert(0.3); }
.carrito-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

#carrito-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 12px);
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 380px;
    padding: 20px;
    border: 1px solid var(--gray-light);
    animation: dropIn 0.2s ease;
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.carrito-wrap:hover #carrito-dropdown,
.carrito-wrap:focus-within #carrito-dropdown {
    display: block;
}
.carrito-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.carrito-header-row h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
}
.btn-vaciar {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--primary);
    transition: all var(--transition);
    cursor: pointer;
    background: none;
}
.btn-vaciar:hover { background: var(--primary); color: white; }

.carrito-vacio { text-align: center; padding: 24px 0; color: var(--gray); font-size: 0.9rem; }

#lista-carrito { width: 100%; border-collapse: collapse; }
#lista-carrito td { padding: 10px 6px; border-bottom: 1px solid var(--gray-light); font-size: 0.85rem; vertical-align: middle; }
#lista-carrito td:first-child img { width: 50px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); }
#lista-carrito td:last-child { text-align: right; }

.carrito-total-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-light);
    font-weight: 600;
}
.carrito-total { color: var(--primary); font-size: 1.2rem; font-weight: 700; }

.borrar-curso {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fee2e2;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.75rem;
    transition: background var(--transition);
}
.borrar-curso:hover { background: var(--primary); color: white; }

/* === HERO === */
#hero {
    background-image: url(../img/hero.jpg);
    background-size: cover;
    background-position: center;
    min-height: 480px;
    display: flex;
    align-items: center;
    position: relative;
}
#hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(10,10,10,0.75) 0%, rgba(10,10,10,0.3) 70%, transparent 100%);
}
.hero-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 24px;
    max-width: 600px;
    margin-left: max(24px, calc(50vw - 600px + 24px));
}
.hero-badge {
    display: inline-block;
    background: var(--accent);
    color: #1a1a1a;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    letter-spacing: 0.02em;
    margin-bottom: 20px;
}
.hero-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    color: white;
    line-height: 1.1;
    margin-bottom: 16px;
}
.hero-content h1 em {
    font-style: italic;
    color: var(--accent);
}
.hero-sub {
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    margin-bottom: 28px;
}
.hero-sub strong { color: var(--accent); }

/* Search */
.search-form {
    display: flex;
    gap: 8px;
    max-width: 480px;
}
.search-form input {
    flex: 1;
    height: 52px;
    padding: 0 20px;
    border-radius: 12px;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.btn-search {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
}
.btn-search:hover { background: var(--primary-dark); }
.btn-search img { width: 20px; filter: brightness(10); }

/* === BARRA BENEFICIOS === */
.barra-beneficios {
    background: linear-gradient(135deg, #741d51 0%, #e44e52 100%);
    padding: 28px 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px;
}
.beneficio {
    display: flex;
    align-items: center;
    gap: 14px;
    color: white;
}
.beneficio img { width: 36px; filter: brightness(10); opacity: 0.9; }
.beneficio strong { display: block; font-size: 0.95rem; font-weight: 700; }
.beneficio span { font-size: 0.82rem; opacity: 0.8; }

/* === SECCIÓN CURSOS === */
#lista-cursos {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 24px;
}
.seccion-header {
    margin-bottom: 40px;
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}
.seccion-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
}
.seccion-header .accent { color: var(--primary); }
#resultados-texto { color: var(--gray); font-size: 0.9rem; }

/* Grid de cursos */
.cursos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* Card */
.card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-shadow-hover);
}
.card.oculta { display: none; }

.card-img-wrap {
    position: relative;
    overflow: hidden;
    height: 180px;
}
.card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.card:hover .card-img-wrap img { transform: scale(1.05); }

.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.03em;
}
.card-badge--new { background: #059669; }

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.card-body h4 {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--dark);
}
.instructor {
    font-size: 0.8rem;
    color: var(--gray);
    margin-bottom: 8px;
}
.estrellas {
    height: 16px;
    object-fit: contain;
    margin-bottom: 12px;
}
.precio-wrap {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
    margin-top: auto;
    padding-top: 10px;
}
.precio-antes {
    font-size: 0.9rem;
    color: var(--gray);
    text-decoration: line-through;
}
.precio-ahora {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
}

.btn-agregar {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: background var(--transition), transform var(--transition);
}
.btn-agregar:hover { background: var(--primary-dark); transform: scale(1.02); }
.btn-agregar.agregado {
    background: #059669;
}

/* Sin resultados */
.sin-resultados {
    text-align: center;
    padding: 60px 24px;
    color: var(--gray);
}
.sin-resultados p { font-size: 1.1rem; margin-bottom: 16px; }
.btn-limpiar {
    padding: 10px 24px;
    border-radius: 30px;
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    z-index: 999;
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === FOOTER === */
#footer {
    background: #111;
    color: rgba(255,255,255,0.7);
    margin-top: 60px;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 56px 24px 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 48px;
    justify-content: space-between;
}
.footer-brand { max-width: 280px; }
.footer-brand p { font-size: 0.88rem; margin-top: 12px; line-height: 1.7; }
.footer-nav {
    display: flex;
    gap: 60px;
    flex-wrap: wrap;
}
.footer-nav > div {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.footer-nav strong {
    color: white;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}
.footer-nav a {
    color: rgba(255,255,255,0.55);
    font-size: 0.88rem;
    transition: color var(--transition);
}
.footer-nav a:hover { color: white; }
.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 24px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.35);
}

/* === UTILS === */
.hidden { display: none !important; }