/**
 * MYIO Blocks Frontend CSS - v2.0.0
 * Matches category page design exactly
 * Only loads on page-gutenberg template
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --myio-primary: #FF7396;
    --myio-primary-hover: #ff5a80;
    --myio-dark: #1a1a2e;
    --myio-text: #333;
    --myio-text-muted: #666;
    --myio-border: #e5e5e5;
    --myio-bg-light: #f7f7f7;
    --myio-white: #fff;
    --myio-radius: 12px;
    --myio-radius-lg: 16px;
    --myio-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --myio-shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
    --myio-transition: 0.25s ease;
}

/* ========================================
   Base Reset & Container
   ======================================== */
.myio-container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ========================================
   Hero Section
   ======================================== */
.myio-hero {
    background: linear-gradient(135deg, #fff5f7 0%, #fff 50%, #f0f9ff 100%);
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.myio-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,115,150,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.myio-hero__inner {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.myio-hero__badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--myio-primary), #ff9e6d);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 24px;
}

.myio-hero__headline {
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 700;
    color: var(--myio-dark);
    margin: 0 0 20px;
    line-height: 1.2;
}

.myio-hero__subheadline {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--myio-text-muted);
    margin: 0 0 32px;
    line-height: 1.6;
}

.myio-hero__ctas {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 32px;
}

.myio-hero__trust {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 14px;
    color: var(--myio-text-muted);
}

.myio-hero__trust span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========================================
   Buttons
   ======================================== */
.myio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--myio-transition);
    border: none;
    cursor: pointer;
}

.myio-btn--primary {
    background: var(--myio-primary);
    color: white;
}

.myio-btn--primary:hover {
    background: var(--myio-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,115,150,0.4);
}

.myio-btn--white {
    background: white;
    color: var(--myio-primary);
}

.myio-btn--white:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: var(--myio-shadow-hover);
}

/* ========================================
   Labels
   ======================================== */
.myio-label {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--myio-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* ========================================
   Category Slider Section - Matching category page exactly
   ======================================== */
.myio-slider-section {
    padding: 40px 0;
    background: var(--myio-white);
}

.myio-slider-section:first-of-type {
    padding-top: 20px;
}

.myio-slider-section + .myio-slider-section {
    padding-top: 0;
}

.myio-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.myio-slider-title {
    font-size: 24px;
    font-weight: 600;
    color: #222;
    margin: 0;
    text-transform: capitalize;
}

.myio-view-all {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--myio-primary);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
}

.myio-view-all:hover {
    color: #e85a7f;
}

.myio-view-all .myio-arrow {
    font-size: 16px;
}

/* ========================================
   Carousel - Native CSS Scroll (matching category page exactly)
   ======================================== */
.myio-slider-wrapper {
    position: relative;
}

.myio-carousel {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
}

.myio-carousel::-webkit-scrollbar {
    display: none;
}

/* Card widths matching category page exactly */
.myio-carousel-item {
    flex: 0 0 auto;
    width: calc(20% - 13px); /* 5 items on desktop */
    min-width: 0;
}

/* Navigation arrows - matching category page exactly */
.myio-slider-nav {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    padding: 0;
}

.myio-slider-nav:hover:not(.is-disabled) {
    background: #FF7396;
    box-shadow: 0 4px 16px rgba(255,115,150,0.4);
}

.myio-slider-nav:hover:not(.is-disabled) svg path {
    stroke: #fff;
}

.myio-slider-nav.is-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.myio-slider-nav svg {
    width: 24px;
    height: 24px;
    display: block;
    flex-shrink: 0;
}

.myio-slider-prev {
    left: 12px;
}

.myio-slider-next {
    right: 12px;
}

/* ========================================
   Product Card - Matching category page exactly
   ======================================== */
.myio-product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: none !important;
    transition: all 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.myio-product-card:hover {
    transform: translateY(-4px);
}

/* Video Card Thumbnail (wvp-thumb) */
.myio-video-card .wvp-thumb {
    position: relative;
    aspect-ratio: 9/16;
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
    border-radius: 12px;
}

.myio-video-card .wvp-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Play button - matching category page */
.myio-video-card .wvp-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.myio-video-card .wvp-play svg {
    width: 22px;
    height: 22px;
}

