/* ===============================================
   COMPONENTS.CSS - CAPC-ITM
   Estilos base para componentes compartidos
   Versión actualizada y optimizada
   =============================================== */

/* ========================================
   VARIABLES CSS GLOBALES
   ======================================== */
:root {
    /* Colores principales */
    --primary-blue: #1e3a8a;
    --secondary-blue: #3b82f6;
    --accent-blue: #60a5fa;
    --light-blue: #93c5fd;
    --cyan: #00f2ff;
    --dark-blue: #0037ff;
    
    /* Grises */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Espaciado */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Transiciones */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.4s ease;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Radios de borde */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
}

/* ========================================
   RESET Y ESTILOS BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #dbeafe, #f4f4f4);
    margin: 0;
    padding: 0;
    font-size: 18px;
    line-height: 1.6;
    color: var(--gray-700);
    transition: background 1s ease-in-out;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   HEADER Y SECCIÓN DEL CLUB
   ======================================== */
header {
    background: linear-gradient(to right, var(--primary-blue), var(--secondary-blue));
    color: #ffffff;
    padding: 0;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.club-section {
    background-image: url('../../images/backgrounds/fondo.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #fff;
    padding: clamp(40px, 10vw, 80px) 20px;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
    text-align: center;
    animation: pulseGlow 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: clamp(200px, 25vh, 300px);
}

.club-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.club-section > * {
    position: relative;
    z-index: 2;
}

.club-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(15px, 3vw, 25px);
    animation: fadeInUp 1.2s ease-out;
}

.club-logo {
    width: clamp(80px, 12vw, 150px);
    height: clamp(80px, 12vw, 150px);
    filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.8)) 
            drop-shadow(0 0 40px rgba(0, 255, 255, 0.4));
    transition: all var(--transition-slow);
    animation: logoFloat 3s ease-in-out infinite;
    border-radius: 100%;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.club-logo:hover {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 30px rgba(0, 255, 255, 1)) 
            drop-shadow(0 0 60px rgba(0, 255, 255, 0.6));
}

.club-title {
    margin: 0;
    font-size: clamp(24px, 6vw, 48px);
    font-family: 'Segoe UI', sans-serif;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.9), 
                 0 0 30px rgba(0, 0, 255, 0.6),
                 0 4px 8px rgba(0, 0, 0, 0.3);
    font-weight: 900;
    letter-spacing: clamp(1px, 0.3vw, 3px);
    text-transform: uppercase;
    background: linear-gradient(45deg, #ffffff, #00f2ff, #ffffff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s ease-in-out infinite;
}

.club-subtitle {
    font-size: clamp(12px, 2.5vw, 18px);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    letter-spacing: clamp(0.5px, 0.2vw, 2px);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 5px;
}

/* ========================================
   NAVEGACIÓN
   ======================================== */
nav {
    background: linear-gradient(90deg, #232550, var(--primary-blue));
    color: #fff;
    text-align: center;
    padding: 15px 10px;
    box-shadow: inset 0 -2px 6px rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 15px;
    font-size: 16px;
    font-weight: 500;
    position: relative;
    transition: all var(--transition-normal);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

nav a::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background: linear-gradient(90deg, var(--cyan), var(--dark-blue));
    transform: scaleX(0);
    transition: transform var(--transition-normal);
    transform-origin: left;
}

nav a:hover::after {
    transform: scaleX(1);
}

nav a:hover {
    color: var(--cyan);
    background: rgba(0, 242, 255, 0.1);
    transform: translateY(-2px);
}

/* ========================================
   MENÚ MÓVIL
   ======================================== */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    transition: all var(--transition-normal);
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: #fff;
    margin: 3px 0;
    transition: all var(--transition-normal);
    border-radius: 2px;
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav {
    position: absolute;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 350px;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    padding: 60px 30px 30px;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
}

.mobile-nav-overlay.active .mobile-nav {
    transform: translateX(0);
}

.mobile-nav-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.mobile-nav-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-list li {
    margin-bottom: 20px;
    opacity: 0;
    transform: translateX(50px);
    animation: slideInMobile 0.3s ease forwards;
}

.mobile-nav-list li:nth-child(1) { animation-delay: 0.1s; }
.mobile-nav-list li:nth-child(2) { animation-delay: 0.2s; }
.mobile-nav-list li:nth-child(3) { animation-delay: 0.3s; }
.mobile-nav-list li:nth-child(4) { animation-delay: 0.4s; }
.mobile-nav-list li:nth-child(5) { animation-delay: 0.5s; }
.mobile-nav-list li:nth-child(6) { animation-delay: 0.6s; }

.mobile-nav-list a {
    display: block;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    padding: 15px 20px;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    border-left: 4px solid transparent;
}

.mobile-nav-list a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--cyan);
    transform: translateX(10px);
    color: var(--cyan);
}

