/*
Theme Name: Prensar News Theme
Description: Theme optimizado para noticias con performance perfecta, SEO avanzado y sistema de ads inteligente. Desarrollado para Google News Initiative.
Version: 1.0.0
Author: Prensar Development Team
Author URI: https://prensar.net
Text Domain: prensar-news
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Prensar News Theme is distributed under the terms of the GNU GPL v2 or later.
*/

/**
 * PRENSAR NEWS THEME - STYLES
 * 
 * Estructura:
 * 1. CSS Reset & Base (crítico - en header)
 * 2. Layout Principal (crítico - en header)  
 * 3. Componentes no críticos (este archivo)
 * 4. Utilidades y helpers
 * 5. Responsive breakpoints
 * 
 * Performance: CSS crítico inlineado, este archivo cargado diferido
 */

/* ==========================================================================
   ESTILOS NO CRÍTICOS (Cargados diferidos)
   ========================================================================== */

/* Animaciones y transiciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Componentes mejorados del artículo */
.article-content {
    animation: fadeInUp 0.6s ease-out;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    position: relative;
    padding-left: 15px;
}

.article-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #3498db, #2980b9);
    border-radius: 2px;
}

.article-content h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #3498db;
    border-radius: 50%;
}

/* Blockquotes mejoradas */
.article-content blockquote {
    position: relative;
    padding: 25px 30px 25px 60px;
    margin: 30px 0;
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    border-radius: 8px;
    font-style: italic;
    font-size: 1.1em;
    color: #495057;
}

.article-content blockquote::before {
    content: '"';
    position: absolute;
    left: 20px;
    top: 10px;
    font-size: 3rem;
    color: #3498db;
    line-height: 1;
    font-family: Georgia, serif;
}

.article-content blockquote cite {
    display: block;
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
    font-style: normal;
}

/* Links mejorados */
.article-content a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.article-content a:hover {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

.article-content a[href^="http"]::after {
    content: '↗';
    font-size: 0.8em;
    margin-left: 4px;
    color: #95a5a6;
}

/* Listas mejoradas */
.article-content ul,
.article-content ol {
    padding-left: 0;
    margin: 20px 0;
    list-style-type: none;
}

.article-content li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.article-content ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #3498db;
    font-weight: bold;
    font-size: 1.2em;
}

.article-content ol {
    counter-reset: item;
}

.article-content ol li::before {
    content: counter(item) '.';
    counter-increment: item;
    position: absolute;
    left: 0;
    color: #3498db;
    font-weight: bold;
}

/* Tablas responsivas */
.article-content table {
    width: 100%;
    margin: 25px 0;
    border-collapse: collapse;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
}

.article-content th,
.article-content td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.article-content th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
}

.article-content tr:hover {
    background: #f8f9fa;
}

/* Código y preformateado */
.article-content code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.article-content pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 25px 0;
    position: relative;
}

