/* =========================================================
   CURVASIA EDITORIAL COMPONENTS
   Comparison Table v1.0
   ========================================================= */

/* ---------- Component ---------- */

.curvasia-comparison {
    width: 100%;
    margin: 28px 0 34px;
    font-size: 15px;
    line-height: 1.55;
}

.curvasia-comparison__caption {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.5;
    color: #6c757d;
}

.curvasia-comparison__caption strong {
    color: inherit;
}

/* ---------- Table Container ---------- */

.curvasia-comparison__inner {
    width: 100%;
    overflow: hidden;
    border: 1px solid #e4e7eb;
    border-radius: 12px;
    background: #ffffff;
}

/* ---------- Table ---------- */

.curvasia-comparison__table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    border-spacing: 0;
    table-layout: auto;
    font-size: 15px;
    line-height: 1.55;
    color: #2f3337;
}

/* ---------- Header ---------- */

.curvasia-comparison__table thead th {
    padding: 15px 16px;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    background: #67339b;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 700;
    text-align: left;
    vertical-align: middle;
}

.curvasia-comparison__table thead th:last-child {
    border-right: 0;
}

/* ---------- Body ---------- */

.curvasia-comparison__table tbody td {
    padding: 15px 16px;
    border: 0;
    border-right: 1px solid #e4e7eb;
    border-bottom: 1px solid #e4e7eb;
    background: #ffffff;
    color: #2f3337;
    text-align: left;
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: normal;
}

.curvasia-comparison__table tbody tr:nth-child(even) td {
    background: #faf9fc;
}

.curvasia-comparison__table tbody td:last-child {
    border-right: 0;
}

.curvasia-comparison__table tbody tr:last-child td {
    border-bottom: 0;
}

.curvasia-comparison__table tbody td strong {
    font-weight: 700;
    color: inherit;
}

/* ---------- Column Widths ---------- */

/* =========================================================
   FLEXIBLE DESKTOP COLUMN ARCHITECTURE
   Supports comparison tables with different column counts
   ========================================================= */

/*
 * Let the browser calculate column widths from the actual
 * content instead of forcing a fixed four-column structure.
 */
    .curvasia-comparison__table {
        table-layout: auto;
}

/*
 * Give all columns a sensible baseline.
 * Content determines the final width.
 */
    .curvasia-comparison__table th,
    .curvasia-comparison__table td {
        width: auto;
}

/*
 * Keep the first column useful as the primary identifier
 * without forcing a specific percentage.
 */
    .curvasia-comparison__table th:first-child,
    .curvasia-comparison__table td:first-child {
        min-width: 130px;
}

/*
 * Prevent unnecessarily narrow columns on larger screens.
 */
@media (min-width: 768px) {
    .curvasia-comparison__table th,
    .curvasia-comparison__table td {
        min-width: 120px;
    }
}

/* Keep store names readable */
.curvasia-comparison__table tbody td:first-child {
    overflow-wrap: normal;
    word-break: normal;
}

/* ---------- Desktop Hover ---------- */

@media (hover: hover) and (pointer: fine) {
    .curvasia-comparison__table tbody tr:hover td {
        background: #f5f1fa;
    }
}

/* =========================================================
   CURVASIA COMPARISON TABLE v1.0
   Wide Table Desktop Support
   5+ columns = intentional horizontal scroll
   ========================================================= */

