/**
 * Elementor Pricing Tables - Frontend Styles with Dark Mode Support
 * Version: 1.1.0
 */

/* ======================================
   CSS Custom Properties - Light Mode (Default)
   Matches irlcommunityos.com color palette
   ====================================== */
.ept-pricing-comparison {
    /* General - Light beige/warm tones */
    --ept-bg-color: #ffffff;
    --ept-text-color: #212529;
    --ept-text-secondary: #6c757d;
    --ept-border-color: #e9ecef;
    --ept-row-hover: #f8f9fa;

    /* Plan Header */
    --ept-plan-name-color: #212529;
    --ept-price-color: #000000;
    --ept-header-bg: #ffffff;

    /* Category */
    --ept-category-text: #212529;
    --ept-category-bg: #f6f6f6;
    --ept-category-border: #000000;

    /* Features */
    --ept-feature-name-color: #212529;
    --ept-feature-desc-color: #6c757d;
    --ept-feature-value-color: #495057;

    /* Icons */
    --ept-checkmark-color: #198754;
    --ept-xmark-color: #adb5bd;

    /* Highlighted */
    --ept-badge-bg: #000000;
    --ept-badge-text: #ffffff;
    --ept-highlight-bg: #f5eee9;

    /* Button */
    --ept-btn-text: #ffffff;
    --ept-btn-bg: #000000;
    --ept-btn-hover-text: #ffffff;
    --ept-btn-hover-bg: #333333;

    /* Toggle */
    --ept-toggle-bg: #dee2e6;
    --ept-toggle-active: #000000;
    --ept-toggle-label: #6c757d;
    --ept-toggle-label-active: #000000;

    /* Tooltip */
    --ept-tooltip-bg: #212529;
    --ept-tooltip-text: #ffffff;

    /* Layout */
    --ept-feature-col-min: 190px;
    --ept-feature-col-max: 280px;
    --ept-plan-col-min: 160px;
    --ept-plan-count: 3;
    --ept-grid-template: minmax(var(--ept-feature-col-min), var(--ept-feature-col-max)) repeat(var(--ept-plan-count), minmax(var(--ept-plan-col-min), 1fr));
    --ept-table-radius: 18px;
    --ept-table-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --ept-header-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);

    /* Dark Mode Defaults (will be overridden by media query or inline styles) */
    --ept-dark-bg-color: #1a1a2e;
    --ept-dark-text-color: #f8f9fa;
    --ept-dark-text-secondary: #adb5bd;
    --ept-dark-border-color: #343a40;
    --ept-dark-row-hover: #2d2d44;
    --ept-dark-plan-name-color: #f8f9fa;
    --ept-dark-price-color: #ffffff;
    --ept-dark-header-bg: #16162a;
    --ept-dark-category-text: #f8f9fa;
    --ept-dark-category-bg: #2d2d44;
    --ept-dark-category-border: #6c757d;
    --ept-dark-feature-name-color: #f8f9fa;
    --ept-dark-feature-desc-color: #adb5bd;
    --ept-dark-feature-value-color: #dee2e6;
    --ept-dark-checkmark-color: #20c997;
    --ept-dark-xmark-color: #6c757d;
    --ept-dark-badge-bg: #ffffff;
    --ept-dark-badge-text: #000000;
    --ept-dark-highlight-bg: #2d2d44;
    --ept-dark-btn-text: #000000;
    --ept-dark-btn-bg: #ffffff;
    --ept-dark-btn-hover-text: #000000;
    --ept-dark-btn-hover-bg: #e9ecef;
    --ept-dark-toggle-bg: #495057;
    --ept-dark-toggle-active: #ffffff;
    --ept-dark-toggle-label: #adb5bd;
    --ept-dark-toggle-label-active: #ffffff;
    --ept-dark-tooltip-bg: #f8f9fa;
    --ept-dark-tooltip-text: #212529;

    /* Transition */
    --ept-transition: 0.2s ease;
}

/* ======================================
   Main Container
   ====================================== */