.myio-video-card:hover .wvp-play {
    background: rgba(0,0,0,0.7);
}

/* PDF Card Thumbnail */
.myio-pdf-card {
    cursor: pointer;
}

.myio-pdf-card .myio-card-thumb {
    position: relative;
    aspect-ratio: 9/16;
    overflow: hidden;
    background: #f5f5f5;
    border-radius: 12px;
}

.myio-pdf-card .myio-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Card Body - matching category page exactly */
.myio-card-body {
    padding: 12px 8px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: center;
}

/* Title - Fixed 2 lines with ellipsis (matching category page exactly) */
.myio-card-title {
    font-size: 13px;
    font-weight: 400;
    color: #333;
    margin: 0 0 10px;
    height: 36px; /* Fixed height for 2 lines */
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

/* CTA Button - Matching category page exactly */
.myio-card-btn {
    display: inline-block;
    padding: 10px 16px;
    background: #FF7396;
    color: #fff !important;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    margin-top: auto;
}

.myio-card-btn:hover {
    background: #e85a7f;
    color: #fff !important;
}

.myio-card-btn:active,
.myio-card-btn:focus {
    opacity: 0.7;
    outline: none;
    box-shadow: none;
}

/* ========================================
   View All Card - Matching category page exactly
   ======================================== */
.myio-view-all-card {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    aspect-ratio: 9/16;
    background: linear-gradient(145deg, #FF7396 0%, #ff8fa8 50%, #ffa5b8 100%);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
    color: #fff !important;
}

.myio-view-all-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(255,115,150,0.35);
}

.myio-view-all-content {
    text-align: center;
    padding: 20px;
}

.myio-view-all-icon {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.myio-view-all-icon svg {
    width: 40px;
    height: 40px;
    stroke: white;
    stroke-width: 2;
    fill: none;
}

.myio-view-all-label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.myio-view-all-count {
    display: block;
    font-size: 13px;
    color: #fff;
    opacity: 0.9;
}

/* ========================================
   How It Works Section
   ======================================== */
.myio-steps {
    padding: 80px 0;
    background: var(--myio-bg-light);
}

.myio-steps__header {
    text-align: center;
    margin-bottom: 48px;
}

.myio-steps__title {
    font-size: 32px;
    font-weight: 700;
    color: var(--myio-dark);
    margin: 0 0 12px;
}

.myio-steps__subtitle {
    font-size: 18px;
    color: var(--myio-text-muted);
    margin: 0;
}

.myio-steps__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.myio-steps__item {
    background: var(--myio-white);
    padding: 32px 24px;
    border-radius: var(--myio-radius-lg);
    text-align: center;
    position: relative;
    box-shadow: var(--myio-shadow);
}

.myio-steps__number {
    position: absolute;
    top: -12px;
    left: 20px;
    width: 32px;
    height: 32px;
    background: var(--myio-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.myio-steps__icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.myio-steps__item h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--myio-dark);
    margin: 0 0 8px;
}

.myio-steps__item p {
    font-size: 14px;
    color: var(--myio-text-muted);
    margin: 0;
    line-height: 1.6;
}

/* ========================================
   Testimonials
   ======================================== */
.myio-testimonials {
    padding: 80px 0;
    background: var(--myio-white);
}

.myio-testimonials__header {
    text-align: center;
    margin-bottom: 48px;
}

.myio-testimonials__header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--myio-dark);
    margin: 0;
}

.myio-testimonials__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.myio-testimonial {
    background: var(--myio-white);
    padding: 24px;
    border-radius: var(--myio-radius-lg);
    transition: all var(--myio-transition);
    border: 1px solid var(--myio-border);
}

.myio-testimonial:hover {
    box-shadow: var(--myio-shadow-hover);
    transform: translateY(-4px);
    border-color: transparent;
}

/* Testimonial Header with Avatar */
.myio-testimonial__header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.myio-testimonial__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* Avatar when it's an actual image from CPT */
img.myio-testimonial__avatar--img {
    object-fit: cover;
}

.myio-testimonial__meta {
    flex: 1;
    min-width: 0;
}