.curvasia-comparison__inner {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {

    /* Standard tables remain normal */
    .curvasia-comparison__table {
        width: 100%;
        table-layout: auto;
    }

    /* 5-column comparison tables */
    .curvasia-comparison__table:has(th:nth-child(5)) {
        width: max-content;
        min-width: 1100px;
    }

    /* 6+ column comparison tables */
    .curvasia-comparison__table:has(th:nth-child(6)) {
        width: max-content;
        min-width: 1250px;
    }

    /* Sensible minimum width for wide-table cells */
    .curvasia-comparison__table:has(th:nth-child(5)) th,
    .curvasia-comparison__table:has(th:nth-child(5)) td {
        min-width: 150px;
        padding-left: 20px;
        padding-right: 20px;
    }

    /* First column */
    .curvasia-comparison__table:has(th:nth-child(5)) th:first-child,
    .curvasia-comparison__table:has(th:nth-child(5)) td:first-child {
        min-width: 180px;
    }
}

/* =========================================================
   SNGINE NIGHT MODE
   ========================================================= */

body.night-mode .curvasia-comparison__caption {
    color: var(--body-color-dark, #c1d4e3);
}

body.night-mode .curvasia-comparison__inner {
    border-color: var(--card-dark-divider, #2e3f4d);
    background: var(--card-dark-color, #262d34);
}

body.night-mode .curvasia-comparison__table {
    color: var(--body-color-dark, #c1d4e3);
}

body.night-mode .curvasia-comparison__table tbody td {
    background: var(--card-dark-color, #262d34);
    color: var(--body-color-dark, #c1d4e3);
    border-color: var(--card-dark-divider, #2e3f4d);
}

body.night-mode .curvasia-comparison__table tbody tr:nth-child(even) td {
    background: var(--card-dark-hover, #2b3843);
}

@media (hover: hover) and (pointer: fine) {
    body.night-mode .curvasia-comparison__table tbody tr:hover td {
        background: var(--card-dark-input, #1e252b);
    }
}

/* =========================================================
   CURVASIA COMPARISON TABLE v1.0
   Mobile Card Layout
   ========================================================= */

/* Mobile labels are hidden on desktop */
.curvasia-comparison__mobile-label {
    display: none;
}

@media (max-width: 767.98px) {

    .curvasia-comparison {
        width: 100%;
        margin: 24px 0;
    }

    .curvasia-comparison__caption {
        margin: 0 0 16px;
        font-size: 16px;
        line-height: 1.6;
    }

    .curvasia-comparison__inner {
        width: 100%;
        overflow: visible;
    }

    .curvasia-comparison__table {
        display: block;
        width: 100%;
        border: 0;
        background: transparent;
    }

    /* Desktop headings aren't needed in card layout */
    .curvasia-comparison__table thead {
        display: none;
    }

    .curvasia-comparison__table tbody {
        display: block;
        width: 100%;
    }

    /* Each row becomes a card */
    .curvasia-comparison__table tbody tr {
        display: block;
        width: 100%;
        margin: 0 0 18px;
        overflow: hidden;
        border: 1px solid rgba(127, 127, 127, 0.22);
        border-radius: 16px;
        background: transparent;
    }

    /* Every cell becomes a stacked section */
    .curvasia-comparison__table tbody td {
        display: block;
        width: 100% !important;
        max-width: none !important;
        padding: 16px 18px;
        border: 0;
        border-bottom: 1px solid rgba(127, 127, 127, 0.18);
        text-align: left;
        font-size: 16px;
        line-height: 1.55;
        overflow-wrap: break-word;
        word-break: normal;
        white-space: normal;
    }

    .curvasia-comparison__table tbody td:last-child {
        border-bottom: 0;
    }

    /* First cell = item/product/store name */
    .curvasia-comparison__table tbody td:first-child {
        padding: 18px;
        font-size: 18px;
        font-weight: 700;
        background: rgba(103, 51, 155, 0.06);
    }

    /* Dynamic label embedded directly in HTML */
    .curvasia-comparison__mobile-label {
        display: block;
        margin: 0 0 5px;
        font-size: 12px;
        line-height: 1.35;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #67339b;
    }

    /* First column is already self-explanatory */
    .curvasia-comparison__table tbody td:first-child
    .curvasia-comparison__mobile-label {
        display: none;
    }
}

/* Dark mode */
[data-bs-theme="dark"] .curvasia-comparison__table tbody tr,
body.dark-mode .curvasia-comparison__table tbody tr {
    border-color: rgba(255, 255, 255, 0.12);
}

[data-bs-theme="dark"] .curvasia-comparison__table tbody td,
body.dark-mode .curvasia-comparison__table tbody td {
    border-bottom-color: rgba(255, 255, 255, 0.10);
}

[data-bs-theme="dark"] .curvasia-comparison__table tbody td:first-child,
body.dark-mode .curvasia-comparison__table tbody td:first-child {
    background: rgba(145, 82, 210, 0.10);
}

[data-bs-theme="dark"] .curvasia-comparison__mobile-label,
body.dark-mode .curvasia-comparison__mobile-label {
    color: #c69af1;
}

/* =========================================================
   Curvasia Comparison Table v1.0
   Final Mobile Spacing Polish
   ========================================================= */

@media (max-width: 767px) {

    /* Slightly tighter spacing between comparison cards */
    .curvasia-comparison__table tbody tr {
        margin-bottom: 18px;
    }

    /* Store / primary item heading */
    .curvasia-comparison__table tbody td:first-child {
        padding: 22px 20px;
    }

    /* Comparison fields */
    .curvasia-comparison__table tbody td:not(:first-child) {
        padding: 18px 20px 20px;
    }

    /* Mobile field labels */
    .curvasia-comparison__mobile-label {
        margin-bottom: 8px;
        line-height: 1.25;
    }

    /* Keep content comfortably readable without excessive height */
    .curvasia-comparison__table td {
        line-height: 1.55;
    }

    /* Slightly tighter caption-to-table spacing */
    .curvasia-comparison__caption {
        margin-bottom: 18px;
    }
}