/**
 * Noticias Destacadas Widget Styles
 *
 * @package AMW_Widgets
 * @since 1.0.0
 */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Host+Grotesk:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

/* Widget Container */
.noticias-destacadas-widget {
    width: 100%;
    font-family: 'Host Grotesk', sans-serif;
}

/* Main Posts Container */
.posts-container {
    display: flex;
    gap: 30px;
    width: 100%;
    align-items: stretch;
}

/* Main Post Container (Left 50%) */
.main-post-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Main Post Styles */
.main-post {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: local;
    border-radius: 15px;
    overflow: hidden;
    height: 600px !important;
    display: flex;
    align-items: flex-end;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.main-post .post-link {
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 15px;
    overflow: hidden;
}

.main-post .post-link:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.main-post .post-link:hover .post-overlay {
    background: linear-gradient(
        180deg, 
        rgba(0, 0, 0, 0.05) 0%, 
        rgba(0, 0, 0, 0.35) 50%, 
        rgba(0, 0, 0, 0.75) 100%
    );
}

.main-post .post-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        180deg, 
        rgba(0, 0, 0, 0.1) 0%, 
        rgba(0, 0, 0, 0.4) 50%, 
        rgba(0, 0, 0, 0.8) 100%
    );
    display: flex;
    align-items: flex-end;
    padding: 30px;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-post .post-content {
    color: white;
    width: 100%;
    position: relative;
}

.main-post .post-category {
    display: inline-block;
    background-color: #000000;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.main-post .post-title {
    font-size: 28px !important;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 10px 0;
    color: #ffffff;
}

.main-post .post-title a {
    color: #ffffff !important;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.main-post .post-title a:hover {
    opacity: 0.8;
    color: #ffffff !important;
}

.main-post .post-excerpt {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    margin: 0 0 15px 0;
    color: #ffffff;
    opacity: 0.9;
}

