/* ===== MEJORAS UX/UI - ANIMACIONES Y EFECTOS ===== */

/* === Variables CSS Globales === */
:root {
    /* Paleta de colores moderna 2025 */
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --secondary-light: #a78bfa;
    --accent-color: #10b981;
    --accent-light: #34d399;

    /* Colores para texto */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Fondos */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-glass: rgba(255, 255, 255, 0.8);

    /* Bordes */
    --border-color: #e5e7eb;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;

    /* Sombras modernas */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-secondary: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-dark: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Tipografía */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transiciones */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* === Smooth Scroll === */
html {
    scroll-behavior: smooth;
}

/* === Mejoras generales de diseño === */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
}

/* === Glassmorphism Effect === */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* === Gradient Text === */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Shimmer Effect === */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* === Reading Progress Bar === */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    z-index: 1000;
    transition: width 0.1s ease-out;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* === Scroll to Top Button === */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.scroll-to-top:active {
    transform: translateY(-2px);
}

/* === Dark Mode Toggle === */
.dark-mode-toggle {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 999;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* === Dark Mode Variables === */
body.dark-mode {
    --primary-color: #818cf8;
    --secondary-color: #a78bfa;
    --accent-color: #34d399;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-glass: rgba(30, 41, 59, 0.8);
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(129, 140, 248, 0.4);
}

body.dark-mode .site-header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-bottom-color: var(--border-color);
}

body.dark-mode .post-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .category-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .dark-mode-toggle {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .share-button {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

body.dark-mode .share-button:hover {
    background: var(--primary-color);
    color: white;
}

/* === Mejoras para Post Cards === */
.post-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    background: var(--bg-primary);
    transition: all var(--transition-normal);
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}

.post-card:hover::before {
    left: 100%;
}

.post-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: var(--primary-color);
}

/* Post Card Image Enhancement */
.post-card img {
    transition: transform var(--transition-slow);
}

.post-card:hover img {
    transform: scale(1.1);
}

/* === Category Cards Modernas === */
.category-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.category-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.category-card:hover::after {
    transform: scaleX(1);
}

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

/* === Botones Modernos === */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--border-radius-md);
    color: white;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

/* === Link Hover Effects === */
.nav-link,
.post-link {
    position: relative;
    text-decoration: none;
}

.nav-link::after,
.post-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-normal);
}

.nav-link:hover::after,
.post-link:hover::after {
    width: 100%;
}

/* === Fade-in Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Aplicar animaciones a elementos */
.post-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }
.post-card:nth-child(6) { animation-delay: 0.6s; }
.post-card:nth-child(7) { animation-delay: 0.1s; }
.post-card:nth-child(8) { animation-delay: 0.2s; }
.post-card:nth-child(9) { animation-delay: 0.3s; }
.post-card:nth-child(10) { animation-delay: 0.4s; }
.post-card:nth-child(11) { animation-delay: 0.5s; }
.post-card:nth-child(12) { animation-delay: 0.6s; }

.hero {
    animation: fadeIn 0.8s ease forwards;
}

.category-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }

.post-header {
    animation: fadeInUp 0.6s ease forwards;
}

