/* =============================================
   RECURSOS Y MATERIALES — CSS
   Paleta: naranja #F7941D, morado #2D1B4E,
           gradiente rojo-naranja de fondo
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --orange:      #ffffff;
    --orange-dark: #D4760A;
    --orange-glow: rgba(247,148,29,.35);
    --purple:      #2b8799;
    --purple-mid:  #4bb5c1;
    --white:       #ffffff;
    --white-80:    rgba(255,255,255,.82);
    --white-20:    rgba(255,255,255,.18);
    --card-bg:     rgba(255,255,255,.12);
    --card-border: rgba(255,255,255,.22);
    --shadow:      0 8px 32px rgba(0,0,0,.35);
    --radius:      18px;
    --radius-sm:   10px;
    --font-main:   'Montserrat', sans-serif;
    --font-body:   'Nunito', sans-serif;
}

/* ---- BODY / BACKGROUND ---- */
body {
    font-family: var(--font-body);
    min-height: 100vh;
    background: linear-gradient(135deg,
        #112d7b 0%,
        #0a5cc0 25%,
        #10cbe0 50%,
        #1dc8f7 75%,
        #0a7dc0 100%);
    background-attachment: fixed;
    color: var(--white);
    overflow-x: hidden;
}

/* ---- NAVBAR ---- */
.navbar {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--purple);
    padding: 0 32px;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

.brand-name {
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--white);
    white-space: nowrap;
    margin-right: 8px;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    color: var(--white-80);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    font-family: var(--font-main);
    transition: background .2s, color .2s;
}
.nav-link:hover,
.nav-link.active {
    background: var(--orange);
    color: var(--white);
}

/* ---- HERO SELECTOR ---- */
.hero-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 64px 24px 80px;
    text-align: center;
    gap: 48px;
    animation: fadeUp .6s ease both;
}

.hero-title {
    font-family: var(--font-main);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    text-shadow: 0 4px 20px rgba(0,0,0,.4);
    letter-spacing: -.5px;
}

.hero-subtitle {
    margin-top: 10px;
    font-size: 1.05rem;
    color: var(--white-80);
}

/* ---- CATEGORY GRID ---- */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    max-width: 860px;
    width: 100%;
}

.cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 148px;
    padding: 28px 16px 22px;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    cursor: pointer;
    color: var(--white);
    font-family: var(--font-main);
    font-weight: 700;
    font-size: .9rem;
    letter-spacing: .3px;
    transition: transform .25s, background .25s, border-color .25s, box-shadow .25s;
    animation: fadeUp .6s ease both;
}
.cat-btn:nth-child(1) { animation-delay: .08s; }
.cat-btn:nth-child(2) { animation-delay: .16s; }
.cat-btn:nth-child(3) { animation-delay: .24s; }
.cat-btn:nth-child(4) { animation-delay: .32s; }
.cat-btn:nth-child(5) { animation-delay: .40s; }

.cat-btn:hover {
    transform: translateY(-6px) scale(1.04);
    background: rgba(247,148,29,.28);
    border-color: var(--orange);
    box-shadow: 0 12px 36px rgba(247,148,29,.35);
}
.cat-btn:active { transform: scale(.97); }

.cat-icon {
    width: 58px; height: 58px;
    border-radius: 50%;
    background: rgba(247,148,29,.2);
    border: 2px solid rgba(247,148,29,.45);
    display: grid;
    place-items: center;
    font-size: 1.8rem;
    color: var(--orange);
    transition: background .25s;
}
.cat-btn:hover .cat-icon { background: rgba(247,148,29,.35); }

.cat-icon--img img {
    width: 36px; height: 36px;
    object-fit: contain;
}

/* ---- CONTENT AREA ---- */
.content-area {
    padding: 0 28px 60px;
    animation: fadeUp .4s ease both;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
    padding: 18px 24px;
    background: var(--white-20);
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
}

.content-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--purple);
    border: 2px solid rgba(255,255,255,.15);
    color: var(--white);
    font-family: var(--font-main);
    font-weight: 700;
    font-size: .82rem;
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.back-btn:hover { background: var(--purple-mid); transform: translateX(-3px); }

.content-title {
    font-family: var(--font-main);
    font-size: 1.5rem;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0,0,0,.3);
}

.item-count {
    font-family: var(--font-main);
    font-size: .82rem;
    font-weight: 600;
    background: #2b8799;
    color: var(--white);
    padding: 4px 14px;
    border-radius: 20px;
}

/* ---- RECURSOS GRID ---- */
.recursos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* ---- RESOURCE CARD ---- */
.rec-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    backdrop-filter: blur(12px);
    text-decoration: none;
    color: var(--white);
    cursor: pointer;
    transition: transform .25s, box-shadow .25s, border-color .25s;
    animation: fadeUp .35s ease both;
}
.rec-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 16px 40px rgba(0,0,0,.35);
    border-color: var(--orange);
}

.rec-card-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    display: block;
    background: var(--purple);
}

/* Placeholder cuando no hay imagen */
.rec-card-thumb-placeholder {
    width: 100%;
    aspect-ratio: 16/10;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-mid) 100%);
    font-size: 2.8rem;
    color: var(--orange);
}

.rec-card-body {
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.rec-card-title {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.3;
}

.rec-card-tag {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    font-family: var(--font-main);
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(247,148,29,.25);
    color: var(--orange);
    border: 1px solid rgba(247,148,29,.4);
    width: fit-content;
}

/* ---- EMPTY STATE ---- */
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 24px;
    opacity: .7;
}
.empty-state i { font-size: 3rem; color: var(--orange); display: block; margin-bottom: 12px; }
.empty-state p { font-family: var(--font-main); font-weight: 600; font-size: 1rem; }

/* ---- ANIMATIONS ---- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
    .navbar { padding: 0 16px; gap: 12px; }
    .brand-name { font-size: 1rem; }
    .nav-link span { display: none; }
    .nav-link { padding: 6px 10px; }
    .hero-selector { padding: 40px 16px 60px; }
    .cat-btn { width: 120px; padding: 22px 12px 18px; }
    .content-area { padding: 0 16px 40px; }
    .recursos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
}