/**
 * Subscription Plans Grid Styles
 *
 * Provides styling for all 4 subscription plan display skins:
 * grid, list, minimal, comparison.
 *
 * Uses CSS custom properties for easy theming via shortcode
 * attributes, Elementor controls, and Gutenberg block settings.
 *
 * Per-plan colors (membership_color, act_btn_color) are applied
 * as inline styles on individual cards by the renderer, since each
 * plan can have distinct brand colours from the API.
 *
 * @package Tvstartup_OTT_Platform
 * @since   1.11.0
 */

/* ==========================================================================
   CSS Custom Properties (Defaults)
   ========================================================================== */

.ts-ott-plans-wrapper {
    --ts-ott-plan-font-family:        inherit;
    --ts-ott-plan-title-color:        #1a1a2e;
    --ts-ott-plan-desc-color:         #6b7280;
    --ts-ott-plan-bg-color:           #ffffff;
    --ts-ott-plan-accent-color:       #125fab;
    --ts-ott-plan-border-radius:      12px;
    --ts-ott-plan-card-spacing:       1.5rem;
    --ts-ott-plan-columns:            3;
    --ts-ott-plan-membership-color:   #125fab;
    --ts-ott-plan-transition:         0.22s ease;

    font-family: var(--ts-ott-plan-font-family);
    box-sizing: border-box;
    width: 100%;
}

.ts-ott-plans-wrapper *,
.ts-ott-plans-wrapper *::before,
.ts-ott-plans-wrapper *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.ts-ott-plans--empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--ts-ott-plan-desc-color);
    font-size: 1rem;
}

/* ==========================================================================
   Grid Wrapper (shared by grid & minimal skins)
   ========================================================================== */

.ts-ott-plans__grid {
    display: grid;
    grid-template-columns: repeat( var(--ts-ott-plan-columns, 3), 1fr );
    gap: var(--ts-ott-plan-card-spacing, 1.5rem);
    width: 100%;
}

/* ==========================================================================
   Plan Card — Base Styles (all skins)
   ========================================================================== */

.ts-ott-plan-card {
    background-color: var(--ts-ott-plan-bg-color, #ffffff);
    border-radius: var(--ts-ott-plan-border-radius, 12px);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--ts-ott-plan-transition), transform var(--ts-ott-plan-transition);
    position: relative;
}