.post-content {
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

/* === Social Share Buttons Enhanced === */
.social-share-container {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-button.twitter {
    background: #1DA1F2;
    color: white;
}

.share-button.twitter:hover {
    background: #1a8cd8;
}

.share-button.facebook {
    background: #4267B2;
    color: white;
}

.share-button.facebook:hover {
    background: #365899;
}

.share-button.linkedin {
    background: #0077b5;
    color: white;
}

.share-button.linkedin:hover {
    background: #006399;
}

.share-button.whatsapp {
    background: #25D366;
    color: white;
}

.share-button.whatsapp:hover {
    background: #20bd5a;
}

.share-button.copy-link {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.share-button.copy-link:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.share-button.copy-link.copied {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Iconos para botones de compartir */
.share-button::before {
    font-size: 18px;
}

/* === Reading Time Badge === */
.reading-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.reading-time::before {
    content: "📖";
    font-size: 16px;
}

/* === Toast Notification === */
.toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* === Mejoras en transiciones === */
.post-card,
.category-card,
.share-button,
.nav-link,
.category-link,
.referral-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Loading Skeleton (opcional) === */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* === Responsive adjustments === */
@media (max-width: 768px) {
    .scroll-to-top,
    .dark-mode-toggle {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .scroll-to-top {
        bottom: 20px;
        right: 20px;
    }

    .dark-mode-toggle {
        bottom: 20px;
        left: 20px;
    }

    .social-share-container {
        justify-content: center;
    }

    .share-button {
        padding: 8px 12px;
        font-size: 13px;
    }

    .toast {
        bottom: 80px;
        right: 20px;
        left: 20px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .reading-progress-bar {
        height: 3px;
    }

    .scroll-to-top,
    .dark-mode-toggle {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* ===== NUEVAS MEJORAS VISUALES 2025 ===== */

/* === Hero Section con Gradiente Animado === */
.hero {
    background: var(--gradient-hero);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

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

/* === Tags/Badges Modernos === */
.tag {
    display: inline-block;
    padding: 6px 14px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all var(--transition-normal);
}

.tag:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

/* === Featured Badge === */
.featured-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: var(--shadow-md);
    z-index: 10;
}

/* === Ripple Effect para Botones === */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* === Focus Mode === */
.focus-mode .site-header,
.focus-mode .site-footer,
.focus-mode .sidebar {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.focus-mode .main-content {
    max-width: 700px;
    margin: 0 auto;
}

/* === Selection Color === */
::selection {
    background: var(--primary-color);
    color: white;
}

::-moz-selection {
    background: var(--primary-color);
    color: white;
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* === Newsletter Form Estilizado === */
.newsletter-form {
    background: var(--gradient-primary);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    color: white;
}

.newsletter-form input[type="email"] {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 14px 20px;
    border-radius: var(--border-radius-md);
    width: 100%;
    transition: all var(--transition-normal);
}

.newsletter-form input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-form input[type="email"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* === Search Box Moderno === */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 50px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
    transition: all var(--transition-normal);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
}

/* === Table of Contents === */
.toc {
    position: sticky;
    top: 100px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 20px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.toc-title {
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 8px;
}

.toc a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    display: block;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.toc a:hover,
.toc a.active {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    padding-left: 16px;
}

/* === Code Blocks Modernos === */
pre, code {
    font-family: var(--font-mono);
}

pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 20px;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

code {
    background: var(--bg-tertiary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

pre code {
    background: transparent;
    padding: 0;
}

/* === Quotes Modernos === */
blockquote {
    border-left: 4px solid;
    border-image: var(--gradient-primary) 1;
    padding-left: 20px;
    margin: 24px 0;
    font-style: italic;
    color: var(--text-secondary);
    background: linear-gradient(90deg, var(--bg-secondary), transparent);
    padding: 16px 20px;
    border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
}

/* === Loading Spinner === */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Skeleton Loading Mejorado === */
.skeleton-text {
    height: 16px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text.title {
    height: 24px;
    width: 70%;
    margin-bottom: 16px;
}

.skeleton-text.short {
    width: 50%;
}

/* === Notificaciones Toast Mejoradas === */
.toast {
    background: var(--gradient-primary);
    color: white;
    padding: 16px 24px;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-xl);
    font-weight: 600;
}

.toast.success {
    background: var(--gradient-secondary);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* === Pagination Moderna === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 40px 0;
}

.pagination a,
.pagination span {
    padding: 12px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    transition: all var(--transition-normal);
}

.pagination a:hover {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.pagination .current {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
    color: white;
}

/* === Footer con Efecto Glass === */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
}

/* === Breadcrumbs === */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--primary-color);
}

.breadcrumbs .separator {
    color: var(--text-muted);
}

/* === Post Meta Info === */
.post-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.post-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-meta-item::before {
    font-size: 16px;
}