.ept-pricing-comparison {
    width: 100%;
    font-family: inherit;
    position: relative;
    background-color: var(--ept-bg-color);
    color: var(--ept-text-color);
    /* Allow overflow for tooltips and badges */
    overflow: visible;
}

.ept-pricing-comparison,
.ept-pricing-comparison * {
    box-sizing: border-box;
}

/* Ensure Elementor widget container allows overflow */
.elementor-widget-ept_pricing_comparison,
.elementor-widget-ept_pricing_comparison .elementor-widget-container {
    overflow: visible !important;
}

/* Ensure parent Elementor containers allow overflow for badge visibility */
.elementor-section:has(.ept-pricing-comparison),
.elementor-column:has(.ept-pricing-comparison),
.elementor-widget-wrap:has(.ept-pricing-comparison),
.elementor-element:has(.ept-pricing-comparison) {
    overflow: visible !important;
}

/* ======================================
   Price Toggle
   ====================================== */
.ept-price-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ept-toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ept-toggle-label);
    transition: color var(--ept-transition);
}

.ept-toggle-label.active {
    color: var(--ept-toggle-label-active);
    font-weight: 600;
}

.ept-toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.ept-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ept-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--ept-toggle-bg);
    transition: var(--ept-transition);
    border-radius: 28px;
}

.ept-toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--ept-transition);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.ept-toggle-input:checked + .ept-toggle-slider {
    background-color: var(--ept-toggle-active);
}

.ept-toggle-input:checked + .ept-toggle-slider::before {
    transform: translateX(24px);
}

.ept-toggle-input:focus + .ept-toggle-slider {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ======================================
   Controls (Expand/Collapse All)
   ====================================== */
.ept-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.ept-expand-all {
    background: none;
    border: 1px solid var(--ept-border-color);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ept-text-color);
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--ept-transition);
}

.ept-expand-all:hover {
    background-color: var(--ept-row-hover);
}

.ept-expand-all:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ======================================
   Table Wrapper (Horizontal Scroll)
   ====================================== */
.ept-table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    position: relative;
    padding-top: 0;
    border: 1px solid var(--ept-border-color);
    border-radius: var(--ept-table-radius);
    background-color: var(--ept-bg-color);
    box-shadow: var(--ept-table-shadow);
    scrollbar-gutter: stable;
    overscroll-behavior-x: contain;
}

.ept-table {
    display: inline-block;
    min-width: 100%;
    width: max-content;
}

.ept-table > .ept-header-row,
.ept-table > .ept-category {
    width: 100%;
}

/* Scroll shadow indicators */
.ept-table-wrapper::before,
.ept-table-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity var(--ept-transition);
    border-radius: inherit;
}

.ept-table-wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--ept-bg-color), transparent);
}

.ept-table-wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--ept-bg-color), transparent);
}

.ept-table-wrapper.scroll-left::before,
.ept-table-wrapper.scroll-right::after {
    opacity: 1;
}

/* ======================================
   Header Row (Plan Headers)
   ====================================== */
.ept-header-row {
    display: grid;
    grid-template-columns: var(--ept-grid-template);
    align-items: stretch;
    position: sticky;
    top: 12px;
    z-index: 20;
    background-color: var(--ept-header-bg);
    border-bottom: 1px solid var(--ept-border-color);
    box-shadow: var(--ept-header-shadow);
    /* Allow overflow for recommended badge */
    overflow: visible;
    /* Ensure full width on scroll */
    width: 100%;
}

.ept-feature-column {
    padding: 22px 20px;
    position: sticky;
    left: 0;
    background-color: var(--ept-header-bg);
    z-index: 21;
}

.ept-plan-column {
    padding: 26px 18px 22px;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    overflow: visible;
    min-width: 0;
    border-left: 1px solid var(--ept-border-color);
}

.ept-plan-column.ept-highlighted {
    background-color: var(--ept-highlight-bg);
    box-shadow: inset 0 0 0 1px var(--ept-border-color);
}

/* Recommended Badge */
.ept-recommended-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--ept-badge-bg);
    color: var(--ept-badge-text);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid var(--ept-border-color);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18), 0 0 0 3px var(--ept-header-bg);
    z-index: 2;
}