.myio-testimonial__name {
    display: block;
    font-weight: 600;
    color: var(--myio-dark);
    font-size: 15px;
    margin-bottom: 2px;
}

.myio-testimonial__country {
    display: block;
    font-size: 13px;
    color: var(--myio-text-muted);
}

.myio-testimonial__rating {
    color: #ffc107;
    font-size: 14px;
    flex-shrink: 0;
}

.myio-testimonial__text {
    font-size: 14px;
    color: var(--myio-text);
    line-height: 1.65;
    margin: 0;
}

/* ========================================
   Features / Why Choose Us
   ======================================== */
.myio-features {
    padding: 80px 0;
    background: linear-gradient(135deg, #fff5f7 0%, #fff 50%, #f0f9ff 100%);
}

.myio-features__header {
    text-align: center;
    margin-bottom: 40px;
}

.myio-features__header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--myio-dark);
    margin: 0;
}

.myio-features__stats {
    display: flex;
    justify-content: center;
    gap: 64px;
    margin-bottom: 48px;
}

.myio-features__stat {
    text-align: center;
}

.myio-features__stat-number {
    display: block;
    font-size: 40px;
    font-weight: 700;
    color: var(--myio-primary);
    margin-bottom: 4px;
}

.myio-features__stat-label {
    font-size: 14px;
    color: var(--myio-text-muted);
}

.myio-features__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.myio-features__item {
    background: var(--myio-white);
    padding: 28px;
    border-radius: var(--myio-radius-lg);
    text-align: center;
    box-shadow: var(--myio-shadow);
    transition: all var(--myio-transition);
}

.myio-features__item:hover {
    box-shadow: var(--myio-shadow-hover);
    transform: translateY(-4px);
}

.myio-features__icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.myio-features__item h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--myio-dark);
    margin: 0 0 8px;
}

.myio-features__item p {
    font-size: 14px;
    color: var(--myio-text-muted);
    margin: 0;
}

/* ========================================
   FAQ Section
   ======================================== */
.myio-faq {
    padding: 80px 0;
    background: var(--myio-white);
}

.myio-faq__header {
    text-align: center;
    margin-bottom: 48px;
}

.myio-faq__header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--myio-dark);
    margin: 0;
}

.myio-faq__list {
    max-width: 800px;
    margin: 0 auto;
}

.myio-faq__item {
    border-bottom: 1px solid var(--myio-border);
}

.myio-faq__item:last-child {
    border-bottom: none;
}

.myio-faq__question {
    width: 100%;
    padding: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    color: var(--myio-dark);
    gap: 16px;
}

.myio-faq__question span {
    flex: 1;
}

.myio-faq__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform var(--myio-transition);
    color: var(--myio-text-muted);
}

.myio-faq__item.is-active .myio-faq__icon {
    transform: rotate(180deg);
}

.myio-faq__answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.myio-faq__item.is-active .myio-faq__answer {
    max-height: 300px;
}

.myio-faq__answer p {
    padding: 0 0 20px;
    margin: 0;
    color: var(--myio-text-muted);
    font-size: 15px;
    line-height: 1.7;
}

/* ========================================
   CTA Section
   ======================================== */
.myio-cta {
    padding: 80px 0;
    text-align: center;
}

.myio-cta--gradient {
    background: linear-gradient(135deg, var(--myio-primary) 0%, #ff9e6d 100%);
    color: white;
}

.myio-cta--pink {
    background: var(--myio-primary);
    color: white;
}

.myio-cta h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 12px;
}

.myio-cta p {
    font-size: 18px;
    opacity: 0.9;
    margin: 0 0 28px;
}

/* ========================================
   Category Grid
   ======================================== */
.myio-categories {
    padding: 80px 0;
    background: var(--myio-bg-light);
}

.myio-categories__header {
    text-align: center;
    margin-bottom: 48px;
}

.myio-categories__header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--myio-dark);
    margin: 0;
}

.myio-categories__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.myio-categories__item {
    background: var(--myio-white);
    border-radius: var(--myio-radius);
    padding: 16px;
    text-align: center;
    text-decoration: none;
    transition: all var(--myio-transition);
    box-shadow: var(--myio-shadow);
}

.myio-categories__item:hover {
    box-shadow: var(--myio-shadow-hover);
    transform: translateY(-4px);
}

