/**
 * Etinion Subscription Package — etsp-subscription.css
 * Widget: Etinion Subscription Package
 * Prefix: etsp-
 */

/* ══════════════════════════════════════════════════════
   1. ROOT & LAYOUT
   ══════════════════════════════════════════════════════ */

.etsp-subscription {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

/* ── Grid Mode ── */
.etsp-grid {
    display: grid;
    grid-template-columns: repeat(var(--etsp-cols-d, 3), 1fr);
    /* Prevent box-shadow clipping on all edges */
    padding: 10px 16px;
    margin: -10px -16px;
}

@media (max-width: 1024px) {
    .etsp-grid {
        grid-template-columns: repeat(var(--etsp-cols-t, 2), 1fr);
    }
}

@media (max-width: 767px) {
    .etsp-grid {
        grid-template-columns: repeat(var(--etsp-cols-m, 1), 1fr);
    }
}

/* ── Horizontal Scroll (Grid mode) ── */

/* Shared hscroll base: flex row, scroll, vertical-only shadow breathing */
.etsp-hscroll-desktop .etsp-grid,
.etsp-hscroll-mobile .etsp-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Only vertical padding/margin to avoid clipping top/bottom box-shadow.
       NO horizontal padding — keeps card widths exactly matching visible area. */
    padding: 12px 0;
    margin: -12px 0;
}

/* Cards inside hscroll: auto height so align-items:stretch equalises */
.etsp-hscroll-desktop .etsp-grid > .etsp-card,
.etsp-hscroll-mobile .etsp-grid > .etsp-card {
    height: auto;
}

/* Desktop horizontal scroll */
@media (min-width: 1025px) {
    .etsp-hscroll-desktop .etsp-grid {
        gap: var(--etsp-gap-d, 24px);
        /* Hide scrollbar by default, show on hover */
        scrollbar-width: thin;
        scrollbar-color: transparent transparent;
    }

    .etsp-hscroll-desktop .etsp-grid:hover {
        scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
    }

    .etsp-hscroll-desktop .etsp-grid::-webkit-scrollbar {
        height: 6px;
    }

    .etsp-hscroll-desktop .etsp-grid::-webkit-scrollbar-track {
        background: transparent;
        border-radius: 3px;
    }

    .etsp-hscroll-desktop .etsp-grid::-webkit-scrollbar-thumb {
        background: transparent;
        border-radius: 3px;
        transition: background 0.2s ease;
    }

    .etsp-hscroll-desktop .etsp-grid:hover::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.5);
    }

    .etsp-hscroll-desktop .etsp-grid::-webkit-scrollbar-thumb:hover {
        background: rgba(148, 163, 184, 0.8);
    }

    .etsp-hscroll-desktop .etsp-grid > .etsp-card {
        flex: 0 0 var(--etsp-card-w-d, 32%);
        min-width: var(--etsp-card-w-d, 32%);
        scroll-snap-align: start;
    }
}

/* Tablet horizontal scroll */
@media (min-width: 768px) and (max-width: 1024px) {
    .etsp-hscroll-mobile .etsp-grid {
        gap: var(--etsp-gap-t, 20px);
        scrollbar-width: thin;
        scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
    }

    .etsp-hscroll-mobile .etsp-grid::-webkit-scrollbar {
        height: 4px;
    }

    .etsp-hscroll-mobile .etsp-grid::-webkit-scrollbar-track {
        background: transparent;
    }

    .etsp-hscroll-mobile .etsp-grid::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.3);
        border-radius: 2px;
    }

    .etsp-hscroll-mobile .etsp-grid > .etsp-card {
        flex: 0 0 var(--etsp-card-w-t, 48%);
        min-width: var(--etsp-card-w-t, 48%);
        scroll-snap-align: start;
    }
}

/* Mobile horizontal scroll */
@media (max-width: 767px) {
    .etsp-hscroll-mobile .etsp-grid {
        gap: var(--etsp-gap-m, 16px);
        scrollbar-width: none;
    }

    .etsp-hscroll-mobile .etsp-grid::-webkit-scrollbar {
        display: none;
    }

    .etsp-hscroll-mobile .etsp-grid > .etsp-card {
        flex: 0 0 var(--etsp-card-w-m, 100%);
        min-width: var(--etsp-card-w-m, 100%);
        scroll-snap-align: start;
    }
}

/* ══════════════════════════════════════════════════════
   2. VIEWPORT — CAROUSEL
   ══════════════════════════════════════════════════════ */

.etsp-viewport {
    overflow: hidden;
    position: relative;
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
    margin-left: -16px;
    margin-right: -16px;
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none;
    user-select: none;
}

.etsp-shadow-frame {
    padding: 10px 0;
    box-sizing: border-box;
    width: 100%;
}

.etsp-track {
    display: flex;
    align-items: stretch;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    gap: var(--etsp-gap, 24px);
}

.etsp-subscription.is-dragging .etsp-track {
    transition: none !important;
}

