/**
 * Estilos específicos para single.php (Artículos individuales)
 * Con soporte para modo oscuro/claro
 */

/* ==============================================
   VARIABLES POR DEFECTO (MODO CLARO)
   ============================================== */
.single {
    /* Modo claro por defecto */
    --single-bg: #ffffff;
    --single-bg-card: #f8f9fa;
    --single-bg-hover: #e9ecef;
    --single-border: #e9ecef;
    
    /* Textos */
    --single-text: #1a1a1a;
    --single-text-muted: #6c757d;
    --single-text-light: #333333;
    
    /* Acento */
    --single-accent: #bf9b5c;
    --single-accent-hover: #a07d45;
    
    --single-code-bg: #f0f0f0;
    
    /* Transición suave al cambiar de modo */
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ==============================================
   VARIABLES DEL MODO OSCURO
   Se activan cuando la clase .dark-mode está presente
   ============================================== */
.single.dark-mode {
    --single-bg: #202020;
    --single-bg-card: #282828;
    --single-bg-hover: #2d2d2d;
    --single-border: #333333;
    
    --single-text: #ffffff;
    --single-text-muted: #92a0b1;
    --single-text-light: #c0c0c0;
    
    --single-accent: #d4a574;
    --single-accent-hover: #e0b88a;
    
    --single-code-bg: #1a1a1a;
}

/* Aplicar fondo y color al body según el modo */
body.single {
    background-color: var(--single-bg);
    transition: background-color 0.3s ease;
}

body.single .site-main {
    background-color: var(--single-bg);
}

/* Contenedor principal del artículo */
.single-article-wrapper {
    max-width: 1400px;
    margin: 0 auto;
}

/* ==============================================
   CORRECCIONES DE TEXTO - Clases de Bootstrap
   ============================================== */

/* Sobrescribir text-muted de Bootstrap */
.single .text-muted,
.single .article-meta,
.single .article-meta .text-muted,
.single .small.text-muted,
.single span.text-muted {
    color: var(--single-text-muted) !important;
}

/* Metadatos del artículo */
.single .article-meta {
    color: var(--single-text-muted) !important;
}

.single .article-meta span,
.single .article-meta a {
    color: var(--single-text-muted) !important;
}

.single .article-meta a:hover {
    color: var(--single-accent) !important;
}

/* Iconos en metadatos */
.single .article-meta i {
    color: var(--single-text-muted) !important;
}

/* Textos pequeños */
.single small,
.single .small {
    color: var(--single-text-muted) !important;
}

/* ==============================================
   TOPPER DEL ARTÍCULO
   ============================================== */
.single .article-featured-image {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.single .article-featured-image img {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

.single .article-featured-image:hover img {
    transform: scale(1.02);
}

/* Título */
.single h1.display-3 {
    font-family: 'Lora', Georgia, serif;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--single-text);
}

/* Subtítulo/excerpt */
.single .lead.fs-4 {
    color: var(--single-text-light);
}

/* ==============================================
   HERRAMIENTAS DEL ARTÍCULO
   ============================================== */
.single .article-tools {
    background-color: var(--single-bg-card);
    border-radius: 12px;
    padding: 1rem 1.5rem !important;
    border: 1px solid var(--single-border);
}

.single .article-tools button {
    font-size: 0.9rem;
    transition: all 0.2s ease;
    color: var(--single-text-muted);
    background: transparent;
}

.single .article-tools button:hover {
    color: var(--single-accent) !important;
    transform: translateY(-1px);
}

/* Botón de guardar cuando está activo */
.single .article-tools button.saved {
    color: var(--single-accent) !important;
}

.single .article-tools button.saved i {
    font-weight: 900;
}

.single .article-tools .text-muted {
    color: var(--single-text-muted) !important;
}

/* ==============================================
   CONTENIDO PRINCIPAL DEL ARTÍCULO
   ============================================== */
.single .article-content {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--single-text-light);
}

.single .article-content p {
    margin-bottom: 1.75rem;
    color: var(--single-text-light);
}

/* Encabezados */
.single .article-content h2 {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--single-border);
    color: var(--single-text);
}

.single .article-content h3 {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--single-text);
}

.single .article-content h4 {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--single-text);
}

