:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary: #0891b2;
    --accent: #059669;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #dc2626;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray: #64748b;
    --light: #f1f5f9;
    --white: #ffffff;
    --gradient-1: linear-gradient(135deg, #1e40af 0%, #0891b2 100%);
    --gradient-2: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    --gradient-3: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.navbar .container-fluid {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
}

.brand-icon {
    font-size: 2rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.navbar-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--gray);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-1);
    transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--white);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Hero Section */
.hero-section {
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    background: linear-gradient(135deg, #1e40af 0%, #0891b2 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-decoration {
    width: 100px;
    height: 4px;
    background: var(--gradient-1);
    margin: 0 auto;
    border-radius: 2px;
    animation: expandWidth 1s ease-out 0.4s both;
}

@keyframes expandWidth {
    from { width: 0; }
    to { width: 100px; }
}

/* Filters */
.filters-section {
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.filter-btn,
.filter-type-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.filter-btn:hover,
.filter-type-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background: rgba(30, 64, 175, 0.2);
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.3);
}

.filter-btn.active,
.filter-type-btn.active {
    background: var(--gradient-1);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.4);
}

.filter-icon {
    font-size: 1.2rem;
}

/* Resources Grid */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    animation: fadeIn 1s ease-out 0.8s both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Resource Card */
.resource-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: scaleIn 0.5s ease-out both;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.resource-card:nth-child(1) { animation-delay: 0.1s; }
.resource-card:nth-child(2) { animation-delay: 0.2s; }
.resource-card:nth-child(3) { animation-delay: 0.3s; }
.resource-card:nth-child(4) { animation-delay: 0.4s; }
.resource-card:nth-child(5) { animation-delay: 0.5s; }
.resource-card:nth-child(6) { animation-delay: 0.6s; }
.resource-card:nth-child(7) { animation-delay: 0.7s; }
.resource-card:nth-child(8) { animation-delay: 0.8s; }
.resource-card:nth-child(9) { animation-delay: 0.9s; }

.card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.resource-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(30, 64, 175, 0.5);
    box-shadow: 0 20px 40px rgba(30, 64, 175, 0.3);
}

.resource-card:hover .card-glow {
    opacity: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.resource-icon {
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.resource-badges {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-organismo {
    background: var(--gradient-1);
    color: var(--white);
}

.badge-caborca {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
}

.badge-ramosarizpe {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.badge-tepatitlan {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.badge-magdalena {
    background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
}

.badge-tipo {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-body {
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
}

.resource-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--white);
}

.resource-description {
    color: var(--gray);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.resource-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--gray);
}

.meta-icon {
    font-size: 1rem;
}

.card-footer {
    position: relative;
    z-index: 1;
}

.download-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--gradient-1);
    border: none;
    border-radius: 12px;
    color: var(--white);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.5);
}

.download-btn:active {
    transform: scale(0.98);
}

.btn-icon {
    font-size: 1.2rem;
    animation: bounceDown 1.5s infinite;
}

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* Footer */
.footer {
    margin-top: 5rem;
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gray);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .navbar-menu {
        gap: 1rem;
    }
    
    .filter-group {
        gap: 0.75rem;
    }
    
    .filter-btn,
    .filter-type-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 2rem 1rem;
    }
    
    .resource-card {
        padding: 1.25rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
}

/* Animación de filtrado */
.resource-card.hidden {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.8);
        display: none;
    }
}

.resource-card.visible {
    animation: fadeInScale 0.4s ease-out forwards;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
