/* Estilos personalizados para Manuscritos de J.C. Sobrepere */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
    --primary-color: #ffb44f;        /* Naranja relajante principal */
    --secondary-color: #ff9f33;      /* Naranja secundario */
    --accent-color: #ffb44f;         /* Naranja relajante (accent) */
    --dark-accent: #b8651a;          /* Marrón naranja oscuro */
    --text-color: #2C2416;           /* Sepia oscuro para máxima legibilidad */
    --light-bg: #F5EAD2;             /* Papel antiguo cálido */
    --sepia-bg: #F0E5CD;             /* Fondo sepia cálido */
    --parchment: #F8F2E3;            /* Pergamino cálido */
    --gold-accent: #74132e;          /* Granate para acentos y bordes */
}

html {
    height: 100%;
    overflow-y: auto;
}

body {
    font-family: 'Crimson Text', 'Georgia', serif;
    line-height: 1.7;
    color: var(--text-color);
    background-color: #F5EAD2; /* Papel antiguo cálido */
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    height: auto;
    display: flex;
    flex-direction: column;
}

/* Contenedor principal para sticky footer */
main {
    flex: 1 0 auto;
    min-height: 60vh;
    max-width: 100%;
    position: relative;
    z-index: 1;
}

footer {
    flex-shrink: 0;
}

/* Fondo fijo solo para páginas de escritos (relatos/estudios) */
body.fixed-background .vanta-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
}

/* Fondo dinámico para otras páginas (index, etc.) */
body:not(.fixed-background) .vanta-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    height: 100%;
    z-index: -1;
}

/* Imagen de fondo fija */
.vanta-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/img/fondoprincipal.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.08;
    z-index: -1;
}

/* Canvas de Vanta con opacidad para mostrar la imagen de fondo */
.vanta-bg canvas {
    opacity: 0.7 !important;
    width: 100% !important;
    height: 100% !important;
    position: relative;
    z-index: 1;
}

/* Asegurar contenido principal por encima del fondo */
nav, footer, .container {
    position: relative;
    z-index: 1;
}

/* Navegación */
.navbar-brand {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.6rem;
    letter-spacing: 0.5px;
    color: #fff !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
                 1px 1px 2px rgba(0, 0, 0, 0.6),
                 0 0 10px rgba(0, 0, 0, 0.4);
}

/* Iconos del navbar con efecto elegante */
.navbar-nav .nav-link i,
.dropdown-item i {
    margin-right: 0.5rem;
    transition: all 0.3s ease;
    display: inline-block;
}

.navbar-nav .nav-link:hover i {
    transform: scale(1.1);
    text-shadow: 0 0 8px rgba(255, 180, 79, 0.8);
}

.dropdown-item:hover i {
    transform: translateX(3px);
    color: var(--accent-color);
}

.navbar-dark {
    background: linear-gradient(135deg, var(--dark-accent), var(--primary-color), var(--secondary-color)) !important;
    z-index: 1030 !important;
    position: relative !important;
    box-shadow: 0 2px 10px rgba(255, 180, 79, 0.3);
    border-bottom: 4px solid #74132e !important;
}

/* Fix z-index para dropdown del navbar - ANTI DR. NO */
.navbar-nav .nav-item.dropdown {
    position: relative !important;
}

.navbar-nav .dropdown-menu {
    z-index: 1040 !important;
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    min-width: 120px !important;
    max-width: 200px !important;
    width: max-content !important;
    white-space: nowrap !important;
    transform: translateX(0) !important;
}

.navbar-nav .dropdown-menu.show {
    z-index: 1040 !important;
    position: absolute !important;
    display: block !important;
    min-width: 120px !important;
    width: max-content !important;
}

.navbar-nav .dropdown-item {
    z-index: 1040 !important;
    padding: 0.5rem 1rem !important;
    width: auto !important;
    display: block !important;
}