/* Enlaces dentro del contenido */
.single .article-content a {
    color: var(--single-accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.single .article-content a:hover {
    border-bottom-color: var(--single-accent);
    color: var(--single-accent-hover);
}

/* Citas destacadas */
.single .article-content blockquote {
    border-left: 4px solid var(--single-accent);
    padding: 1rem 0 1rem 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    background-color: var(--single-bg-card);
    border-radius: 0 12px 12px 0;
}

.single .article-content blockquote p {
    margin-bottom: 0;
    font-size: 1.125rem;
    color: var(--single-text-muted);
}

/* Listas */
.single .article-content ul,
.single .article-content ol {
    margin-bottom: 1.75rem;
    padding-left: 1.5rem;
}

.single .article-content li {
    margin-bottom: 0.5rem;
    color: var(--single-text-light);
}

/* Imágenes dentro del contenido */
.single .article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.single.dark-mode .article-content img {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.single .article-content .wp-caption {
    max-width: 100%;
    margin: 1.5rem 0;
}

.single .article-content .wp-caption-text {
    font-size: 0.875rem;
    color: var(--single-text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

/* Tablas */
.single .article-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.single .article-content th,
.single .article-content td {
    border: 1px solid var(--single-border);
    padding: 0.75rem;
}

.single .article-content th {
    background-color: var(--single-bg-card);
    font-weight: 600;
    color: var(--single-text);
}

.single .article-content td {
    color: var(--single-text-light);
}

/* Código */
.single .article-content pre,
.single .article-content code {
    background-color: var(--single-code-bg);
    border-radius: 8px;
    padding: 0.2rem 0.4rem;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--single-accent);
}

.single .article-content pre {
    padding: 1rem;
    overflow-x: auto;
}

.single .article-content pre code {
    background: none;
    padding: 0;
    color: var(--single-text-light);
}

/* ==============================================
   ETIQUETAS
   ============================================== */
.single .article-tags {
    border-top-color: var(--single-border) !important;
}

.single .article-tags h6 {
    color: var(--single-text);
}

.single .article-tags a {
    display: inline-block;
    background-color: var(--single-bg-card);
    padding: 0.25rem 0.875rem;
    border-radius: 20px;
    font-size: 0.75rem;
    text-decoration: none;
    color: var(--single-text-muted);
    transition: all 0.2s ease;
    border: 1px solid var(--single-border);
}

.single .article-tags a:hover {
    background-color: var(--single-accent);
    color: var(--single-bg);
    transform: translateY(-1px);
    border-color: var(--single-accent);
}

/* ==============================================
   NAVEGACIÓN ENTRE ARTÍCULOS
   ============================================== */
.single .post-navigation {
    background-color: var(--single-bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--single-border);
}

.single .post-navigation a {
    text-decoration: none;
    color: var(--single-text-muted);
    font-weight: 500;
    transition: color 0.2s ease;
}

.single .post-navigation a:hover {
    color: var(--single-accent);
}

/* ==============================================
   AUTOR Y BIOGRAFÍA
   ============================================== */
.single .author-bio-card {
    background-color: var(--single-bg-card) !important;
    border: 1px solid var(--single-border);
    transition: transform 0.2s ease;
}

.single .author-bio-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.single.dark-mode .author-bio-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.single .author-bio-card h5 {
    color: var(--single-text);
}

.single .author-bio-card p {
    color: var(--single-text-muted);
}

.single .author-bio-card a {
    color: var(--single-accent);
}

/* ==============================================
   ARTÍCULOS RELACIONADOS
   ============================================== */
.single .related-posts-widget h5 {
    color: var(--single-text);
    border-left-color: var(--single-accent) !important;
}

.single .related-posts-widget .related-item {
    transition: transform 0.2s ease;
    border-bottom-color: var(--single-border) !important;
}

.single .related-posts-widget .related-item:hover {
    transform: translateX(5px);
}

.single .related-posts-widget .related-item h6 a {
    transition: color 0.2s ease;
    color: var(--single-text);
}

.single .related-posts-widget .related-item h6 a:hover {
    color: var(--single-accent) !important;
}

.single .related-posts-widget .related-item .text-muted {
    color: var(--single-text-muted) !important;
}

/* ==============================================
   COMENTARIOS
   ============================================== */
.single .comments-section {
    border-top-color: var(--single-border) !important;
}

.single .comment-list {
    list-style: none;
    padding-left: 0;
}

.single .comment {
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: var(--single-bg-card);
    border-radius: 12px;
    border: 1px solid var(--single-border);
}

.single .comment-author {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--single-text);
}

.single .comment-metadata {
    font-size: 0.75rem;
    color: var(--single-text-muted);
    margin-bottom: 0.75rem;
}

.single .comment-content p {
    margin-bottom: 0;
    color: var(--single-text-light);
}

.single .reply a {
    font-size: 0.875rem;
    text-decoration: none;
    color: var(--single-accent);
}

/* Formulario de comentarios */
.single .comment-respond {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--single-bg-card);
    border-radius: 12px;
    border: 1px solid var(--single-border);
}

.single .comment-respond h3 {
    color: var(--single-text);
}

.single .comment-form label {
    color: var(--single-text-muted);
}

.single .comment-form input,
.single .comment-form textarea {
    border: 1px solid var(--single-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    width: 100%;
    background-color: var(--single-bg);
    color: var(--single-text);
}

.single .comment-form input:focus,
.single .comment-form textarea:focus {
    outline: none;
    border-color: var(--single-accent);
    box-shadow: 0 0 0 3px rgba(191, 155, 92, 0.2);
}

.single.dark-mode .comment-form input:focus,
.single.dark-mode .comment-form textarea:focus {
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.2);
}

.single .form-submit input {
    background-color: var(--single-accent);
    color: var(--single-bg);
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.single .form-submit input:hover {
    background-color: var(--single-accent-hover);
    transform: translateY(-1px);
}

/* ==============================================
   SIDEBAR - WIDGETS
   ============================================== */
.single .ad-widget {
    position: sticky;
    top: 100px;
    background-color: var(--single-bg-card) !important;
    border: 1px solid var(--single-border);
}

.single .ad-widget .bg-white {
    background-color: var(--single-bg) !important;
}

.single .ad-widget .text-muted {
    color: var(--single-text-muted) !important;
}

.single .ad-widget i.text-muted {
    color: var(--single-text-muted) !important;
}

/* ==============================================
   MODAL DE COMPARTIR
   ============================================== */
.single .modal-content {
    background-color: var(--single-bg-card);
    border: 1px solid var(--single-border);
}

.single .modal-header {
    border-bottom-color: var(--single-border);
}

.single .modal-header .modal-title {
    color: var(--single-text);
}

.single .modal-header .btn-close {
    filter: invert(0);
}

.single.dark-mode .modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.single .modal-body .btn-outline-secondary {
    color: var(--single-text-muted);
    border-color: var(--single-border);
}

.single .modal-body .btn-outline-secondary:hover {
    background-color: var(--single-accent);
    border-color: var(--single-accent);
    color: var(--single-bg);
}

.single .modal-body .form-control {
    background-color: var(--single-bg) !important;
    border-color: var(--single-border);
    color: var(--single-text);
}

.single .modal-body .btn-primary {
    background-color: var(--single-accent);
    border-color: var(--single-accent);
    color: var(--single-bg);
}

/* ==============================================
   RESPONSIVE
   ============================================== */
@media (max-width: 991px) {
    .single .article-tools {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }
    
    .single .article-tools .d-flex:first-child {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .single h1.display-3 {
        font-size: 2rem !important;
    }
    
    .single .article-content {
        font-size: 1rem;
        line-height: 1.65;
    }
    
    .single .article-content h2 {
        font-size: 1.5rem;
    }
    
    .single .article-content h3 {
        font-size: 1.3rem;
    }
    
    .single .article-content blockquote {
        padding-left: 1rem;
    }
    
    .single .article-content blockquote p {
        font-size: 1rem;
    }
    
    .single .author-bio-card .d-flex {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 576px) {
    .single .article-tools button {
        font-size: 0.8rem;
    }
    
    .single .article-tools button i {
        font-size: 0.9rem;
    }
    
    .single .post-navigation {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ==============================================
   SCROLLBAR PERSONALIZADA (solo modo oscuro)
   ============================================== */
.single.dark-mode ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.single.dark-mode ::-webkit-scrollbar-track {
    background: var(--single-bg-card);
    border-radius: 4px;
}

.single.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--single-border);
    border-radius: 4px;
}

.single.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: var(--single-accent);
}


/* ==============================================
   FORZAR ESTILOS EN FORMULARIOS DE COMENTARIOS
   ============================================== */

/* Asegurar que todos los textos del formulario tengan el color correcto */
.single .comment-respond * {
    color: inherit;
}

.single .comment-respond label,
.single .comment-respond .comment-notes,
.single .comment-respond .logged-in-as,
.single .comment-respond .required-field-message {
    color: var(--single-text-muted) !important;
}

.single .comment-respond .comment-reply-title,
.single .comment-respond h3 {
    color: var(--single-text) !important;
}

/* Forzar color de fondo y texto en inputs */
.single .comment-respond input[type="text"],
.single .comment-respond input[type="email"],
.single .comment-respond input[type="url"],
.single .comment-respond textarea {
    background-color: var(--single-bg) !important;
    color: var(--single-text) !important;
    border-color: var(--single-border) !important;
}

/* Placeholder en modo oscuro */
.single.dark-mode .comment-respond input::placeholder,
.single.dark-mode .comment-respond textarea::placeholder {
    color: #6c757d;
}

.single.dark-mode .comment-respond input,
.single.dark-mode .comment-respond textarea {
    background-color: var(--single-bg) !important;
    color: var(--single-text) !important;
}

/* ==============================================
   CORRECCIONES GLOBALES PARA MODO OSCURO
   ============================================== */

/* En modo oscuro, invertir colores de Bootstrap */
.single.dark-mode .text-dark {
    color: var(--single-text) !important;
}

.single.dark-mode .text-muted {
    color: var(--single-text-muted) !important;
}

.single.dark-mode .bg-white {
    background-color: var(--single-bg) !important;
}

.single.dark-mode .border-bottom {
    border-bottom-color: var(--single-border) !important;
}

.single.dark-mode .border {
    border-color: var(--single-border) !important;
}

/* Para los enlaces dentro de relacionados */
.single.dark-mode .related-posts-widget .text-dark {
    color: var(--single-text) !important;
}

.single.dark-mode .related-posts-widget .text-muted {
    color: var(--single-text-muted) !important;
}