/**
 * Moondial Web Stories - Carousel Styles
 */

:root {
    --mws-primary-color: #1a73e8;
    --mws-card-width: 135px;
    --mws-card-height: 240px;
    --mws-card-gap: 12px;
    --mws-border-radius: 12px;
    --mws-ring-size: 3px;
}

/* Carousel Container */
.mws-carousel {
    position: relative;
    width: 100%;
    padding: 20px 0;
    overflow: hidden;
}

.mws-carousel-container {
    overflow: hidden;
    margin: 0 50px;
}

.mws-carousel-track {
    display: flex;
    gap: var(--mws-card-gap);
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

/* Navigation Buttons */
.mws-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border: none !important;
    border-radius: 50% !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    cursor: pointer;
    z-index: 10;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease;
    color: #333 !important;
    padding: 0 !important;
}

.mws-carousel-nav:hover {
    background: var(--mws-primary-color) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3) !important;
}

.mws-carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f0f0f0 !important;
}

.mws-carousel-nav:disabled:hover {
    background: #f0f0f0 !important;
    color: #333 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.mws-carousel-prev {
    left: 0;
}

.mws-carousel-next {
    right: 0;
}

.mws-carousel-nav svg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    display: block !important;
}

.mws-carousel-nav svg polyline {
    stroke: currentColor !important;
    stroke-width: 2.5 !important;
    fill: none !important;
}

/* Story Card */
.mws-story-card {
    flex: 0 0 var(--mws-card-width);
    width: var(--mws-card-width);
}

.mws-story-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.mws-story-poster {
    position: relative;
    width: var(--mws-card-width);
    height: var(--mws-card-height);
    border-radius: var(--mws-border-radius);
    overflow: hidden;
    background: #f0f0f0;
}

.mws-story-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.mws-story-card:hover .mws-story-image {
    transform: scale(1.05);
}

/* Story Ring Border */
.mws-story-ring-border {
    position: absolute;
    inset: 0;
    border-radius: var(--mws-border-radius);
    border: 3px solid transparent;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mws-story-card:hover .mws-story-ring-border {
    opacity: 1;
}

/* Story Title */
.mws-story-title {
    margin: 10px 0 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: #333;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Play Icon */
.mws-story-poster::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    z-index: 5;
    transition: transform 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231a73e8'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mws-story-card:hover .mws-story-poster::before {
    transform: translate(-50%, -50%) scale(1);
}

/* Lazy Loading */
.mws-lazy {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mws-lazy.mws-loaded {
    opacity: 1;
}

/* No Stories Message */
.mws-no-stories {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
}

/* Style Variations */
.mws-style-compact .mws-story-card {
    --mws-card-width: 100px;
    --mws-card-height: 178px;
}

.mws-style-compact .mws-story-title {
    font-size: 11px;
}

.mws-style-large .mws-story-card {
    --mws-card-width: 180px;
    --mws-card-height: 320px;
}

.mws-style-large .mws-story-title {
    font-size: 15px;
}

/* Inline Story Link (in post content) */
.mws-inline-story-link {
    margin-bottom: 20px;
}

.mws-view-story-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--mws-primary-color) 0%, #0d47a1 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.mws-view-story-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.4);
    color: #fff;
}

.mws-story-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mws-story-icon svg {
    width: 20px;
    height: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .mws-carousel-container {
        margin: 0 40px;
    }
    
    .mws-carousel-nav {
        width: 32px;
        height: 32px;
    }
    
    .mws-carousel-nav svg {
        width: 16px;
        height: 16px;
    }
    
    .mws-story-card {
        --mws-card-width: 110px;
        --mws-card-height: 196px;
    }
    
    .mws-story-title {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .mws-carousel-container {
        margin: 0 35px;
    }
    
    .mws-story-card {
        --mws-card-width: 95px;
        --mws-card-height: 169px;
    }
    
    .mws-story-poster::before {
        width: 40px;
        height: 40px;
        background-size: 20px;
    }
}

/* Touch Scroll on Mobile */
@media (hover: none) and (pointer: coarse) {
    .mws-carousel-container {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .mws-carousel-container::-webkit-scrollbar {
        display: none;
    }
    
    .mws-story-card {
        scroll-snap-align: start;
    }
    
    .mws-carousel-nav {
        display: none;
    }
    
    .mws-carousel-container {
        margin: 0;
        padding: 0 15px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mws-story-title {
        color: #e0e0e0;
    }
    
    .mws-carousel-nav {
        background: #333;
        color: #fff;
    }
    
    .mws-carousel-nav:hover {
        background: var(--mws-primary-color);
    }
    
    .mws-carousel-nav:disabled {
        background: #222;
        color: #666;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mws-carousel-track {
        transition: none;
    }
    
    .mws-story-image {
        transition: none;
    }
    
    .mws-story-poster::before {
        transition: none;
    }
}

/* ========================================
   FORMATO CIRCULAR
   ======================================== */
.mws-format-circle .mws-story-card {
    flex: 0 0 90px !important;
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
}

.mws-format-circle .mws-story-poster {
    position: relative;
    width: 84px !important;
    height: 84px !important;
    min-width: 84px !important;
    min-height: 84px !important;
    max-width: 84px !important;
    max-height: 84px !important;
    border-radius: 50% !important;
    padding: 3px;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) !important;
    overflow: hidden !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mws-format-circle .mws-story-poster::before,
.mws-format-circle .mws-story-poster::after {
    display: none !important;
    content: none !important;
}

.mws-format-circle .mws-story-image {
    width: 74px !important;
    height: 74px !important;
    min-width: 74px !important;
    min-height: 74px !important;
    max-width: 74px !important;
    max-height: 74px !important;
    border-radius: 50% !important;
    border: 2px solid #fff !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
}

.mws-format-circle .mws-story-title {
    display: none !important;
}

.mws-format-circle .mws-story-ring-border {
    display: none !important;
}

.mws-format-circle .mws-story-link {
    display: block;
    width: 84px;
    height: 84px;
}

/* ========================================
   FORMATO RETANGULAR (padrão)
   ======================================== */
.mws-format-rectangle .mws-story-card {
    --mws-card-width: 135px;
    --mws-card-height: 240px;
}

.mws-format-rectangle .mws-story-poster {
    border-radius: 12px;
}

.mws-format-rectangle .mws-story-ring-border {
    border-radius: 12px;
}