.myio-categories__image {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.myio-categories__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.myio-categories__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--myio-dark);
    margin: 0 0 4px;
}

.myio-categories__count {
    font-size: 13px;
    color: var(--myio-text-muted);
}

/* ========================================
   Responsive - Matching category page breakpoints exactly
   ======================================== */
@media (max-width: 1400px) {
    .myio-carousel-item {
        width: calc(25% - 12px); /* 4 items */
    }
}

@media (max-width: 1200px) {
    .myio-carousel-item {
        width: calc(33.33% - 11px); /* 3 items */
    }
    
    .myio-categories__grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 991px) {
    .myio-carousel-item {
        width: calc(33.33% - 11px); /* 3 items */
    }
    
    .myio-hero {
        padding: 60px 0;
    }
    
    .myio-steps__grid,
    .myio-features__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .myio-testimonials__grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .myio-features__stats {
        gap: 40px;
    }
    
    .myio-categories__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    /* Mobile slider - matching category page exactly */
    .myio-carousel-item {
        width: calc(45% - 8px); /* ~2.2 items visible */
    }
    
    .myio-slider-section {
        padding: 32px 0;
    }
    
    .myio-slider-title {
        font-size: 20px;
    }
    
    /* Smaller nav arrows on mobile (match category page) */
    .myio-slider-nav {
        width: 32px;
        height: 32px;
    }
    
    .myio-slider-prev {
        left: 8px;
    }
    
    .myio-slider-next {
        right: 8px;
    }
    
    .myio-slider-nav svg {
        width: 16px;
        height: 16px;
    }
    
    /* Title smaller on mobile */
    .myio-card-title {
        font-size: 12px;
        height: 34px;
    }
    
    /* CTA smaller on mobile */
    .myio-card-btn {
        font-size: 12px;
        padding: 8px 14px;
    }
    
    /* View All icon smaller on mobile */
    .myio-view-all-icon {
        width: 50px;
        height: 50px;
    }
    
    .myio-view-all-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .myio-view-all-label {
        font-size: 15px;
    }
    
    .myio-hero {
        padding: 48px 0;
    }
    
    .myio-hero__ctas {
        flex-direction: column;
        gap: 12px;
    }
    
    .myio-hero__trust {
        flex-direction: column;
        gap: 8px;
    }
    
    .myio-steps,
    .myio-testimonials,
    .myio-features,
    .myio-faq,
    .myio-cta,
    .myio-categories {
        padding: 48px 0;
    }
    
    .myio-steps__grid,
    .myio-testimonials__grid,
    .myio-features__grid {
        grid-template-columns: 1fr;
    }
    
    .myio-features__stats {
        flex-direction: column;
        gap: 24px;
    }
    
    .myio-categories__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    h2 {
        font-size: 24px !important;
    }
}

@media (max-width: 480px) {
    .myio-container {
        padding: 0 16px;
    }
    
    .myio-carousel-item {
        flex: 0 0 calc(48% - 6px);
    }
    
    .myio-card-title {
        font-size: 13px;
        height: 34px;
        line-height: 17px;
    }
    
    .myio-card-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* ========================================
   Animations & States
   ======================================== */

/* Dragging state */
.myio-carousel.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.myio-carousel.is-dragging * {
    pointer-events: none;
}

/* Scroll reveal animations */
.will-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.will-animate.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay for carousel items */
.myio-carousel-item {
    opacity: 0;
    animation: fadeInUp 0.4s ease forwards;
}

.is-visible .myio-carousel-item:nth-child(1) { animation-delay: 0.05s; }
.is-visible .myio-carousel-item:nth-child(2) { animation-delay: 0.1s; }
.is-visible .myio-carousel-item:nth-child(3) { animation-delay: 0.15s; }
.is-visible .myio-carousel-item:nth-child(4) { animation-delay: 0.2s; }
.is-visible .myio-carousel-item:nth-child(5) { animation-delay: 0.25s; }
.is-visible .myio-carousel-item:nth-child(n+6) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure cards show immediately if no JS */
.no-js .myio-carousel-item,
.no-js .will-animate {
    opacity: 1;
    transform: none;
    animation: none;
}