/* Plan Name */
.ept-plan-name {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: var(--ept-plan-name-color);
    line-height: 1.2;
}

/* Plan Price */
.ept-plan-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    line-height: 1.2;
    color: var(--ept-price-color);
}

.ept-price-prefix {
    font-size: 12px;
    color: var(--ept-text-secondary);
    display: block;
    width: 100%;
    margin-bottom: 2px;
}

.ept-price-amount {
    font-size: 30px;
    font-weight: 700;
}

.ept-price-currency {
    font-size: 16px;
    font-weight: 500;
}

.ept-price-period {
    font-size: 14px;
    color: var(--ept-text-secondary);
}

.ept-discount-badge {
    display: inline-block;
    background-color: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

/* Custom Price Text (e.g., "Coming Soon", "Contact Sales") */
.ept-custom-price-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--ept-price-color);
    text-align: center;
    line-height: 1.3;
    display: block;
}

.ept-plan-price.ept-custom-price {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CTA Button */
.ept-plan-cta {
    display: inline-block;
    background-color: var(--ept-btn-bg);
    color: var(--ept-btn-text);
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--ept-transition);
    margin-top: 8px;
}

.ept-plan-cta:hover {
    background-color: var(--ept-btn-hover-bg);
    color: var(--ept-btn-hover-text);
    text-decoration: none;
}

/* ======================================
   Category Accordion
   ====================================== */
.ept-category {
    border: none;
    margin: 0;
    overflow: visible;
    /* Ensure full width on scroll */
    width: 100%;
}

.ept-category-header {
    display: grid;
    grid-template-columns: var(--ept-grid-template);
    align-items: stretch;
    padding: 0 16px 0 0;
    background-color: var(--ept-category-bg);
    border-left: 4px solid var(--ept-category-border);
    border-top: 1px solid var(--ept-border-color);
    border-bottom: 1px solid var(--ept-border-color);
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background-color var(--ept-transition);
    width: 100%;
    min-height: 56px;
    box-sizing: border-box;
}

.ept-category-header::-webkit-details-marker {
    display: none;
}

.ept-category-header:hover {
    filter: brightness(0.95);
}

.ept-category-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--ept-category-text);
    grid-column: 1 / 2;
    min-width: 0;
    width: 100%;
    position: sticky;
    left: 0;
    z-index: 12;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    background-color: var(--ept-category-bg);
    border-right: 1px solid var(--ept-border-color);
}

.ept-toggle-icon {
    justify-self: end;
    align-self: center;
    width: 20px;
    height: 20px;
    position: relative;
    grid-column: -2 / -1;
    transition: transform var(--ept-transition);
}

.ept-toggle-icon::before,
.ept-toggle-icon::after {
    content: "";
    position: absolute;
    background-color: var(--ept-text-secondary);
    transition: transform var(--ept-transition);
}

.ept-toggle-icon::before {
    width: 12px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ept-toggle-icon::after {
    width: 2px;
    height: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.ept-category[open] .ept-toggle-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
    opacity: 0;
}

/* Category Content */
.ept-category-content {
    animation: eptSlideDown 0.3s ease-out;
    background-color: var(--ept-bg-color);
    overflow: visible;
}

@keyframes eptSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ======================================
   Feature Rows
   ====================================== */
.ept-feature-row {
    display: grid;
    grid-template-columns: var(--ept-grid-template);
    align-items: stretch;
    border-bottom: 1px solid var(--ept-border-color);
    transition: background-color var(--ept-transition);
    background-color: var(--ept-bg-color);
    overflow: visible;
    position: relative;
}

.ept-feature-row:hover {
    background-color: var(--ept-row-hover);
}

.ept-feature-row:hover .ept-feature-value {
    background-color: var(--ept-row-hover);
}

.ept-feature-row:hover .ept-feature-value.ept-highlighted {
    background-color: var(--ept-highlight-bg);
}

.ept-feature-row:last-child {
    border-bottom: none;
}

/* Feature Info (Name + Description) */
.ept-feature-info {
    padding: 16px 20px;
    position: sticky;
    left: 0;
    background-color: var(--ept-bg-color);
    z-index: 11;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    overflow: visible;
    /* Ensure tooltips can overflow */
    isolation: isolate;
    min-width: 0;
    width: 100%;
}

.ept-feature-row:hover .ept-feature-info {
    background-color: var(--ept-row-hover);
}

.ept-feature-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ept-feature-name-color);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-wrap: anywhere;
}