.etsp-track a {
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: auto;
}

.etsp-track a img {
    pointer-events: none;
}

.etsp-slide {
    flex: 0 0 auto;
    display: flex;
    height: auto;
    min-width: 0;
    width: var(--etsp-slide-w, 32%);
    max-width: var(--etsp-slide-w, 32%);
}

.etsp-slide > * {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

/* ══════════════════════════════════════════════════════
   3. CARD
   ══════════════════════════════════════════════════════ */

.etsp-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
    box-sizing: border-box;
    border: 2px solid #eef1f6;
}

/* Featured */
.etsp-card.is-featured {
    border-color: #3b82f6;
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15);
}

/* ══════════════════════════════════════════════════════
   4. BADGE
   ══════════════════════════════════════════════════════ */

.etsp-badge {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    background: #3b82f6;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 16px;
    border-radius: 0 0 8px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ══════════════════════════════════════════════════════
   5. NAME
   ══════════════════════════════════════════════════════ */

.etsp-name {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 16px 0 4px;
    padding: 0;
    line-height: 1.3;
}

/* Package Icon */
.etsp-pkg-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    color: #3b82f6;
}

.etsp-pkg-icon svg,
.etsp-pkg-icon img {
    width: 40px;
    height: 40px;
}

.etsp-pkg-icon img {
    object-fit: contain;
    border-radius: 8px;
}

/* Icon position: inline (beside title) */
.etsp-name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px 0 4px;
}

.etsp-name-row .etsp-pkg-icon {
    margin-bottom: 0;
}

.etsp-name-row .etsp-name {
    margin: 0;
}

/* ══════════════════════════════════════════════════════
   6. DURATION
   ══════════════════════════════════════════════════════ */

.etsp-duration {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
}

/* ══════════════════════════════════════════════════════
   7. PRICE
   ══════════════════════════════════════════════════════ */

.etsp-price {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
}

.etsp-price-current {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.2;
}

.etsp-price-old {
    font-size: 16px;
    color: #94a3b8;
    text-decoration: line-through;
}

/* ══════════════════════════════════════════════════════
   8. FEATURES
   ══════════════════════════════════════════════════════ */

.etsp-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    width: 100%;
    text-align: left;
}

.etsp-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
    border-bottom: 1px solid #f1f5f9;
}

.etsp-feature-item:last-child {
    border-bottom: none;
}

.etsp-feature-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: #22c55e;
    margin-top: 2px;
}

.etsp-feature-icon svg {
    width: 16px;
    height: 16px;
}

/* ══════════════════════════════════════════════════════
   9. CATEGORIES
   ══════════════════════════════════════════════════════ */

.etsp-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 20px;
}

.etsp-cat-tag {
    font-size: 12px;
    padding: 3px 10px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 20px;
}

/* ══════════════════════════════════════════════════════
   10. CTA BUTTON
   ══════════════════════════════════════════════════════ */

.etsp-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 24px;
    background: #3b82f6;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-top: auto;
}

.etsp-cta:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.etsp-card.is-featured .etsp-cta {
    background: #1d4ed8;
}

.etsp-card.is-featured .etsp-cta:hover {
    background: #1e40af;
}

/* ══════════════════════════════════════════════════════
   11. NAVIGATION
   ══════════════════════════════════════════════════════ */

.etsp-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.etsp-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    color: #334155;
    transition: all 0.2s ease;
    flex: 0 0 auto;
}

.etsp-arrow:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.etsp-arrow svg {
    width: 18px;
    height: 18px;
}

.etsp-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
}

.etsp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.etsp-dot.is-active {
    background: #3b82f6;
    width: 24px;
    border-radius: 4px;
}

/* ══════════════════════════════════════════════════════
   12. EMPTY STATE
   ══════════════════════════════════════════════════════ */

.etsp-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

/* ══════════════════════════════════════════════════════
   12. DRAG STATE
   ══════════════════════════════════════════════════════ */

.etsp-subscription.is-dragging .etsp-track {
    transition: none !important;
}

.etsp-subscription.is-dragging .etsp-card {
    pointer-events: none;
    user-select: none;
}

.etsp-subscription.is-dragging,
.etsp-subscription.is-dragging .etsp-viewport,
.etsp-subscription.is-dragging .etsp-card,
.etsp-subscription.is-dragging .etsp-card a {
    cursor: grabbing !important;
}

/* ══════════════════════════════════════════════════════
   13. ELEMENTOR EDITOR
   ══════════════════════════════════════════════════════ */

.elementor-editor-active .etsp-subscription .etsp-card a {
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════
   14. RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .etsp-card {
        padding: 24px 20px;
    }

    .etsp-price-current {
        font-size: 24px;
    }

    .etsp-name {
        font-size: 18px;
    }

    .etsp-arrow {
        width: 36px;
        height: 36px;
    }

    .etsp-viewport {
        padding-left: 0;
        padding-right: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .etsp-shadow-frame {
        padding: 6px;
    }
}
