/* ============================================
   RM ELEMENTOR WIDGETS - STYLES
   Paleta basada en logo Residencias Médicas
   ============================================ */

:root {
    --rm-navy: #1a3a5c;
    --rm-navy-light: #2a4a6c;
    --rm-turquoise: #2ab7b7;
    --rm-coral: #e86c4f;
    --rm-coral-hover: #d55a3f;
    --rm-light-bg: #f5f8fa;
    --rm-light-blue: #e8f4f5;
    --rm-white: #ffffff;
    --rm-gray: #6c757d;
    --rm-gray-light: #aaaaaa;
    --rm-border: #eeeeee;
    --rm-radius: 12px;
    --rm-radius-sm: 8px;
    --rm-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --rm-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.12);
    --rm-transition: all 0.3s ease;
}

/* ============================================
   HERO NEWS WIDGET
   ============================================ */
.rm-hero-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    background-size: cover;
    background-position: center;
    border-radius: var(--rm-radius);
    min-height: 400px;
}

.rm-hero-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.rm-hero-content {
    position: relative;
    z-index: 2;
    padding: 40px;
    width: 100%;
    max-width: 60%;
}

.rm-hero-content.rm-hero-align-center {
    max-width: 100%;
    text-align: center;
}

.rm-hero-content.rm-hero-align-right {
    margin-left: auto;
    text-align: right;
}

.rm-hero-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.rm-hero-title {
    color: var(--rm-white);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 15px;
}

.rm-hero-title a {
    color: inherit;
    text-decoration: none;
}

.rm-hero-excerpt {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 20px;
}

.rm-hero-button {
    display: inline-block;
    padding: 12px 28px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--rm-transition);
}

.rm-hero-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* ============================================
   NEWS GRID WIDGET
   ============================================ */
.rm-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    border-radius: var(--rm-radius) var(--rm-radius) 0 0;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0;
}

.rm-section-header h3 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.rm-section-header i,
.rm-section-header svg {
    font-size: 1.1em;
}

.rm-news-grid {
    display: grid;
    gap: 25px;
    margin-top: 0;
}

.rm-grid-card {
    background: var(--rm-white);
    border-radius: var(--rm-radius);
    overflow: hidden;
    box-shadow: var(--rm-shadow);
    transition: var(--rm-transition);
}

.rm-grid-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--rm-shadow-hover);
}

.rm-grid-image {
    position: relative;
    background-size: cover;
    background-position: center;
}

.rm-grid-image>a {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Aspect Ratios */
.rm-ratio-16-9 {
    padding-bottom: 56.25%;
}

.rm-ratio-4-3 {
    padding-bottom: 75%;
}

.rm-ratio-1-1 {
    padding-bottom: 100%;
}

.rm-ratio-3-2 {
    padding-bottom: 66.67%;
}

.rm-category-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rm-grid-content {
    padding: 20px;
}

.rm-grid-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 10px;
}

.rm-grid-title a {
    color: var(--rm-navy);
    text-decoration: none;
    transition: color 0.2s;
}

.rm-grid-title a:hover {
    color: var(--rm-coral);
}

.rm-grid-excerpt {
    font-size: 0.85rem;
    color: var(--rm-gray);
    line-height: 1.5;
    margin: 0 0 15px;
}

.rm-grid-meta {
    display: flex;
    gap: 15px;
    font-size: 0.75rem;
    color: var(--rm-gray-light);
    margin-bottom: 10px;
}

.rm-read-more {
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

/* Card Styles */
.rm-card-style-horizontal .rm-grid-card {
    display: grid;
    grid-template-columns: 120px 1fr;
}

.rm-card-style-horizontal .rm-grid-image {
    padding-bottom: 0;
    min-height: 100%;
}

.rm-card-style-overlay .rm-grid-card {
    position: relative;
}

.rm-card-style-overlay .rm-grid-image {
    padding-bottom: 75%;
}

.rm-card-style-overlay .rm-grid-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 30px 20px 20px;
}

.rm-card-style-overlay .rm-grid-title a,
.rm-card-style-overlay .rm-grid-excerpt {
    color: var(--rm-white);
}

/* ============================================
   SHORTS CAROUSEL WIDGET
   ============================================ */
.rm-shorts-header {
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 20px;
}

.rm-shorts-carousel {
    position: relative;
    padding: 0 40px;
}

.rm-shorts-carousel .swiper-slide {
    height: auto;
}