.main-post .post-date {
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Show All Button - Control visibility for desktop vs mobile */
.show-all-container.mobile-button {
    display: none; /* Hide mobile button by default (desktop view) */
}

.show-all-container.desktop-button {
    display: flex; /* Show desktop button by default */
}

/* Show All Button */
.show-all-container {
    display: flex;
    justify-content: flex-start;
    background: transparent !important;
}

.show-all-button {
    display: inline-flex;
    align-items: center;
    gap: 0;
    text-decoration: none !important;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    background: transparent !important;
    outline: none;
    box-shadow: none;
}

.show-all-button:hover {
    background: transparent !important;
    text-decoration: none !important;
}

.show-all-button:focus {
    background: transparent !important;
    outline: none;
    text-decoration: none !important;
}

.show-all-button:active {
    background: transparent !important;
    text-decoration: none !important;
}

.show-all-button .button-text {
    background-color: #000000;
    color: white;
    padding: 15px 25px;
    border-radius: 60px;
    font-size: 14px;
    font-weight: 500;
    height: 53px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.show-all-button:hover .button-text {
    background-color: #333333;
}

.show-all-button .button-arrow {
    width: 52px;
    height: 53px;
    background-color: #cf2e26;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(-45deg);
    flex-shrink: 0;
    margin-left: -1px;
}

.show-all-button:hover .button-arrow {
    background-color: #b02620;
    transform: rotate(-45deg) translateX(2px) translateY(-2px);
    box-shadow: 0 4px 8px rgba(207, 46, 38, 0.3);
}

/* Secondary Posts Container (Right 50%) */
.secondary-posts-container {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    padding: 0;
    height: 600px !important;
    align-content: stretch;
}

/* Secondary Post Styles */
.secondary-post {
    overflow: hidden;
    border-radius: 16px;
    display: flex;
}

/* Line Divider */
.line-divider {
    width: 100%;
    border-top: 1px solid #d9d9d9;
    height: 1px;
    margin: 20px 0;
}

.secondary-post .post-link {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 0;
    background-color: transparent;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.secondary-post .post-link:hover {
    background-color: rgba(248, 249, 250, 0.8);
}

.secondary-post .post-link:hover .post-image {
    opacity: 0.9;
}

.secondary-post .post-link:hover .post-title {
    color: #004388;
}

.secondary-post .post-image {
    width: 280px !important;
    height: 100% !important;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: local;
    border-radius: 15px;
    flex-shrink: 0;
    background-color: #e9ecef;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Override Elementor inline styles for height */
[class*="elementor-"] .secondary-post .post-image {
    height: 100% !important;
}

.secondary-post .post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 20px;
}

.secondary-post .post-category {
    display: inline-block;
    background-color: #000000;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.secondary-post .post-title {
    font-size: 21px !important;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: #333333;
}

.secondary-post .post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.secondary-post .post-title a:hover {
    color: #004388;
}

.secondary-post .post-excerpt {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    margin: 0;
    color: #666666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.secondary-post .post-date {
    font-size: 11px;
    font-weight: 500;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: auto;
}

/* Responsive Design */

/* Tablet Design - Improved layout for tablet sizes */
@media (max-width: 1024px) and (min-width: 769px) {
    .posts-container {
        gap: 20px;
    }
    
    .main-post {
        height: 500px !important;
    }
    
    .main-post .post-overlay {
        padding: 25px;
    }
    
    .main-post .post-title {
        font-size: 24px !important;
    }
    
    .main-post .post-excerpt {
        font-size: 14px;
    }
    
    .secondary-posts-container {
        height: 500px !important;
    }
    
    .secondary-post .post-image {
        width: 200px !important;
        height: 100% !important;
    }
    
    .secondary-post .post-content {
        padding: 15px;
        gap: 6px;
    }
    
    .secondary-post .post-title {
        font-size: 18px !important;
        line-height: 1.2;
    }
    
    .secondary-post .post-excerpt {
        font-size: 12px;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .secondary-post .post-date {
        font-size: 10px;
    }
    
    .secondary-post .post-category {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* Mobile Design */
@media (max-width: 768px) {
    /* Override desktop image width for mobile */
    .noticias-destacadas-widget .secondary-post .post-image {
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
    }
    .posts-container {
        flex-direction: column;
        gap: 20px;
        padding: 0;
    }
    
    /* Main post container adjustments for mobile */
    .main-post-container {
        order: 1;
        gap: 0;
    }
    
    .main-post {
        height: 320px !important;
        margin-bottom: 0;
    }
    
    .main-post .post-overlay {
        padding: 20px;
    }
    
    .main-post .post-title {
        font-size: 22px !important;
        color: #ffffff !important;
    }
    
    .main-post .post-title a {
        color: #ffffff !important;
    }
    
    .main-post .post-excerpt {
        font-size: 13px;
        color: #ffffff;
    }
    
    /* Secondary posts adjustments */
    .secondary-posts-container {
        order: 2;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 20px;
        height: auto !important;
        margin-top: 20px;
    }
    
    .secondary-post {
        padding: 15px;
        background: #f8f9fa;
        border-radius: 12px;
    }
    
    .secondary-post .post-link {
        gap: 15px;
        padding: 0;
        min-width: 0;
        flex: 1;
        align-items: flex-start;
    }
    
    .noticias-destacadas-widget .secondary-post .post-image {
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
        flex-shrink: 0 !important;
    }
    
    .secondary-post .post-content {
        padding: 0;
        gap: 8px;
        min-width: 0;
        flex: 1;
    }
    
    .secondary-post .post-title {
        font-size: 15px !important;
        line-height: 1.2;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .secondary-post .post-excerpt {
        font-size: 11px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        word-wrap: break-word;
        overflow-wrap: break-word;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    /* Button visibility control for mobile */
    .show-all-container.desktop-button {
        display: none !important; /* Hide desktop button on mobile */
    }
    
    .show-all-container.mobile-button {
        display: flex !important; /* Show mobile button on mobile */
        order: 3;
        margin-top: 20px;
        justify-content: center;
    }
    
    .line-divider {
        display: none;
    }
}

@media (max-width: 480px) {
    /* Force smaller image size for very small screens */
    .noticias-destacadas-widget .secondary-post .post-image {
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
    }
    .noticias-destacadas-widget {
        padding: 0;
    }
    
    .posts-container {
        gap: 15px;
        padding: 0;
    }
    
    .main-post {
        height: 250px !important;
        border-radius: 12px;
    }
    
    .main-post .post-overlay {
        padding: 15px;
    }
    
    .main-post .post-title {
        font-size: 18px !important;
        color: #ffffff !important;
        line-height: 1.2;
    }
    
    .main-post .post-title a {
        color: #ffffff !important;
    }
    
    .main-post .post-excerpt {
        font-size: 12px;
        margin-bottom: 10px;
        color: #ffffff;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .secondary-posts-container {
        gap: 15px;
    }
    
    .secondary-post {
        padding: 12px;
        background: #f8f9fa;
        border-radius: 10px;
    }
    
    .secondary-post .post-link {
        gap: 12px;
        min-width: 0;
        flex: 1;
        align-items: flex-start;
    }
    
    .noticias-destacadas-widget .secondary-post .post-image {
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
        flex-shrink: 0 !important;
        border-radius: 8px;
    }
    
    .secondary-post .post-content {
        padding: 0;
        gap: 6px;
        min-width: 0;
        flex: 1;
    }
    
    .secondary-post .post-title {
        font-size: 13px !important;
        line-height: 1.2;
        margin-bottom: 4px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .secondary-post .post-excerpt {
        font-size: 10px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        word-wrap: break-word;
        overflow-wrap: break-word;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .secondary-post .post-date {
        font-size: 10px;
        margin-top: 4px;
    }
    
    .secondary-post .post-category {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    /* Button styles for mobile */
    .show-all-container {
        margin-top: 15px;
        width: 100%;
    }
    
    .show-all-button {
        width: 100%;
        justify-content: center;
    }
    
    .show-all-button .button-text {
        padding: 12px 20px;
        font-size: 13px;
        height: 45px;
        flex: 1;
        text-align: center;
    }
    
    .show-all-button .button-arrow {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
}

/* Accessibility */
.main-post:focus-within,
.secondary-post:focus-within {
    outline: 2px solid #004388;
    outline-offset: 2px;
}

.show-all-button:focus {
    outline: 2px solid #004388;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .show-all-button {
        display: none;
    }
    
    .main-post,
    .secondary-post {
        break-inside: avoid;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .main-post .post-overlay {
        background: linear-gradient(
            180deg, 
            rgba(0, 0, 0, 0.3) 0%, 
            rgba(0, 0, 0, 0.7) 50%, 
            rgba(0, 0, 0, 0.9) 100%
        );
    }
    
    .secondary-post {
        border: 1px solid #333333;
    }
    
    .secondary-post:hover {
        border-color: #004388;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .main-post,
    .secondary-post,
    .show-all-button,
    .main-post .post-title a,
    .secondary-post .post-title a {
        transition: none;
    }
    
    .main-post:hover,
    .secondary-post:hover,
    .show-all-button:hover {
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* Keep clean design even in dark mode */
    
    .secondary-post .post-title {
        color: #333333; /* Keep original colors for secondary posts */
    }
    
    .secondary-post .post-excerpt {
        color: #666666;
    }
    
    .secondary-post .post-date {
        color: #999999;
    }
    
    /* Main post text should always be white */
    .main-post .post-title,
    .main-post .post-title a {
        color: #ffffff !important;
    }
    
    .main-post .post-excerpt,
    .main-post .post-date {
        color: #ffffff;
    }
}

/* Skeleton Loading State */
.noticias-destacadas-widget.loading {
    pointer-events: none;
}

.noticias-destacadas-widget.loading .posts-container {
    opacity: 0;
}

.noticias-destacadas-widget.loading .skeleton-container {
    display: block;
}

.skeleton-container {
    display: none;
    width: 100%;
}

.skeleton-posts-container {
    display: flex;
    gap: 30px;
    width: 100%;
    align-items: stretch;
}

/* Main Skeleton */
.skeleton-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skeleton-main-post {
    height: 600px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.skeleton-main-post::after {
    content: '';
    position: absolute;
    bottom: 30px;
    left: 30px;
    right: 30px;
    height: 120px;
    background: linear-gradient(
        180deg, 
        transparent 0%, 
        rgba(240, 240, 240, 0.8) 50%, 
        rgba(240, 240, 240, 0.95) 100%
    );
    border-radius: 10px;
}


/* Secondary Skeletons */
.skeleton-secondary {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    height: 600px;
}

.skeleton-secondary-post {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.skeleton-secondary-image {
    width: 280px;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 15px;
    flex-shrink: 0;
}

.skeleton-secondary-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-category {
    width: 80px;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 12px;
}

.skeleton-title {
    width: 100%;
    height: 24px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 5px;
}

.skeleton-title.short {
    width: 75%;
}

.skeleton-excerpt {
    width: 100%;
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-excerpt.short {
    width: 60%;
}

.skeleton-date {
    width: 100px;
    height: 14px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-top: auto;
}

.skeleton-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    margin: 20px 0;
}

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

/* Tablet Responsive for Skeleton */
@media (max-width: 1024px) and (min-width: 769px) {
    .skeleton-main-post {
        height: 500px;
    }
    
    .skeleton-secondary {
        height: 500px;
    }
    
    .skeleton-secondary-image {
        width: 200px;
    }
    
    .skeleton-secondary-content {
        padding: 15px;
        gap: 8px;
    }
}

/* Mobile Responsive for Skeleton */
@media (max-width: 768px) {
    .skeleton-posts-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .skeleton-main-post {
        height: 320px;
    }
    
    .skeleton-secondary {
        display: flex;
        flex-direction: column;
        gap: 20px;
        height: auto;
        margin-top: 20px;
    }
    
    .skeleton-secondary-post {
        padding: 15px;
        background: #f0f0f0;
        border-radius: 12px;
        gap: 15px;
    }
    
    .skeleton-secondary-image {
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
    }
    
    .skeleton-secondary-content {
        padding: 0;
        gap: 6px;
    }
    
    .skeleton-divider {
        display: none;
    }
}