.ept-feature-desc {
    font-size: 13px;
    color: var(--ept-feature-desc-color);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* Tooltip */
.ept-tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid var(--ept-border-color);
    border-radius: 50%;
    background: none;
    cursor: pointer;
    position: relative;
    padding: 0;
    flex-shrink: 0;
    z-index: 10;
}

.ept-tooltip-icon {
    font-size: 11px;
    font-weight: 600;
    color: var(--ept-text-secondary);
    font-style: italic;
}

.ept-tooltip-content {
    position: absolute;
    /* Position to the right of the trigger by default to avoid left edge cut-off */
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--ept-tooltip-bg);
    color: var(--ept-tooltip-text);
    font-size: 12px;
    font-weight: 400;
    font-style: normal;
    padding: 10px 14px;
    border-radius: 6px;
    white-space: normal;
    box-sizing: border-box;
    width: max-content;
    min-width: 180px;
    max-width: 280px;
    text-align: left;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* Tooltip arrow pointing left (default - tooltip on right) */
.ept-tooltip-content::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--ept-tooltip-bg);
}

/* Fixed Tooltip (JS positioned) */
.ept-tooltip-content.fixed-tooltip {
    position: fixed;
    z-index: 10000;
    transform: none;
    margin: 0;
    left: 0;
    top: 0;
    right: auto;
    bottom: auto;
}

.ept-tooltip-content.fixed-tooltip::after {
    /* Hide arrow for fixed tooltips as dynamic positioning makes it hard to align */
    display: none;
}

.ept-tooltip-trigger:hover .ept-tooltip-content,
.ept-tooltip-trigger:focus .ept-tooltip-content,
.ept-tooltip-trigger.active .ept-tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* Tooltip always positioned to the right to avoid clipping at edges */
/* Removed: Alternative positioning above that caused cut-off issues */

/* Feature Values */
.ept-feature-value {
    padding: 16px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    background-color: var(--ept-bg-color);
    min-width: 0;
    border-left: 1px solid var(--ept-border-color);
}

.ept-feature-value.ept-highlighted {
    background-color: var(--ept-highlight-bg);
}

.ept-checkmark {
    color: var(--ept-checkmark-color);
    font-size: 18px;
    font-weight: bold;
}

.ept-xmark {
    color: var(--ept-xmark-color);
    font-size: 20px;
    font-weight: 300;
}

.ept-value-text {
    font-size: 14px;
    color: var(--ept-feature-value-color);
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
}

/* ======================================
   Dark Mode - System Preference
   ====================================== */