.rm-short-card {
    display: block;
    text-decoration: none;
    border-radius: var(--rm-radius);
    overflow: hidden;
    box-shadow: var(--rm-shadow);
    transition: var(--rm-transition);
}

.rm-short-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--rm-shadow-hover);
}

.rm-short-thumbnail {
    position: relative;
    padding-bottom: 177.78%;
    /* 9:16 aspect ratio */
    background-size: cover;
    background-position: center;
    background-color: var(--rm-light-blue);
}

.rm-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rm-navy);
    opacity: 0.9;
    transition: var(--rm-transition);
}

.rm-short-card:hover .rm-play-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.rm-short-title {
    display: block;
    padding: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rm-navy);
    background: var(--rm-white);
}

.rm-shorts-carousel .swiper-button-prev,
.rm-shorts-carousel .swiper-button-next {
    color: var(--rm-navy);
    width: 35px;
    height: 35px;
    background: var(--rm-white);
    border-radius: 50%;
    box-shadow: var(--rm-shadow);
}

.rm-shorts-carousel .swiper-button-prev::after,
.rm-shorts-carousel .swiper-button-next::after {
    font-size: 14px;
    font-weight: bold;
}

.rm-shorts-carousel .swiper-button-prev {
    left: 0;
}

.rm-shorts-carousel .swiper-button-next {
    right: 0;
}

/* ============================================
   CATEGORY MODULE WIDGET
   ============================================ */
.rm-category-module {
    border-radius: var(--rm-radius);
    overflow: hidden;
    box-shadow: var(--rm-shadow);
}

.rm-module-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
}

.rm-module-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: inherit;
}

.rm-module-header i,
.rm-module-header svg {
    font-size: 1em;
}

.rm-module-items {
    padding: 0;
}

.rm-module-item {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    align-items: flex-start;
}

.rm-module-item.rm-has-divider {
    border-bottom: 1px solid var(--rm-border);
}

.rm-module-item.rm-has-divider:last-child {
    border-bottom: none;
}

.rm-module-thumb {
    width: 60px;
    height: 50px;
    flex-shrink: 0;
    border-radius: var(--rm-radius-sm);
    overflow: hidden;
}

.rm-module-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rm-module-content {
    flex: 1;
    min-width: 0;
}

.rm-module-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 5px;
}

.rm-module-title a {
    text-decoration: none;
    transition: color 0.2s;
}

.rm-module-title a:hover {
    color: var(--rm-coral);
}

.rm-module-excerpt {
    font-size: 0.8rem;
    color: var(--rm-gray);
    margin: 0 0 8px;
    line-height: 1.4;
}

.rm-module-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.rm-module-date {
    color: var(--rm-gray-light);
}

.rm-module-link {
    font-weight: 600;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: opacity 0.2s;
}

.rm-module-link:hover {
    opacity: 0.8;
}

/* ============================================
   POPULAR POSTS WIDGET
   ============================================ */
.rm-popular-posts {
    padding: 20px;
    background: var(--rm-white);
    border-radius: var(--rm-radius);
    box-shadow: var(--rm-shadow);
}

.rm-popular-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 20px;
}

.rm-popular-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rm-post-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.rm-post-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.rm-post-number.rm-number-circle {
    border-radius: 50%;
}

.rm-post-number.rm-number-square {
    border-radius: 4px;
}

.rm-post-number.rm-number-plain {
    background: transparent !important;
    color: var(--rm-turquoise) !important;
    font-size: 1.2rem;
}

.rm-post-thumb {
    width: 60px;
    height: 50px;
    flex-shrink: 0;
    border-radius: var(--rm-radius-sm);
    overflow: hidden;
}

.rm-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rm-post-content {
    flex: 1;
    min-width: 0;
}

.rm-post-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

.rm-post-item-title a {
    text-decoration: none;
    transition: color 0.2s;
}

.rm-post-meta {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    margin-top: 4px;
}

.rm-post-category {
    text-transform: uppercase;
}

/* ============================================
   NO POSTS MESSAGE
   ============================================ */
.rm-no-posts {
    padding: 40px;
    text-align: center;
    background: var(--rm-light-bg);
    border-radius: var(--rm-radius);
    color: var(--rm-gray);
}