.ts-ott-plan-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* --- Card Header (colored bar) --- */
.ts-ott-plan-card__header {
    background-color: var(--ts-ott-plan-membership-color, var(--ts-ott-plan-accent-color, #125fab));
    padding: 1.25rem 1.5rem 1rem;
    position: relative;
}

.ts-ott-plan-card__title {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    font-family: var(--ts-ott-plan-font-family, inherit);
}

.ts-ott-plan-card__free-badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2em 0.6em;
    border-radius: 999px;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* --- Card Body --- */
.ts-ott-plan-card__body {
    padding: 1.25rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* --- Pricing --- */
.ts-ott-plan-card__pricing {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}

.ts-ott-plan-card__price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--ts-ott-plan-title-color, #1a1a2e);
    line-height: 1;
}

.ts-ott-plan-card__price--free {
    font-size: 1.4rem;
    color: #16a34a;
}

.ts-ott-plan-card__price--discounted {
    color: #16a34a;
}

.ts-ott-plan-card__price-original {
    font-size: 1rem;
    font-weight: 500;
    color: var(--ts-ott-plan-desc-color, #6b7280);
    text-decoration: line-through;
    text-decoration-color: #ef4444;
}

.ts-ott-plan-card__period {
    font-size: 0.85rem;
    color: var(--ts-ott-plan-desc-color, #6b7280);
    font-weight: 400;
}

/* --- Discount Expiry --- */
.ts-ott-plan-card__discount-expiry {
    font-size: 0.78rem;
    color: #b45309;
    background-color: #fef3c7;
    border-radius: 4px;
    padding: 0.25rem 0.6rem;
    margin: 0;
    display: inline-block;
}

/* --- Trial Badge --- */
.ts-ott-plan-card__trial {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0369a1;
    background-color: #e0f2fe;
    border-radius: 999px;
    padding: 0.25em 0.75em;
    margin: 0;
}

/* --- Description --- */
.ts-ott-plan-card__desc {
    font-size: 0.9rem;
    color: var(--ts-ott-plan-desc-color, #6b7280);
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

/* --- Card Footer / CTA --- */
.ts-ott-plan-card__footer {
    padding: 1rem 1.5rem 1.5rem;
}

.ts-ott-plan-card__cta-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background-color: var(--ts-ott-plan-accent-color, #125fab);
    border: 2px solid var(--ts-ott-plan-accent-color, #125fab);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: calc( var(--ts-ott-plan-border-radius, 12px) / 1.5 );
    cursor: pointer;
    text-align: center;
    transition: opacity var(--ts-ott-plan-transition), filter var(--ts-ott-plan-transition);
    font-family: var(--ts-ott-plan-font-family, inherit);
    line-height: 1.2;
}

.ts-ott-plan-card__cta-btn:hover {
    opacity: 0.88;
    filter: brightness(1.08);
}

.ts-ott-plan-card__cta-btn:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
}

/* ==========================================================================
   Skin: Grid (default)
   ========================================================================== */

.ts-ott-plans--grid .ts-ott-plans__grid {
    /* inherits grid vars from wrapper */
}

/* ==========================================================================
   Skin: List
   ========================================================================== */

.ts-ott-plans--list .ts-ott-plans__grid {
    display: flex;
    flex-direction: column;
    gap: var(--ts-ott-plan-card-spacing, 1.5rem);
    grid-template-columns: none;
}

.ts-ott-plans--list .ts-ott-plan-card {
    flex-direction: row;
    align-items: stretch;
    border-radius: var(--ts-ott-plan-border-radius, 12px);
}

.ts-ott-plans--list .ts-ott-plan-card__header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 200px;
    max-width: 220px;
    padding: 1.25rem 1.5rem;
    flex-shrink: 0;
}

.ts-ott-plans--list .ts-ott-plan-card__body {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.ts-ott-plans--list .ts-ott-plan-card__pricing {
    margin-bottom: 0;
    flex-shrink: 0;
}

.ts-ott-plans--list .ts-ott-plan-card__desc {
    flex: 1;
    min-width: 120px;
}

.ts-ott-plans--list .ts-ott-plan-card__footer {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    min-width: 160px;
    flex-shrink: 0;
}

.ts-ott-plans--list .ts-ott-plan-card__cta-btn {
    white-space: nowrap;
}

/* ==========================================================================
   Skin: Minimal
   ========================================================================== */

.ts-ott-plans--minimal .ts-ott-plan-card {
    border: 1px solid #e5e7eb;
    box-shadow: none;
}

.ts-ott-plans--minimal .ts-ott-plan-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.ts-ott-plans--minimal .ts-ott-plan-card__header {
    background-color: transparent;
    border-bottom: 3px solid var(--ts-ott-plan-membership-color, var(--ts-ott-plan-accent-color, #125fab));
    padding: 1rem 1.25rem 0.85rem;
}

.ts-ott-plans--minimal .ts-ott-plan-card__title {
    color: var(--ts-ott-plan-title-color, #1a1a2e);
    font-size: 1rem;
    font-weight: 600;
}

.ts-ott-plans--minimal .ts-ott-plan-card__free-badge {
    background-color: var(--ts-ott-plan-membership-color, var(--ts-ott-plan-accent-color, #125fab));
    color: #ffffff;
}

.ts-ott-plans--minimal .ts-ott-plan-card__price {
    font-size: 1.5rem;
}

.ts-ott-plans--minimal .ts-ott-plan-card__footer {
    padding-top: 0.75rem;
}

.ts-ott-plans--minimal .ts-ott-plan-card__cta-btn {
    background-color: transparent;
    color: var(--ts-ott-plan-accent-color, #125fab);
    border-color: currentColor;
}

.ts-ott-plans--minimal .ts-ott-plan-card__cta-btn:hover {
    background-color: var(--ts-ott-plan-accent-color, #125fab);
    color: #ffffff;
    opacity: 1;
    filter: none;
}

/* ==========================================================================
   Skin: Comparison Table
   ========================================================================== */

.ts-ott-plans__comparison-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ts-ott-plans__comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--ts-ott-plan-font-family, inherit);
    background-color: var(--ts-ott-plan-bg-color, #ffffff);
    border-radius: var(--ts-ott-plan-border-radius, 12px);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    min-width: 480px;
}

.ts-ott-plans__comparison-table thead th {
    padding: 1.1rem 1.25rem 0.9rem;
    text-align: center;
    background-color: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    vertical-align: bottom;
}

.ts-ott-cmp-table__feature-col {
    width: 160px;
    min-width: 120px;
    text-align: left !important;
    background-color: #f3f4f6 !important;
}

.ts-ott-cmp-table__plan-col {
    border-top: 4px solid var(--ts-ott-plan-accent-color, #125fab);
}

.ts-ott-cmp-table__plan-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ts-ott-plan-title-color, #1a1a2e);
    margin: 0;
    line-height: 1.3;
}

.ts-ott-cmp-table__row th,
.ts-ott-cmp-table__row td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
    vertical-align: middle;
    text-align: center;
}

.ts-ott-cmp-table__feature-label {
    text-align: left !important;
    font-weight: 600;
    color: var(--ts-ott-plan-title-color, #1a1a2e);
    background-color: #f9fafb;
    white-space: nowrap;
}

.ts-ott-cmp-table__row--price td,
.ts-ott-cmp-table__row--price th {
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
    background-color: #f9fafb;
}

.ts-ott-cmp-price__regular,
.ts-ott-cmp-price__discounted {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ts-ott-plan-title-color, #1a1a2e);
}

.ts-ott-cmp-price__discounted {
    color: #16a34a;
}

.ts-ott-cmp-price__original {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ts-ott-plan-desc-color, #6b7280);
    text-decoration: line-through;
    text-decoration-color: #ef4444;
    margin-right: 0.25rem;
}

.ts-ott-cmp-price__free {
    font-size: 1.1rem;
    font-weight: 700;
    color: #16a34a;
}

.ts-ott-cmp-table__cell--desc {
    text-align: left;
    color: var(--ts-ott-plan-desc-color, #6b7280);
    max-width: 240px;
}

.ts-ott-cmp-table__row--cta td,
.ts-ott-cmp-table__row--cta th {
    padding: 1rem 1.25rem 1.25rem;
    border-bottom: none;
    background-color: #f9fafb;
}

.ts-ott-cmp-table__cell--cta .ts-ott-plan-card__cta-btn {
    width: auto;
    white-space: nowrap;
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media ( max-width: 1024px ) {
    .ts-ott-plans--grid .ts-ott-plans__grid,
    .ts-ott-plans--minimal .ts-ott-plans__grid {
        grid-template-columns: repeat( min( var(--ts-ott-plan-columns, 3), 2 ), 1fr );
    }
}

@media ( max-width: 640px ) {
    .ts-ott-plans--grid .ts-ott-plans__grid,
    .ts-ott-plans--minimal .ts-ott-plans__grid {
        grid-template-columns: 1fr;
    }

    .ts-ott-plans--list .ts-ott-plan-card {
        flex-direction: column;
    }

    .ts-ott-plans--list .ts-ott-plan-card__header {
        max-width: none;
        min-width: 0;
    }

    .ts-ott-plans--list .ts-ott-plan-card__body {
        flex-direction: column;
        align-items: flex-start;
    }

    .ts-ott-plans--list .ts-ott-plan-card__footer {
        min-width: 0;
    }

    .ts-ott-plans__comparison-table {
        font-size: 0.85rem;
    }

    .ts-ott-cmp-table__feature-col {
        width: 100px;
        min-width: 100px;
    }

    .ts-ott-cmp-table__row th,
    .ts-ott-cmp-table__row td {
        padding: 0.6rem 0.75rem;
    }
}