@media (prefers-color-scheme: dark) {
    .ept-pricing-comparison {
        /* General */
        --ept-bg-color: var(--ept-dark-bg-color);
        --ept-text-color: var(--ept-dark-text-color);
        --ept-text-secondary: var(--ept-dark-text-secondary);
        --ept-border-color: var(--ept-dark-border-color);
        --ept-row-hover: var(--ept-dark-row-hover);

        /* Plan Header */
        --ept-plan-name-color: var(--ept-dark-plan-name-color);
        --ept-price-color: var(--ept-dark-price-color);
        --ept-header-bg: var(--ept-dark-header-bg);

        /* Category */
        --ept-category-text: var(--ept-dark-category-text);
        --ept-category-bg: var(--ept-dark-category-bg);
        --ept-category-border: var(--ept-dark-category-border);

        /* Features */
        --ept-feature-name-color: var(--ept-dark-feature-name-color);
        --ept-feature-desc-color: var(--ept-dark-feature-desc-color);
        --ept-feature-value-color: var(--ept-dark-feature-value-color);

        /* Icons */
        --ept-checkmark-color: var(--ept-dark-checkmark-color);
        --ept-xmark-color: var(--ept-dark-xmark-color);

        /* Highlighted */
        --ept-badge-bg: var(--ept-dark-badge-bg);
        --ept-badge-text: var(--ept-dark-badge-text);
        --ept-highlight-bg: var(--ept-dark-highlight-bg);

        /* Button */
        --ept-btn-text: var(--ept-dark-btn-text);
        --ept-btn-bg: var(--ept-dark-btn-bg);
        --ept-btn-hover-text: var(--ept-dark-btn-hover-text);
        --ept-btn-hover-bg: var(--ept-dark-btn-hover-bg);

        /* Toggle */
        --ept-toggle-bg: var(--ept-dark-toggle-bg);
        --ept-toggle-active: var(--ept-dark-toggle-active);
        --ept-toggle-label: var(--ept-dark-toggle-label);
        --ept-toggle-label-active: var(--ept-dark-toggle-label-active);

        /* Tooltip */
        --ept-tooltip-bg: var(--ept-dark-tooltip-bg);
        --ept-tooltip-text: var(--ept-dark-tooltip-text);
    }

    /* Dark mode discount badge */
    .ept-discount-badge {
        background-color: #2d2d44;
        color: #20c997;
    }

    /* Dark mode toggle slider knob */
    .ept-toggle-slider::before {
        background-color: #1a1a2e;
    }
}

/* ======================================
   Dark Mode - Manual Override via data attribute
   Use: <div class="ept-pricing-comparison" data-theme="dark">
   ====================================== */
.ept-pricing-comparison[data-theme="dark"] {
    /* General */
    --ept-bg-color: var(--ept-dark-bg-color);
    --ept-text-color: var(--ept-dark-text-color);
    --ept-text-secondary: var(--ept-dark-text-secondary);
    --ept-border-color: var(--ept-dark-border-color);
    --ept-row-hover: var(--ept-dark-row-hover);

    /* Plan Header */
    --ept-plan-name-color: var(--ept-dark-plan-name-color);
    --ept-price-color: var(--ept-dark-price-color);
    --ept-header-bg: var(--ept-dark-header-bg);

    /* Category */
    --ept-category-text: var(--ept-dark-category-text);
    --ept-category-bg: var(--ept-dark-category-bg);
    --ept-category-border: var(--ept-dark-category-border);

    /* Features */
    --ept-feature-name-color: var(--ept-dark-feature-name-color);
    --ept-feature-desc-color: var(--ept-dark-feature-desc-color);
    --ept-feature-value-color: var(--ept-dark-feature-value-color);

    /* Icons */
    --ept-checkmark-color: var(--ept-dark-checkmark-color);
    --ept-xmark-color: var(--ept-dark-xmark-color);

    /* Highlighted */
    --ept-badge-bg: var(--ept-dark-badge-bg);
    --ept-badge-text: var(--ept-dark-badge-text);
    --ept-highlight-bg: var(--ept-dark-highlight-bg);

    /* Button */
    --ept-btn-text: var(--ept-dark-btn-text);
    --ept-btn-bg: var(--ept-dark-btn-bg);
    --ept-btn-hover-text: var(--ept-dark-btn-hover-text);
    --ept-btn-hover-bg: var(--ept-dark-btn-hover-bg);

    /* Toggle */
    --ept-toggle-bg: var(--ept-dark-toggle-bg);
    --ept-toggle-active: var(--ept-dark-toggle-active);
    --ept-toggle-label: var(--ept-dark-toggle-label);
    --ept-toggle-label-active: var(--ept-dark-toggle-label-active);

    /* Tooltip */
    --ept-tooltip-bg: var(--ept-dark-tooltip-bg);
    --ept-tooltip-text: var(--ept-dark-tooltip-text);
}

.ept-pricing-comparison[data-theme="dark"] .ept-discount-badge {
    background-color: #2d2d44;
    color: #20c997;
}

.ept-pricing-comparison[data-theme="dark"] .ept-toggle-slider::before {
    background-color: #1a1a2e;
}