.article-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* Tags del artículo mejorados */
.article-tags {
    margin: 40px 0 30px;
    padding: 20px 0;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

.tags-label {
    font-weight: 600;
    color: #495057;
    margin-right: 15px;
    font-size: 0.9rem;
}

.tag-link {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 6px 12px;
    margin: 5px 5px 5px 0;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.tag-link:hover {
    background: #3498db;
    color: #fff;
    transform: translateY(-1px);
}

/* Sharing buttons mejorados */
.article-sharing {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    margin: 40px 0;
    text-align: center;
}

.sharing-label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    font-size: 1rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #495057;
    padding: 10px 16px;
    margin: 5px;
    border: 1px solid #dee2e6;
    border-radius: 25px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.share-facebook:hover {
    background: #1877f2;
    color: #fff;
    border-color: #1877f2;
}

.share-twitter:hover {
    background: #1da1f2;
    color: #fff;
    border-color: #1da1f2;
}

.share-whatsapp:hover {
    background: #25d366;
    color: #fff;
    border-color: #25d366;
}

.share-copy:hover {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

.share-icon {
    font-size: 1.1em;
}

/* Sidebar widgets mejorados */
.sidebar .widget {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    transition: transform 0.3s ease;
}

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

.widget-title {
    position: relative;
    padding-left: 15px;
}

.widget-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(to bottom, #3498db, #2980b9);
    border-radius: 2px;
}

/* Related posts mejorados */
.related-post {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f1f3f4;
    transition: all 0.3s ease;
}

.related-post:hover {
    background: #f8f9fa;
    margin: 0 -10px;
    padding-left: 25px;
    padding-right: 25px;
    border-radius: 8px;
}

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

.related-thumb {
    flex: 0 0 80px;
}

.related-thumb img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.related-content {
    flex: 1;
    min-width: 0;
}

.related-title {
    margin: 0 0 8px;
    font-size: 0.95rem;
    line-height: 1.3;
}

.related-title a {
    color: #2c3e50;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-title a:hover {
    color: #3498db;
}

.related-date {
    font-size: 0.8rem;
    color: #6c757d;
}

/* Formularios mejorados */
.newsletter-form {
    background: linear-gradient(135deg, #3498db, #2980b9);
    padding: 25px;
    border-radius: 12px;
    margin: 20px 0;
}

.newsletter-form .widget-title {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.3);
}

.newsletter-form .widget-title::before {
    background: #fff;
}

.newsletter-description {
    color: rgba(255,255,255,0.9);
    margin-bottom: 20px;
}

.newsletter-input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.newsletter-btn {
    background: #fff;
    color: #3498db;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.newsletter-btn:hover {
    background: #ecf0f1;
    transform: translateY(-1px);
}

/* Breadcrumbs mejorados */
.breadcrumb {
    background: linear-gradient(90deg, #f8f9fa, #fff);
    padding: 12px 20px;
    border-radius: 8px;
    margin: 15px 0 25px;
    border: 1px solid #e9ecef;
}

.breadcrumb ol {
    align-items: center;
}

.breadcrumb a {
    position: relative;
    transition: all 0.3s ease;
}

.breadcrumb a:hover {
    color: #2980b9;
}

/* Ad containers mejorados */
.ad-container {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.ad-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #3498db, #2980b9, #3498db);
    border-radius: 10px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ad-container:hover::before {
    opacity: 0.1;
}

.ad-placeholder {
    font-family: system-ui, sans-serif;
    font-weight: 500;
    letter-spacing: 2px;
    position: relative;
}

.ad-placeholder::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Category links mejorados */
.article-category {
    margin-bottom: 15px;
}

.category-link {
    position: relative;
    overflow: hidden;
}

.category-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.category-link:hover::before {
    left: 100%;
}

/* High Contrast */
@media (prefers-contrast: high) {
    .article-content a {
        text-decoration: underline;
        border-bottom: 2px solid currentColor;
    }
    
    .share-btn {
        border-width: 2px;
    }
    
    .category-link {
        border: 2px solid currentColor;
    }
}

/* Focus Management for Accessibility */
*:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    padding: 8px 16px;
    background: #000;
    color: #fff;
    text-decoration: none;
}

.skip-link:focus {
    left: 6px;
    top: 7px;
}

/* ==========================================================================
   UTILIDADES
   ========================================================================== */

/* Screen Reader Only */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Clearfix */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-bold { font-weight: bold; }
.text-normal { font-weight: normal; }

/* Display utilities */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Mobile First - Extra Small devices */
@media (max-width: 575.98px) {
    .container {
        padding: 0 15px;
    }
    
    .article-title {
        font-size: 1.75rem;
    }
    
    .article-content {
        font-size: 1rem;
    }
    
    .share-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        margin: 3px;
    }
}

/* Medium devices (tablets) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .content-grid {
        grid-template-columns: 1fr 280px;
        gap: 25px;
    }
    
    .ads-column {
        display: none;
    }
}

/* Large devices (desktops) */
@media (min-width: 992px) {
    .content-grid {
        grid-template-columns: 1fr 300px 250px;
    }
    
    .container {
        max-width: 1140px;
    }
}

/* ==========================================================================
   WORDPRESS CORE CLASSES
   ========================================================================== */

/* Alignments */
.alignnone {
    margin: 5px 20px 20px 0;
}

.aligncenter,
div.aligncenter {
    display: block;
    margin: 25px auto;
}

.alignright {
    float: right;
    margin: 5px 0 20px 20px;
}

.alignleft {
    float: left;
    margin: 5px 20px 20px 0;
}

.wp-caption {
    max-width: 96%;
    padding: 5px 3px 10px;
    text-align: center;
}

.wp-caption img {
    border: 0 none;
    height: auto;
    margin: 0;
    max-width: 98.5%;
    padding: 0;
    width: auto;
}

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
}

/* ==========================================================================
   PERFORMANCE OPTIMIZATIONS
   ========================================================================== */

/* Smooth scrolling for those who don't prefer reduced motion */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Contain layout shifts */
.widget,
.ad-container,
.article-content > * {
    contain: layout style;
}

/* Print Styles */
@media print {
    .site-header,
    .sidebar,
    .ads-column,
    .article-sharing,
    .site-footer,
    .ad-container {
        display: none !important;
    }
    
    .content-grid {
        grid-template-columns: 1fr !important;
    }
    
    .article-content {
        font-size: 12pt;
        line-height: 1.5;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.ads-wrap { display:block; width:100%; }
.sidebar .ads-wrap { min-width:300px; } /* o lo que mida tu columna */