/* ========================================
   CONTENEDORES Y CONTENIDO
   ======================================== */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 26, 255, 0.15);
    border-radius: var(--radius-2xl);
    animation: fadeIn 1.5s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.post {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 25px;
    animation: slideUp 0.8s ease forwards;
}

.post:last-child {
    border-bottom: none;
}

.post h2 {
    font-size: clamp(24px, 4vw, 32px);
    margin: 0 0 20px 0;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue), var(--secondary-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    position: relative;
}

.post h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-blue));
    border-radius: 2px;
}

.post h3 {
    font-size: clamp(18px, 3vw, 24px);
    color: var(--primary-blue);
    margin: 25px 0 15px 0;
    font-weight: 600;
    padding-left: 15px;
    border-left: 4px solid var(--secondary-blue);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), transparent);
    padding-top: 10px;
    padding-bottom: 10px;
}

.post p {
    margin: 15px 0;
    color: var(--gray-600);
    font-size: clamp(14px, 2.5vw, 16px);
    line-height: 1.7;
    text-align: justify;
}

/* ========================================
   ELEMENTOS COMUNES
   ======================================== */
h1 {
    margin: 0;
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 700;
    letter-spacing: 1px;
}

a {
    text-decoration: none;
    color: var(--primary-blue);
    transition: all var(--transition-normal);
    border-bottom: 1px solid transparent;
}

a:hover {
    color: #1d4ed8;
    border-bottom: 1px solid #1d4ed8;
    transform: translateY(-1px);
}

a:active {
    color: var(--primary-blue);
}

ul, ol {
    padding-left: 25px;
    margin: 15px 0;
}

li {
    margin-bottom: 8px;
    color: var(--gray-600);
    line-height: 1.6;
}

/* ========================================
   CÓDIGO Y ELEMENTOS TÉCNICOS
   ======================================== */
pre {
    background: linear-gradient(135deg, #1e293b, #334155);
    border-radius: var(--radius-xl);
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #475569;
    box-shadow: var(--shadow-lg);
}

code {
    color: #e2e8f0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: clamp(12px, 2vw, 14px);
    line-height: 1.5;
}

.language-cpp {
    display: block;
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #e2e8f0;
    padding: 15px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.5;
    margin: 15px 0;
}

/* ========================================
   TABLAS
   ======================================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    font-weight: 600;
}

/* ========================================
   IMÁGENES Y MULTIMEDIA
   ======================================== */
.imagen-pequeña {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    transition: all var(--transition-normal);
    margin: 20px auto;
    display: block;
}

.imagen-pequeña:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-2xl);
}

.imagen-pequeña2 {
    width: 100%;
    max-width: 500px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-xl);
    margin: 20px auto;
    display: block;
}