/* ======================================
   Dark Mode - Theme Integration
   Supports common WordPress dark mode patterns:
   - body.dark-mode, html.dark, [data-theme="dark"]
   ====================================== */
body.dark-mode .ept-pricing-comparison,
html.dark .ept-pricing-comparison,
.dark .ept-pricing-comparison,
[data-theme="dark"] .ept-pricing-comparison {
    /* General */
    --ept-bg-color: var(--ept-dark-bg-color);
    --ept-text-color: var(--ept-dark-text-color);
    --ept-text-secondary: var(--ept-dark-text-secondary);
    --ept-border-color: var(--ept-dark-border-color);
    --ept-row-hover: var(--ept-dark-row-hover);

    /* Plan Header */
    --ept-plan-name-color: var(--ept-dark-plan-name-color);
    --ept-price-color: var(--ept-dark-price-color);
    --ept-header-bg: var(--ept-dark-header-bg);

    /* Category */
    --ept-category-text: var(--ept-dark-category-text);
    --ept-category-bg: var(--ept-dark-category-bg);
    --ept-category-border: var(--ept-dark-category-border);

    /* Features */
    --ept-feature-name-color: var(--ept-dark-feature-name-color);
    --ept-feature-desc-color: var(--ept-dark-feature-desc-color);
    --ept-feature-value-color: var(--ept-dark-feature-value-color);

    /* Icons */
    --ept-checkmark-color: var(--ept-dark-checkmark-color);
    --ept-xmark-color: var(--ept-dark-xmark-color);

    /* Highlighted */
    --ept-badge-bg: var(--ept-dark-badge-bg);
    --ept-badge-text: var(--ept-dark-badge-text);
    --ept-highlight-bg: var(--ept-dark-highlight-bg);

    /* Button */
    --ept-btn-text: var(--ept-dark-btn-text);
    --ept-btn-bg: var(--ept-dark-btn-bg);
    --ept-btn-hover-text: var(--ept-dark-btn-hover-text);
    --ept-btn-hover-bg: var(--ept-dark-btn-hover-bg);

    /* Toggle */
    --ept-toggle-bg: var(--ept-dark-toggle-bg);
    --ept-toggle-active: var(--ept-dark-toggle-active);
    --ept-toggle-label: var(--ept-dark-toggle-label);
    --ept-toggle-label-active: var(--ept-dark-toggle-label-active);

    /* Tooltip */
    --ept-tooltip-bg: var(--ept-dark-tooltip-bg);
    --ept-tooltip-text: var(--ept-dark-tooltip-text);
}

body.dark-mode .ept-pricing-comparison .ept-discount-badge,
html.dark .ept-pricing-comparison .ept-discount-badge,
.dark .ept-pricing-comparison .ept-discount-badge,
[data-theme="dark"] .ept-pricing-comparison .ept-discount-badge {
    background-color: #2d2d44;
    color: #20c997;
}

body.dark-mode .ept-pricing-comparison .ept-toggle-slider::before,
html.dark .ept-pricing-comparison .ept-toggle-slider::before,
.dark .ept-pricing-comparison .ept-toggle-slider::before,
[data-theme="dark"] .ept-pricing-comparison .ept-toggle-slider::before {
    background-color: #1a1a2e;
}

/* ======================================
   Dark Mode - Lexend Theme (uc-dark class)
   Used by irlcommunityos.com and Lexend theme
   ====================================== */