/* ============================================
   RESPONSIVE - MOBILE FIRST DESIGN
   Principios: Touch targets 44px+, texto legible,
   overlay completo para legibilidad
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .rm-hero-content {
        padding: 30px;
        max-width: 70%;
    }

    .rm-hero-title {
        font-size: 1.75rem;
    }
}

/* Mobile */
@media (max-width: 768px) {

    /* Hero - Full overlay para legibilidad */
    .rm-hero-card {
        min-height: 350px;
        align-items: stretch;
    }

    .rm-hero-overlay {
        background: linear-gradient(to top,
                rgba(26, 58, 92, 0.95) 0%,
                rgba(26, 58, 92, 0.8) 40%,
                rgba(26, 58, 92, 0.4) 100%) !important;
    }

    .rm-hero-content {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        padding: 20px;
        max-width: 100%;
        text-align: left;
    }

    .rm-hero-content.rm-hero-align-center,
    .rm-hero-content.rm-hero-align-right {
        text-align: left;
        margin-left: 0;
    }

    .rm-hero-badge {
        padding: 6px 12px;
        font-size: 0.65rem;
        margin-bottom: 12px;
    }

    .rm-hero-title {
        font-size: 1.25rem;
        line-height: 1.35;
        margin-bottom: 10px;
    }

    .rm-hero-excerpt {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 15px;
        /* Limitar a 3 líneas */
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .rm-hero-button {
        /* Touch target mínimo 44px */
        min-height: 44px;
        padding: 12px 24px;
        font-size: 0.8rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* News Grid */
    .rm-section-header {
        padding: 12px 16px;
        font-size: 0.85rem;
        border-radius: var(--rm-radius-sm) var(--rm-radius-sm) 0 0;
    }

    .rm-news-grid {
        gap: 15px;
    }

    .rm-grid-content {
        padding: 15px;
    }

    .rm-grid-title {
        font-size: 0.9rem;
    }

    .rm-grid-excerpt {
        font-size: 0.8rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .rm-read-more {
        /* Touch target */
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 8px 0;
    }

    /* Card styles */
    .rm-card-style-horizontal .rm-grid-card {
        grid-template-columns: 1fr;
    }

    .rm-card-style-horizontal .rm-grid-image {
        padding-bottom: 56.25%;
        /* 16:9 en mobile */
    }

    /* Shorts Carousel */
    .rm-shorts-header {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .rm-shorts-carousel {
        padding: 0;
    }

    .rm-shorts-carousel .swiper-button-prev,
    .rm-shorts-carousel .swiper-button-next {
        display: none;
    }

    .rm-short-thumbnail {
        padding-bottom: 150%;
        /* Un poco menos alto en mobile */
    }

    .rm-short-title {
        font-size: 0.75rem;
        padding: 10px;
    }

    /* Category Module */
    .rm-module-header {
        padding: 12px 16px;
    }

    .rm-module-header h3 {
        font-size: 0.85rem;
    }

    .rm-module-item {
        padding: 12px 16px;
    }

    .rm-module-title {
        font-size: 0.85rem;
    }

    .rm-module-link {
        /* Touch target */
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Popular Posts */
    .rm-popular-posts {
        padding: 16px;
    }

    .rm-popular-title {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .rm-post-item {
        gap: 10px;
    }

    .rm-post-number {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }

    .rm-post-item-title {
        font-size: 0.85rem;
    }
}

/* Small phones */
@media (max-width: 375px) {
    .rm-hero-card {
        min-height: 300px;
    }

    .rm-hero-title {
        font-size: 1.1rem;
    }

    .rm-hero-excerpt {
        -webkit-line-clamp: 2;
    }

    .rm-grid-title {
        font-size: 0.85rem;
    }
}

/* ============================================
   VIDEO POPUP LIGHTBOX
   ============================================ */
.rm-video-popup {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rm-video-popup-overlay {
    position: absolute;
    inset: 0;
    background: var(--popup-overlay, rgba(0, 0, 0, 0.9));
    cursor: pointer;
}

.rm-video-popup-content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 400px;
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: var(--rm-radius);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: rm-popup-scale-in 0.3s ease;
}

@keyframes rm-popup-scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.rm-video-popup-close {
    position: absolute;
    top: -45px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}

.rm-video-popup-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.rm-video-popup-iframe-container {
    width: 100%;
    height: 100%;
}

.rm-video-popup-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Popup on desktop - larger */
@media (min-width: 768px) {
    .rm-video-popup-content {
        max-width: 450px;
    }
}