/* Estilos para enlaces de navegación */
.navbar-nav .nav-link {
    color: #74132e !important;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #74132e !important;
    text-shadow: 
        2px 2px 4px rgba(255, 255, 255, 1),
        0 0 8px rgba(116, 19, 46, 0.3);
    transform: translateY(-1px);
}

.navbar-nav .dropdown-item {
    color: #74132e !important;
    transition: all 0.3s ease;
}

.navbar-nav .dropdown-item:hover {
    color: #74132e !important;
    background-color: rgba(116, 19, 46, 0.1) !important;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Hero Section */
.hero-section {
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(255, 180, 79, 0.4);
    border: 2px solid var(--gold-accent) !important;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(47, 27, 20, 0.2);
    border-radius: 14px; /* 2px menos que el contenedor para compensar el borde */
    pointer-events: none;
}

.hero-section h1 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    color: #fff !important;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8), 
        1px 1px 2px rgba(0, 0, 0, 0.6),
        0 0 15px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 180, 79, 0.3);
    letter-spacing: 1px;
    position: relative;
    z-index: 2;
}

.hero-section .lead {
    color: #fff !important;
    text-shadow: 
        1px 1px 2px rgba(0, 0, 0, 0.8),
        0 0 8px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(255, 180, 79, 0.4);
    font-family: 'Crimson Text', serif;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.hero-section .btn {
    position: relative;
    z-index: 2;
}

/* Cards - Estilo manuscrito premium */
.card {
    border: 2px solid var(--accent-color) !important;
    background-color: var(--parchment);
    box-shadow: 0 6px 20px rgba(116, 19, 46, 0.12), 0 2px 8px rgba(139, 69, 19, 0.08);
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    border-radius: 12px !important;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(116, 19, 46, 0.18), 0 4px 12px rgba(139, 69, 19, 0.12);
}

.card-header {
    background: linear-gradient(135deg, var(--sepia-bg), var(--parchment));
    border-bottom: 2px solid var(--accent-color);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    border-top-left-radius: 10px !important;
    border-top-right-radius: 10px !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    margin: -2px -2px 0 -2px; /* Compensar borde de card */
    padding: 1rem 1.25rem;
}

.card-footer {
    border-top: 2px solid var(--accent-color);
    background: linear-gradient(135deg, var(--sepia-bg), var(--parchment));
    border-bottom-left-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    margin: 0 -2px -2px -2px; /* Compensar borde de card */
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    color: #74132e;
}

/* Relatos - Tipografía editorial premium */
.relato-content {
    line-height: 2.0;
    font-size: 1.2rem;
    font-family: 'Lora', 'Georgia', serif;
    color: var(--text-color);
    font-weight: 400;
    letter-spacing: 0.01em;
    word-spacing: 0.05em;
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
}

.relato-content p {
    margin-bottom: 2rem;
    text-align: justify;
    text-indent: 2em;
    font-style: normal;
}

/* Letra capital estilo manuscrito iluminado */
.relato-content p.first-paragraph::first-letter {
    font-size: 3.5em;
    float: left;
    line-height: 0.85;
    margin: 0.08em 0.12em 0 0;
    font-family: 'Cormorant Garamond', serif;
    color: #74132e;
    font-weight: 700;

    /* Cuadrado iluminado estilo manuscrito medieval */
    background: linear-gradient(135deg, #F8F2E3 0%, #F5EAD2 100%);
    border: 3px solid #74132e;
    border-radius: 6px;
    box-shadow:
        inset 0 0 20px rgba(255, 180, 79, 0.2),
        0 4px 12px rgba(116, 19, 46, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.1);

    /* Dimensiones del cuadrado iluminado */
    width: 1.9em;
    height: 1.9em;

    /* Centrado perfecto de la letra */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;

    /* Posicionamiento respecto al texto */
    margin-top: 0.08em;
    margin-bottom: 0;
}

/* Ajuste específico para el párrafo con letra capital */
.relato-content p.first-paragraph {
    text-indent: 0 !important;
}

/* Botones personalizados tema marrón */
.btn {
    border-radius: 10px !important;
    transition: all 0.3s ease-in-out;
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-width: 2px !important;
}

/* Botón principal - con mejor contraste */
.btn-primary {
    background: linear-gradient(135deg, #74132e 0%, #8d1a3a 100%) !important;
    border: 2px solid var(--accent-color) !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(116, 19, 46, 0.4);
    transition: all 0.3s ease-in-out;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #8d1a3a 0%, #a52344 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(116, 19, 46, 0.5), 0 0 20px rgba(255, 180, 79, 0.3);
    border-color: #ffb44f !important;
    color: #fff !important;
}

.btn-primary,
.btn-primary *,
.btn-primary span,
.btn-primary i,
.btn-primary:hover,
.btn-primary:hover *,
.btn-primary:hover span,
.btn-primary:hover i,
.btn-primary:focus,
.btn-primary:active {
    color: #fff !important;
}

/* Botón outline principal */
.btn-outline-primary {
    background: transparent !important;
    border: 2px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
}

.btn-outline-primary:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    transform: translateY(-2px);
}

/* Fondos para cards estadísticas - Tonos más claros y profesionales */
.hero-sepia {
    background: linear-gradient(135deg, #b8651a, #d97736) !important;
    color: #fff !important;
}

.bg-sepia-success {
    background: linear-gradient(135deg, #4CAF50, #66BB6A) !important;
    color: #fff !important;
}

.bg-sepia-info {
    background: linear-gradient(135deg, #b8651a, #ffb44f) !important;
    color: #fff !important;
}

.bg-sepia-warning {
    background: linear-gradient(135deg, #ffb44f, #ffc875) !important;
    color: #3a3a3a !important;
}

/* Sombras para títulos de cards estadísticas del dashboard */
.hero-sepia .card-title, .bg-sepia-success .card-title, .bg-sepia-info .card-title,
.hero-sepia h2, .bg-sepia-success h2, .bg-sepia-info h2 {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3),
                 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.bg-sepia-warning .card-title,
.bg-sepia-warning h2 {
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

/* Badges personalizados */
.badge-sepia-success {
    background-color: #4CAF50 !important;
    color: #fff !important;
}

.badge-sepia-warning {
    background-color: #ffb44f !important;
    color: #3a3a3a !important;
}

.btn:hover {
    transform: translateY(-2px);
}

/* Admin Dashboard */
.card.bg-primary,
.card.bg-success,
.card.bg-info,
.card.bg-warning {
    border: none;
}

/* Forms */
.form-control {
    border-radius: 8px !important;
    border: 2px solid #ddd !important;
    transition: all 0.3s ease-in-out;
    background-color: var(--parchment);
}

.form-control:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 180, 79, 0.25) !important;
    background-color: #fff;
}

.form-select {
    border-radius: 8px !important;
    border: 2px solid #ddd !important;
    background-color: var(--parchment);
}

.form-select:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(255, 180, 79, 0.25) !important;
}

/* Alerts */
.alert {
    border-radius: 10px !important;
    border: 2px solid transparent !important;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.1);
}

.alert-success {
    border-color: var(--accent-color) !important;
    background-color: rgba(255, 180, 79, 0.1) !important;
}

.alert-danger {
    border-color: #dc3545 !important;
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.alert-warning {
    border-color: #ffc107 !important;
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.alert-info {
    border-color: var(--primary-color) !important;
    background-color: rgba(255, 180, 79, 0.1) !important;
}

/* Breadcrumbs */
.breadcrumb {
    background-color: var(--sepia-bg) !important;
    border-radius: 10px !important;
    border: 2px solid var(--accent-color) !important;
    padding: 0.75rem 1rem !important;
}

.breadcrumb-item a {
    color: var(--dark-accent) !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: var(--gold-accent) !important;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Responsive Design - MOBILE FIRST */
@media (max-width: 768px) {
    /* Hero section mobile */
    .hero-section {
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
    }
    
    .hero-section .display-4 {
        font-size: 1.8rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-section .lead {
        font-size: 1rem !important;
    }
    
    /* Navbar mobile - Solo título, sin menú hamburguesa */
    .navbar-brand {
        font-size: 1.2rem !important;
    }

    .navbar-toggler {
        display: none !important;
    }

    #navbarNav {
        display: none !important;
    }

    /* Cards mobile */
    .card {
        margin-bottom: 1rem !important;
    }
    
    /* Foto autor mobile */
    .author-img {
        width: 80px !important;
        height: 80px !important;
    }
    
    /* Botones mobile */
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Dashboard stats mobile */
    .bg-sepia-success, .bg-sepia-info, .bg-sepia-warning, .hero-sepia {
        margin-bottom: 1rem !important;
    }
    
    /* Texto relatos mobile */
    .relato-content {
        font-size: 1.05rem !important;
        line-height: 1.85 !important;
    }
    
    /* Vanta mobile settings */
    .vanta-bg {
        min-height: 100vh !important;
    }
}

@media (max-width: 576px) {
    /* Extra small devices */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .hero-section .display-4 {
        font-size: 1.5rem !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    /* Dashboard mobile extra small */
    .col-md-3 {
        margin-bottom: 1rem;
    }
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Toggle switches */
.form-switch .form-check-input {
    width: 2em;
    height: 1em;
}

/* Table hover */
.table-striped > tbody > tr:hover {
    background-color: rgba(52, 152, 219, 0.1);
}

/* Badge styles */
.badge {
    font-size: 0.75em;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Custom scrollbar for textareas */
textarea::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Paginación personalizada con la paleta de la página */
.pagination {
    margin-bottom: 1rem;
}

.pagination .page-link {
    background-color: var(--parchment);
    border: 2px solid var(--accent-color);
    color: var(--dark-accent);
    border-radius: 8px;
    margin: 0 0.2rem;
    font-family: 'Crimson Text', serif;
    font-weight: 500;
    transition: all 0.3s ease-in-out;
    text-decoration: none;
}

.pagination .page-link:hover {
    background-color: var(--accent-color);
    border-color: var(--gold-accent);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 180, 79, 0.3);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #74132e 0%, #8d1a3a 100%);
    border-color: var(--accent-color);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(116, 19, 46, 0.4);
}

.pagination .page-item.disabled .page-link {
    background-color: var(--sepia-bg);
    border-color: #ddd;
    color: #999;
    opacity: 0.6;
}

.pagination .page-item.disabled .page-link:hover {
    background-color: var(--sepia-bg);
    border-color: #ddd;
    color: #999;
    transform: none;
    box-shadow: none;
}

/* Botón outline-secondary personalizado */
.btn-outline-secondary {
    background: transparent !important;
    border: 2px solid var(--dark-accent) !important;
    color: var(--dark-accent) !important;
}

.btn-outline-secondary:hover {
    background: var(--dark-accent) !important;
    border-color: var(--dark-accent) !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(116, 19, 46, 0.3);
}

/* Estilos para la sección del autor */
.author-img {
    transition: transform 0.3s ease-in-out, border-color 0.3s ease-in-out, border-width 0.3s ease-in-out;
    border: 4px solid #74132e !important;
}

.author-img:hover {
    transform: scale(1.05);
    border: 5px solid var(--accent-color) !important;
}

.author-photo {
    position: relative;
    display: inline-block;
}

/* Títulos principales */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Cormorant Garamond', serif;
    color: #74132e;
}

/* Footer */
footer {
    background-image:
        linear-gradient(135deg,
            rgba(47, 27, 20, 0.85),
            rgba(255, 180, 79, 0.75),
            rgba(255, 159, 51, 0.65)
        ),
        url('/static/img/books-background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-top: 4px solid #74132e !important;
    box-shadow: 0 -2px 10px rgba(255, 180, 79, 0.3);
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(184, 101, 26, 0.3);
    pointer-events: none;
}

footer * {
    position: relative;
    z-index: 2;
}

/* Iconos sociales del footer */
footer a.text-light {
    transition: all 0.3s ease;
    display: inline-block;
}

footer a.text-light:hover {
    color: var(--accent-color) !important;
    transform: translateY(-3px) scale(1.1);
    text-shadow: 0 0 15px rgba(255, 180, 79, 0.6);
}

/* Efecto de escritura para el texto del autor */
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

.author-description {
    overflow: hidden;
    border-right: 2px solid var(--accent-color);
    white-space: nowrap;
    animation: typewriter 4s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-color); }
}

/* Estilos para enlaces de relatos populares */
.relato-link {
    color: var(--gold-accent) !important; /* Granate coherente con el diseño */
    text-decoration: underline !important;
    text-decoration-color: rgba(116, 19, 46, 0.4) !important;
    text-underline-offset: 3px !important;
    transition: all 0.3s ease !important;
    font-weight: 500 !important;
}

.relato-link:hover {
    color: #5a0f24 !important; /* Granate más oscuro al hover */
    text-decoration-color: rgba(116, 19, 46, 0.8) !important;
    text-decoration-thickness: 2px !important;
    transform: translateY(-1px) !important; /* Sutil efecto de elevación */
}

/* Estilos específicos para enlaces de títulos de estudios */
.card-title a.text-decoration-none {
    color: #74132e !important; /* Granate elegante coherente */
    text-decoration: none !important;
    border-bottom: 2px solid transparent !important;
    transition: all 0.3s ease !important;
    display: inline-block !important;
}

.card-title a.text-decoration-none:hover {
    color: #5a0f24 !important; /* Granate más oscuro al hover */
    border-bottom-color: rgba(116, 19, 46, 0.6) !important;
    transform: translateY(-1px) !important; /* Sutil efecto de elevación */
}

.card-title a.text-decoration-none:visited {
    color: #74132e !important; /* Mantener color granate en visitados */
}

.card-title a.text-decoration-none:focus {
    color: #74132e !important;
    outline: 2px solid rgba(116, 19, 46, 0.3) !important;
    outline-offset: 2px !important;
}

/* Estilos para badges de etiquetas en páginas de detalle y listados */
.tag-badge {
    background: linear-gradient(135deg, #8d1a3a 0%, #74132e 100%) !important;
    color: #fff !important;
    padding: 0.4rem 0.8rem !important;
    border-radius: 0.75rem !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(116, 19, 46, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    text-decoration: none !important;
    display: inline-block;
}

.tag-badge:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(116, 19, 46, 0.5), 0 0 10px rgba(255, 180, 79, 0.3);
    border-color: rgba(255, 180, 79, 0.6) !important;
    filter: brightness(1.15);
    color: #fff !important;
}

/* Estilos para etiquetas en categoria.html que usan inline styles */
.badge[title]:not(.badge-sepia-success):not(.badge-sepia-info):not(.badge-sepia-warning) {
    background: linear-gradient(135deg, #8d1a3a 0%, #74132e 100%) !important;
    color: #fff !important;
    padding: 0.4rem 0.8rem !important;
    border-radius: 0.75rem !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(116, 19, 46, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Estilos para la Nube de Etiquetas */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
}

.tag-cloud-item {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    text-decoration: none !important;
    color: #fff !important;
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 3px 8px rgba(116, 19, 46, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    line-height: 1.2;
}

.tag-cloud-item:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 15px rgba(116, 19, 46, 0.5), 0 0 10px rgba(255, 180, 79, 0.3);
    border-color: rgba(255, 180, 79, 0.8);
    filter: brightness(1.15);
}

/* Tamaños de etiquetas basados en popularidad con paleta vino tinto */
.tag-size-1 {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    background: linear-gradient(135deg, #a8515e 0%, #8d4551 100%) !important;
}

.tag-size-2 {
    font-size: 0.85rem;
    padding: 0.35rem 0.7rem;
    background: linear-gradient(135deg, #983d4a 0%, #7d3340 100%) !important;
}

.tag-size-3 {
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(135deg, #8d1a3a 0%, #74132e 100%) !important;
}

.tag-size-4 {
    font-size: 1.15rem;
    padding: 0.45rem 0.9rem;
    background: linear-gradient(135deg, #74132e 0%, #5d0f24 100%) !important;
}

.tag-size-5 {
    font-size: 1.3rem;
    padding: 0.5rem 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #5d0f24 0%, #4a0c1d 100%) !important;
}

/* Responsive para la nube de etiquetas en móvil */
@media (max-width: 768px) {
    .tag-cloud {
        gap: 0.4rem;
        padding: 0.3rem;
    }

    .tag-cloud-item {
        padding: 0.3rem 0.6rem;
    }

    .tag-size-1 {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        background: linear-gradient(135deg, #a8515e 0%, #8d4551 100%) !important;
    }

    .tag-size-2 {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
        background: linear-gradient(135deg, #983d4a 0%, #7d3340 100%) !important;
    }

    .tag-size-3 {
        font-size: 0.85rem;
        padding: 0.35rem 0.7rem;
        background: linear-gradient(135deg, #8d1a3a 0%, #74132e 100%) !important;
    }

    .tag-size-4 {
        font-size: 0.95rem;
        padding: 0.4rem 0.75rem;
        background: linear-gradient(135deg, #74132e 0%, #5d0f24 100%) !important;
    }

    .tag-size-5 {
        font-size: 1.05rem;
        padding: 0.45rem 0.8rem;
        background: linear-gradient(135deg, #5d0f24 0%, #4a0c1d 100%) !important;
    }
}

/* Estilos para controles de paginación de contenido */
#pagination-controls {
    border-top: 2px solid var(--accent-color);
    padding-top: 1.5rem;
}

#pagination-controls .btn {
    min-width: 120px;
    font-weight: 600;
    transition: all 0.3s ease;
}

#pagination-controls .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#pagination-controls .badge {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

/* Animación suave para transición de páginas */
.relato-content,
.content-reader {
    transition: opacity 0.3s ease-in-out;
}

/* Responsive para controles de paginación */
@media (max-width: 576px) {
    #pagination-controls .btn {
        min-width: 90px;
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    #pagination-controls .badge {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.8rem !important;
    }
}

/* ===== SLIDER DE RELATOS DESTACADOS ===== */

/* Contenedor del slider */
#relatosDestacadosCarousel {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(116, 19, 46, 0.25);
    border: 3px solid var(--gold-accent);
    background: linear-gradient(135deg, var(--parchment), var(--sepia-bg));
}

/* Card de cada relato destacado */
.relato-destacado-card {
    background: linear-gradient(135deg,
        rgba(250, 240, 230, 0.95) 0%,
        rgba(253, 245, 230, 0.95) 50%,
        rgba(244, 241, 232, 0.95) 100%
    );
    padding: 2.5rem 4rem; /* Más padding lateral para evitar solapamiento con flechas */
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.relato-destacado-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/static/img/books-background.jpg') center/cover no-repeat;
    opacity: 0.05;
    pointer-events: none;
}

/* Header del relato destacado */
.relato-destacado-header {
    position: relative;
    z-index: 2;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 1rem;
}

.relato-destacado-titulo {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.8rem;
    color: var(--gold-accent);
    margin-bottom: 0.8rem;
    line-height: 1.3;
    text-shadow: 1px 1px 2px rgba(255, 180, 79, 0.2);
}

.relato-destacado-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.relato-destacado-fecha,
.relato-destacado-categoria,
.relato-destacado-vistas {
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark-accent);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.relato-destacado-fecha i,
.relato-destacado-categoria i,
.relato-destacado-vistas i {
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* Preview del contenido */
.relato-destacado-preview {
    position: relative;
    z-index: 2;
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.relato-destacado-preview p {
    font-family: 'Crimson Text', serif;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-color);
    margin-bottom: 0.8rem;
    text-align: justify;
    font-style: italic;
}

.relato-destacado-preview p:last-child {
    margin-bottom: 0;
}

/* Footer con botón */
.relato-destacado-footer {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 180, 79, 0.3);
}

.btn-relato-destacado {
    background: linear-gradient(135deg, #74132e 0%, #8d1a3a 100%) !important;
    border: 2px solid var(--accent-color) !important;
    color: #fff !important;
    font-family: 'Crimson Text', serif;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.7rem 1.5rem;
    border-radius: 10px;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 15px rgba(116, 19, 46, 0.4);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-relato-destacado:hover {
    background: linear-gradient(135deg, #8d1a3a 0%, #a52344 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(116, 19, 46, 0.5), 0 0 20px rgba(255, 180, 79, 0.3);
    color: #fff !important;
    border-color: #ffb44f !important;
}

.btn-relato-destacado,
.btn-relato-destacado *,
.btn-relato-destacado span,
.btn-relato-destacado i,
.btn-relato-destacado:hover,
.btn-relato-destacado:hover *,
.btn-relato-destacado:hover span,
.btn-relato-destacado:hover i,
.btn-relato-destacado:focus,
.btn-relato-destacado:active {
    color: #fff !important;
}

.btn-relato-destacado i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.btn-relato-destacado:hover i {
    transform: translateX(4px);
}

/* Indicadores del carousel */
.carousel-indicators {
    bottom: -45px;
    margin-bottom: 0;
}

.carousel-indicators [data-bs-target] {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--gold-accent);
    border: 2px solid var(--gold-accent);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.carousel-indicators .active {
    opacity: 1;
    background-color: var(--accent-color);
    border-color: var(--gold-accent);
    transform: scale(1.2);
}

/* Controles del carousel */
.carousel-control-prev,
.carousel-control-next {
    width: 50px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    opacity: 1;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--gold-accent);
    border-radius: 50%;
    padding: 0.5rem;
    box-shadow: 0 4px 12px rgba(116, 19, 46, 0.4);
    transition: all 0.3s ease;
}

.carousel-control-prev-icon:hover,
.carousel-control-next-icon:hover {
    background-color: var(--dark-accent);
    transform: scale(1.1);
}

/* Animación de transición entre slides */
.carousel-item {
    transition: transform 0.6s ease-in-out;
}

/* Responsive - Tablet */
@media (max-width: 992px) {
    .relato-destacado-card {
        padding: 2rem 3rem; /* Mantener padding lateral para evitar solapamiento */
        min-height: 280px;
    }

    .relato-destacado-titulo {
        font-size: 1.5rem;
    }

    .relato-destacado-preview p {
        font-size: 1rem;
    }

    .btn-relato-destacado {
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    #relatosDestacadosCarousel {
        border-width: 2px;
    }

    .relato-destacado-card {
        padding: 1.5rem 2.5rem; /* Padding lateral reducido pero suficiente */
        min-height: 300px;
    }

    .relato-destacado-titulo {
        font-size: 1.3rem;
        margin-bottom: 0.6rem;
    }

    .relato-destacado-meta {
        gap: 1rem;
        font-size: 0.85rem;
    }

    .relato-destacado-preview p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .btn-relato-destacado {
        font-size: 0.95rem;
        padding: 0.6rem 1rem;
        width: 100%;
        justify-content: center;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
    }

    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 2rem;
        height: 2rem;
    }

    .carousel-indicators {
        bottom: -35px;
    }

    .carousel-indicators [data-bs-target] {
        width: 10px;
        height: 10px;
    }
}

/* Responsive - Extra Small Mobile */
@media (max-width: 576px) {
    .relato-destacado-card {
        padding: 1.2rem 2rem; /* Padding lateral mínimo en pantallas pequeñas */
        min-height: 280px;
    }

    .relato-destacado-titulo {
        font-size: 1.2rem;
    }

    .relato-destacado-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .relato-destacado-preview p {
        font-size: 0.9rem;
        text-align: left;
    }

    /* Ocultar segundo párrafo en móviles pequeños para mejor UX */
    .relato-destacado-preview p:nth-child(2) {
        display: none;
    }
}

/* ============================================================
   NAVBAR - DROPDOWN DE PERFIL
   ============================================================ */

/* Avatar en la navbar */
.navbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffb44f;
    margin-right: 8px;
    transition: all 0.3s ease;
}

.profile-dropdown-toggle {
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.profile-dropdown-toggle:hover .navbar-avatar {
    border-color: #ffffff;
    transform: scale(1.1);
}

.navbar-username {
    font-weight: 600;
    margin-left: 5px;
}

/* Dropdown menu mejorado */
.profile-dropdown-menu {
    min-width: 280px;
    border-radius: 12px;
    border: 2px solid rgba(255, 180, 79, 0.3);
    box-shadow: 0 8px 24px rgba(116, 19, 46, 0.2);
    padding: 0;
    margin-top: 10px;
    animation: dropdownFadeIn 0.3s ease;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header del dropdown con avatar */
.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #fdf5e6 0%, #f9f3e8 100%);
    border-radius: 10px 10px 0 0;
}

.dropdown-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ffb44f;
    box-shadow: 0 4px 10px rgba(255, 180, 79, 0.3);
}

.dropdown-avatar-icon {
    font-size: 3rem;
    color: #74132e;
}

.dropdown-email {
    font-size: 0.85rem;
    color: #b8651a;
    font-weight: normal;
    margin-top: 3px;
}

/* Items del dropdown */
.profile-dropdown-menu .dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.profile-dropdown-menu .dropdown-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.profile-dropdown-menu .dropdown-item:hover {
    background: linear-gradient(135deg, #fdf5e6 0%, #f9f3e8 100%);
    color: #74132e;
    padding-left: 25px;
}

.profile-dropdown-menu .dropdown-item.text-warning:hover {
    background: rgba(255, 193, 7, 0.1);
}

.profile-dropdown-menu .dropdown-item.text-danger:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* Separador en navbar */
.navbar-separator .nav-link {
    color: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 0.75rem;
    cursor: default;
    pointer-events: none;
}

/* Enlace Club de Lectura */
.club-lectura-link {
    font-weight: 600;
    color: #ffb44f !important;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 1rem !important;
}

.club-lectura-link i {
    margin-right: 6px;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.club-lectura-link:hover {
    color: #ffffff !important;
    background: rgba(255, 180, 79, 0.1);
    border-radius: 6px;
}

.club-lectura-link:hover i {
    transform: scale(1.1);
}

.club-lectura-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #ffb44f;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.club-lectura-link:hover::after {
    width: 80%;
}

/* Responsive para navbar */
@media (max-width: 991px) {
    .profile-dropdown-menu {
        min-width: 100%;
    }

    .navbar-username {
        margin-left: 8px;
    }

    /* Ocultar separador en móvil */
    .navbar-separator {
        display: none;
    }

    /* Club de Lectura en móvil */
    .club-lectura-link {
        margin-top: 10px;
        padding: 0.75rem 1rem !important;
        background: rgba(255, 180, 79, 0.1);
        border-radius: 6px;
    }
}

@media (max-width: 576px) {
    .navbar-avatar {
        width: 28px;
        height: 28px;
    }

    .dropdown-avatar {
        width: 45px;
        height: 45px;
    }

    .profile-dropdown-header {
        padding: 12px;
    }

    .profile-dropdown-menu .dropdown-item {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}