html.uc-dark .ept-pricing-comparison,
body.uc-dark .ept-pricing-comparison,
.uc-dark .ept-pricing-comparison {
    /* General */
    --ept-bg-color: var(--ept-dark-bg-color);
    --ept-text-color: var(--ept-dark-text-color);
    --ept-text-secondary: var(--ept-dark-text-secondary);
    --ept-border-color: var(--ept-dark-border-color);
    --ept-row-hover: var(--ept-dark-row-hover);

    /* Plan Header */
    --ept-plan-name-color: var(--ept-dark-plan-name-color);
    --ept-price-color: var(--ept-dark-price-color);
    --ept-header-bg: var(--ept-dark-header-bg);

    /* Category */
    --ept-category-text: var(--ept-dark-category-text);
    --ept-category-bg: var(--ept-dark-category-bg);
    --ept-category-border: var(--ept-dark-category-border);

    /* Features */
    --ept-feature-name-color: var(--ept-dark-feature-name-color);
    --ept-feature-desc-color: var(--ept-dark-feature-desc-color);
    --ept-feature-value-color: var(--ept-dark-feature-value-color);

    /* Icons */
    --ept-checkmark-color: var(--ept-dark-checkmark-color);
    --ept-xmark-color: var(--ept-dark-xmark-color);

    /* Highlighted */
    --ept-badge-bg: var(--ept-dark-badge-bg);
    --ept-badge-text: var(--ept-dark-badge-text);
    --ept-highlight-bg: var(--ept-dark-highlight-bg);

    /* Button */
    --ept-btn-text: var(--ept-dark-btn-text);
    --ept-btn-bg: var(--ept-dark-btn-bg);
    --ept-btn-hover-text: var(--ept-dark-btn-hover-text);
    --ept-btn-hover-bg: var(--ept-dark-btn-hover-bg);

    /* Toggle */
    --ept-toggle-bg: var(--ept-dark-toggle-bg);
    --ept-toggle-active: var(--ept-dark-toggle-active);
    --ept-toggle-label: var(--ept-dark-toggle-label);
    --ept-toggle-label-active: var(--ept-dark-toggle-label-active);

    /* Tooltip */
    --ept-tooltip-bg: var(--ept-dark-tooltip-bg);
    --ept-tooltip-text: var(--ept-dark-tooltip-text);
}

html.uc-dark .ept-pricing-comparison .ept-discount-badge,
body.uc-dark .ept-pricing-comparison .ept-discount-badge,
.uc-dark .ept-pricing-comparison .ept-discount-badge {
    background-color: #2d2d44;
    color: #20c997;
}

html.uc-dark .ept-pricing-comparison .ept-toggle-slider::before,
body.uc-dark .ept-pricing-comparison .ept-toggle-slider::before,
.uc-dark .ept-pricing-comparison .ept-toggle-slider::before {
    background-color: #1a1a2e;
}

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

/* Medium screens */
@media (max-width: 1024px) {
    .ept-pricing-comparison {
        --ept-feature-col-min: 170px;
        --ept-feature-col-max: 260px;
        --ept-plan-col-min: 150px;
    }

    .ept-plan-name {
        font-size: 20px;
    }

    .ept-price-amount {
        font-size: 26px;
    }
}

/* Tablet */
@media (max-width: 768px) {
    .ept-pricing-comparison {
        --ept-feature-col-min: 150px;
        --ept-feature-col-max: 220px;
        --ept-plan-col-min: 130px;
    }

    .ept-price-toggle {
        margin-bottom: 16px;
    }

    .ept-header-row {
        position: static;
        top: auto;
        box-shadow: none;
    }

    .ept-category-header {
        padding: 0 12px 0 0;
        min-height: 50px;
    }

    .ept-category-header h4 {
        font-size: 14px;
        padding: 12px 16px;
    }

    .ept-feature-info {
        padding: 12px 16px;
    }

    .ept-feature-value {
        padding: 12px 8px;
    }

    .ept-plan-column {
        padding: 20px 14px 16px;
    }

    .ept-plan-name {
        font-size: 18px;
    }

    .ept-price-amount {
        font-size: 22px;
    }

    .ept-custom-price-text {
        font-size: 16px;
    }

    .ept-plan-cta {
        padding: 8px 16px;
        font-size: 13px;
    }

    .ept-recommended-badge {
        font-size: 10px;
        padding: 3px 8px;
        top: -10px;
    }

    /* Sticky first column */
    .ept-feature-info {
        background-color: var(--ept-bg-color);
    }

    .ept-feature-row:hover .ept-feature-info {
        background-color: var(--ept-row-hover);
    }

    /* Tablet tooltip positioning - always show to the right */
    .ept-tooltip-content {
        left: calc(100% + 10px);
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        min-width: 160px;
        max-width: 240px;
    }

    .ept-tooltip-content::after {
        top: 50%;
        right: 100%;
        left: auto;
        transform: translateY(-50%);
        border: 6px solid transparent;
        border-right-color: var(--ept-tooltip-bg);
        border-top-color: transparent;
    }

}