iframe {
    width: 100%;
    max-width: 560px;
    height: 315px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    margin: 20px auto;
    display: block;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    flex: 1;
    border: 1px solid var(--gray-200);
    padding: 25px;
    background: linear-gradient(180deg, var(--gray-50), #e0e7ff);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-xl);
    margin: 20px 0;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
}

.sidebar ul li {
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

/* ========================================
   BOTONES Y COMPONENTES INTERACTIVOS
   ======================================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #1d4ed8, var(--primary-blue));
}

.btn-secondary {
    background: linear-gradient(135deg, var(--gray-600), var(--gray-700));
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-blue);
    color: var(--primary-blue);
}

.btn-outline:hover {
    background: var(--primary-blue);
    color: white;
}

/* ========================================
   CARDS Y COMPONENTES
   ======================================== */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    margin: 16px 0;
    transition: all var(--transition-normal);
    border: 1px solid var(--gray-200);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 0;
}

.card-content {
    color: var(--gray-600);
    line-height: 1.6;
}

/* ========================================
   SCROLL TO TOP
   ======================================== */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    z-index: 999;
}

.scroll-to-top:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.scroll-to-top.visible {
    display: flex;
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 60px rgba(0, 255, 255, 0.5);
    }
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(2deg);
    }
}

@keyframes shimmer {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInMobile {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    
    .club-section {
        background-attachment: scroll;
        padding: clamp(30px, 8vw, 50px) 15px;
        min-height: clamp(180px, 20vh, 250px);
    }
    
    .club-header {
        gap: clamp(10px, 2.5vw, 20px);
    }
    
    .club-logo {
        width: clamp(70px, 15vw, 120px);
        height: clamp(70px, 15vw, 120px);
        padding: 8px;
    }
    
    .club-title {
        font-size: clamp(20px, 7vw, 36px);
        letter-spacing: clamp(0.5px, 0.25vw, 2px);
    }
    
    .club-subtitle {
        font-size: clamp(11px, 3vw, 16px);
    }
    
    .container {
        margin: 15px;
        padding: 20px 15px;
        border-radius: var(--radius-xl);
    }
    
    nav {
        padding: 10px 5px;
        position: relative;
    }
    
    .hamburger-menu {
        display: flex;
    }
    
    .mobile-nav-overlay {
        display: block;
    }
    
    nav a {
        display: none;
    }
    
    pre {
        padding: 15px;
        font-size: 12px;
        border-radius: var(--radius-md);
    }
    
    code {
        font-size: 12px;
    }
    
    iframe {
        height: 250px;
        border-radius: var(--radius-md);
    }
    
    .imagen-pequeña,
    .imagen-pequeña2 {
        max-width: 100%;
        margin: 15px auto;
    }
    
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .club-section {
        padding: clamp(25px, 6vw, 40px) 10px;
        min-height: clamp(160px, 18vh, 220px);
    }
    
    .club-logo {
        width: clamp(60px, 18vw, 100px);
        height: clamp(60px, 18vw, 100px);
        padding: 6px;
    }
    
    .club-title {
        font-size: clamp(18px, 8vw, 28px);
        letter-spacing: 1px;
    }
    
    .club-subtitle {
        font-size: clamp(10px, 3.5vw, 14px);
    }
    
    .container {
        margin: 10px;
        padding: 15px 10px;
    }
    
    pre {
        padding: 12px;
        margin: 15px 0;
    }
    
    iframe {
        height: 200px;
    }
    
    .post h3 {
        padding-left: 10px;
        border-left-width: 3px;
    }
}

/* Mejoras para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .club-section {
        padding: clamp(50px, 12vw, 70px) 30px;
        min-height: clamp(220px, 22vh, 280px);
    }
    
    .club-logo {
        width: clamp(100px, 10vw, 130px);
        height: clamp(100px, 10vw, 130px);
    }
    
    .club-title {
        font-size: clamp(32px, 5vw, 42px);
    }
}

/* ========================================
   UTILIDADES
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }
.p-5 { padding: var(--spacing-xl); }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.loaded {
    overflow-x: hidden;
}