/* Mobile */
@media (max-width: 640px) {
    .ept-pricing-comparison {
        --ept-feature-col-min: 120px;
        --ept-feature-col-max: 190px;
        --ept-plan-col-min: 110px;
    }

    .ept-controls {
        justify-content: center;
        padding: 0 16px;
        box-sizing: border-box;
    }

    .ept-expand-all {
        width: 100%;
        max-width: 100%;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .ept-category-header {
        padding: 0 10px 0 0;
        min-height: 46px;
    }

    .ept-category-header h4 {
        font-size: 13px;
        padding: 10px 12px;
    }

    .ept-feature-column {
        padding: 10px 12px;
    }

    .ept-plan-column {
        padding: 14px 10px 12px;
        gap: 8px;
    }

    .ept-plan-name {
        font-size: 14px;
    }

    .ept-price-amount {
        font-size: 18px;
    }

    .ept-custom-price-text {
        font-size: 14px;
    }

    .ept-plan-price.ept-custom-price {
        min-height: 50px;
    }

    .ept-price-currency,
    .ept-price-period {
        font-size: 12px;
    }

    .ept-plan-cta {
        padding: 6px 12px;
        font-size: 12px;
    }

    .ept-recommended-badge {
        top: -9px;
        padding: 3px 8px;
    }

    .ept-feature-info {
        padding: 10px 12px;
    }

    .ept-feature-name {
        font-size: 13px;
    }

    .ept-feature-desc {
        font-size: 11px;
    }

    .ept-feature-value {
        padding: 10px 6px;
        min-height: 50px;
    }

    .ept-value-text {
        font-size: 12px;
    }

    .ept-tooltip-content {
        /* On mobile, position tooltip to the right to avoid left edge cut-off */
        left: calc(100% + 8px);
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        width: max-content;
        min-width: 140px;
        max-width: 200px;
        font-size: 11px;
        padding: 8px 10px;
    }

    .ept-tooltip-content::after {
        top: 50%;
        right: 100%;
        left: auto;
        transform: translateY(-50%);
        border: 5px solid transparent;
        border-right-color: var(--ept-tooltip-bg);
        border-top-color: transparent;
    }

    /* Touch device support */
    .ept-tooltip-trigger {
        cursor: pointer;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .ept-toggle-label {
        font-size: 12px;
    }

    .ept-toggle-switch {
        width: 44px;
        height: 24px;
    }

    .ept-toggle-slider::before {
        height: 18px;
        width: 18px;
    }

    .ept-toggle-input:checked + .ept-toggle-slider::before {
        transform: translateX(20px);
    }
}

/* ======================================
   Print Styles
   ====================================== */
@media print {
    .ept-price-toggle,
    .ept-controls {
        display: none;
    }

    .ept-category[open] .ept-category-content,
    .ept-category .ept-category-content {
        display: block !important;
    }

    .ept-table-wrapper {
        overflow: visible;
    }

    .ept-feature-info {
        position: relative;
    }
}

/* ======================================
   Accessibility
   ====================================== */
@media (prefers-reduced-motion: reduce) {
    .ept-toggle-slider,
    .ept-toggle-slider::before,
    .ept-toggle-icon,
    .ept-toggle-icon::before,
    .ept-toggle-icon::after,
    .ept-tooltip-content,
    .ept-category-content {
        transition: none;
        animation: none;
    }
}

/* Focus states */
.ept-category-header:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.ept-plan-cta:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ept-checkmark {
        color: #006400;
    }

    .ept-xmark {
        color: #8b0000;
    }

    .ept-feature-row {
        border-color: currentColor;
    }
}

@media (prefers-color-scheme: dark) and (prefers-contrast: high) {
    .ept-checkmark {
        color: #90ee90;
    }

    .ept-xmark {
        color: #ff6b6b;
    }
}
