/* ============================================================
   EC BASE — SHARED UTILITIES & GLOBAL COMPONENTS
   v2.0 | Wymaga: ec-tokens.css
   ============================================================ */

/* ------------------------------------------------------------
   RESET / BOX-SIZING
------------------------------------------------------------ */
.ec-category-wrap,
.ec-category-wrap *,
.ec-dashboard,
.ec-dashboard *,
.ec-workflows-page,
.ec-workflows-page *,
.ec-pro-page,
.ec-pro-page * {
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   TYPOGRAPHY UTILITIES
------------------------------------------------------------ */
.ec-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: var(--ec-radius-pill);
    background: var(--ec-red-soft);
    color: var(--ec-red);
    font-size: var(--ec-font-xs);
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ec-eyebrow--blue {
    background: var(--ec-info-bg);
    color: var(--ec-info-color);
}

.ec-eyebrow--neutral {
    background: var(--ec-bg-panel);
    color: var(--ec-slate);
}

/* ------------------------------------------------------------
   SECTION HEADER
------------------------------------------------------------ */
.ec-section-kicker {
    display: inline-block;
    padding: 6px 10px;
    border-radius: var(--ec-radius-pill);
    background: var(--ec-red-soft);
    color: var(--ec-red);
    font-size: var(--ec-font-xs);
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.ec-section-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: var(--ec-black);
}

.ec-section-lead {
    max-width: 720px;
    margin: 10px 0 0;
    font-size: var(--ec-font-xl);
    line-height: 1.65;
    color: var(--ec-soft);
}

/* ------------------------------------------------------------
   BUTTONS
------------------------------------------------------------ */

/* Primary — czarny */
.ec-btn,
.ec-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--ec-radius-pill);
    background: var(--ec-black-mid);
    color: #fff;
    font-size: var(--ec-font-lg);
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s ease, transform .15s ease, box-shadow .15s ease;
}

.ec-btn:hover,
.ec-btn-primary:hover {
    background: var(--ec-dark);
    transform: translateY(-1px);
    color: #fff;
}

/* Primary — czerwony (akcja CTA) */
.ec-btn--red {
    background: var(--ec-red);
    border-radius: var(--ec-radius-lg);
}

.ec-btn--red:hover {
    background: var(--ec-red-dark);
}

/* Secondary — outline */
.ec-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--ec-radius-lg);
    background: var(--ec-bg-subtle);
    border: 1px solid var(--ec-border-strong);
    color: var(--ec-slate);
    font-size: var(--ec-font-lg);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s ease;
}

.ec-btn-secondary:hover {
    background: var(--ec-bg-panel);
    border-color: var(--ec-black-mid);
    color: var(--ec-black-mid);
}

/* Ghost — na ciemnym tle */
.ec-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--ec-radius-lg);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    font-size: var(--ec-font-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
}

.ec-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.55);
}

/* Stary alias .ec-btn-black (category page) */
.ec-btn-black {
    display: inline-flex !important;
    align-items: center !important;
    gap: 12px !important;
    background-color: var(--ec-black-mid) !important;
    color: #ffffff !important;
    padding: 14px 28px !important;
    border-radius: var(--ec-radius-lg) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: var(--ec-font-xl) !important;
    border: none !important;
    transition: all .2s ease !important;
}

.ec-btn-black:hover {
    background: var(--ec-dark) !important;
    transform: translateY(-2px);
    box-shadow: var(--ec-shadow-sm) !important;
    color: #ffffff !important;
}

/* ------------------------------------------------------------
   STATUS BADGES / PILLS
------------------------------------------------------------ */
.ec-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--ec-radius-pill);
    font-size: var(--ec-font-sm);
    font-weight: 700;
}

.ec-badge--red     { background: var(--ec-red-soft);     color: var(--ec-red); }
.ec-badge--blue    { background: var(--ec-info-bg);       color: var(--ec-info-color); }
.ec-badge--neutral { background: var(--ec-bg-panel);      color: var(--ec-slate); }
.ec-badge--green   { background: var(--ec-success-bg);    color: var(--ec-success); }
.ec-badge--warning { background: var(--ec-warning-bg);    color: var(--ec-warning); }
.ec-badge--orange  { background: #fff7ed;                 color: #c2410c; }

/* ------------------------------------------------------------
   CONTAINER
------------------------------------------------------------ */
.ec-container {
    max-width: var(--ec-max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ------------------------------------------------------------
   SECTION DIVIDER
------------------------------------------------------------ */
.ec-section-divider {
    margin: 48px 0 42px;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(15, 23, 42, 0.10),
        transparent
    );
}

@media (max-width: 768px) {
    .ec-section-divider { margin: 34px 0 30px; }
}

@media (max-width: 480px) {
    .ec-section-divider { margin: 28px 0 24px; }
}

/* ------------------------------------------------------------
   DARK PANEL (hero, CTA, result)
------------------------------------------------------------ */
.ec-dark-panel {
    background: linear-gradient(135deg, var(--ec-black) 0%, var(--ec-dark) 100%);
    color: #fff;
    border-radius: var(--ec-radius-3xl);
    padding: 28px;
    box-shadow: var(--ec-shadow-xl);
}

/* ------------------------------------------------------------
   CATEGORY NAVIGATION (shared: category + single-calculator)
------------------------------------------------------------ */
.ec-category-nav-wrap {
    width: 100%;
    margin: 32px 0 40px;
    padding: 5px 0;
    border-top: 1px solid var(--ec-border);
    background: var(--ec-bg);
}

body.tax-calc_category .ec-category-nav-sticky,
body.single-calculator .ec-category-nav-sticky {
    position: sticky;
    top: calc(var(--ec-header-offset-desktop) + var(--ec-admin-bar));
    z-index: var(--ec-z-sticky);
    background: var(--ec-bg);
}

body.tax-calc_category .ec-category-nav-sticky.is-stuck,
body.single-calculator .ec-category-nav-sticky.is-stuck {
    box-shadow: var(--ec-shadow-sm);
}

@media (max-width: 1024px) {
    body.tax-calc_category .ec-category-nav-sticky,
    body.single-calculator .ec-category-nav-sticky {
        top: calc(var(--ec-header-offset-tablet) + var(--ec-admin-bar));
    }
}

@media (max-width: 768px) {
    body.tax-calc_category .ec-category-nav-sticky,
    body.single-calculator .ec-category-nav-sticky {
        display: none !important;
    }
}

.ec-category-nav {
    display: flex;
    justify-content: center;
    width: 100%;
}

.ec-cat-nav-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 22px;
    list-style: none;
    margin: 0 auto;
    padding: 0 24px;
    max-width: var(--ec-max-width);
}

.ec-cat-nav-item {
    display: flex;
    align-items: center;
}

.ec-cat-nav-item a {
    font-size: var(--ec-font-lg);
    font-weight: 500;
    color: var(--ec-muted);
    text-decoration: none;
    position: relative;
    padding-bottom: 4px;
    white-space: nowrap;
    transition: color .15s ease;
}

.ec-cat-nav-item a:hover {
    color: var(--ec-black);
}

.ec-cat-nav-item.is-active a {
    font-weight: 600;
    color: var(--ec-black);
}

.ec-cat-nav-item.is-active a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--ec-red);
    border-radius: 2px;
}

@media (max-width: 480px) {
    .ec-cat-nav-list { gap: 8px 16px; }
    .ec-cat-nav-item a { font-size: var(--ec-font-md); }
}

/* ------------------------------------------------------------
   SEARCH FORM (shared: calculators hub + category)
------------------------------------------------------------ */
.ec-search-form {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: var(--ec-bg-subtle);
    border-radius: var(--ec-radius-xl);
    border: 1px solid var(--ec-border-strong);
    overflow: hidden;
    position: relative;
}

.ec-search-field {
    flex: 1;
    height: 52px;
    padding: 0 22px;
    border: none;
    outline: none;
    background: transparent;
    font-size: var(--ec-font-xl);
    color: var(--ec-black);
}

.ec-search-submit {
    padding: 0 34px;
    border-radius: 0 var(--ec-radius-lg) var(--ec-radius-lg) 0;
    background: var(--ec-red);
    color: #fff;
    font-weight: 800;
    font-size: var(--ec-font-xl);
    border: none;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.ec-search-submit:hover {
    background: var(--ec-red-dark);
}

@media (max-width: 640px) {
    .ec-search-field {
        height: 40px;
        padding: 0 12px;
        font-size: var(--ec-font-md);
    }

    .ec-search-submit {
        height: 40px;
        padding: 0 16px;
        border-radius: var(--ec-radius-lg);
        font-size: var(--ec-font-md);
    }
}

/* ------------------------------------------------------------
   FAQ ACCORDION (shared: category + single calculator)
   Klasy .ec-acc-* (category) i .ec-faq-* (single) zestawione
   pod jednolite tokeny, zachowano oba prefixe
------------------------------------------------------------ */

/* Category-style accordion */
.ec-accordion { border-top: 1px solid var(--ec-border); }

.ec-acc-item { border-bottom: 1px solid var(--ec-border); }

.ec-acc-q {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none !important;
    border: none !important;
    padding: 22px 0;
    font-size: var(--ec-font-xl);
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    color: var(--ec-black);
    transition: color .15s ease;
}

.ec-acc-q:hover { color: var(--ec-red); }

.ec-acc-icon {
    font-size: 20px;
    color: var(--ec-red);
    transition: transform .3s ease;
}

.ec-acc-item.is-open .ec-acc-icon { transform: rotate(45deg); }

.ec-acc-a {
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height .3s cubic-bezier(0.4, 0, 0.2, 1), visibility .3s;
}

.ec-acc-item.is-open .ec-acc-a { visibility: visible; }

.ec-acc-a-inner {
    padding: 0 0 24px;
    color: var(--ec-muted);
    line-height: 1.7;
    font-size: var(--ec-font-xl);
}

/* Single-calc style FAQ */
.ec-faq-item {
    cursor: pointer;
    margin-bottom: 10px;
    font-size: var(--ec-font-size-content);
    background: var(--ec-bg);
    border: 1px solid var(--ec-border);
    border-radius: var(--ec-radius-xl);
    padding: 24px;
    transition: background .15s ease;
}

.ec-faq-q {
    font-weight: 600;
    position: relative;
    padding-right: 28px;
    color: var(--ec-black);
}

.ec-faq-q::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 0;
    font-size: 18px;
    line-height: 1;
    opacity: .6;
    transition: transform .2s ease;
}

.ec-faq-item.is-open .ec-faq-q::after { content: '–'; }

.ec-faq-a {
    display: none;
    margin-top: 12px;
    line-height: 1.6;
    color: var(--ec-black);
}

.ec-faq-item.is-open .ec-faq-a { display: block; }

/* ------------------------------------------------------------
   RESULT INTERPRETATION STATES (shared)
------------------------------------------------------------ */
.ec-result-interpretation {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--ec-radius-md);
    font-size: var(--ec-font-size-content);
    font-weight: 600;
    line-height: 1.4;
}

.ec-result-interpretation.is-safe    { background: rgba(22,163,74,.12); color: #16a34a; }
.ec-result-interpretation.is-limit   { background: rgba(245,158,11,.14); color: var(--ec-warning-muted); }
.ec-result-interpretation.is-unsafe  { background: rgba(220,38,38,.14); color: #dc2626; }
.ec-result-interpretation.is-info    { background: rgba(14,165,233,.14); color: var(--ec-info); }
.ec-result-interpretation.is-warning { background: rgba(249,115,22,.14); color: #f97316; }
.ec-result-interpretation.is-invalid { background: var(--ec-black); color: #fff; }

/* Status colors (report sidebar) */
.ec-report-status[data-status="safe"],
.ec-step-status[data-status="safe"]  { color: #2e7d32; font-weight: 700; }
.ec-report-status[data-status="unsafe"],
.ec-step-status[data-status="unsafe"] { color: #c62828; font-weight: 700; }
.ec-report-status[data-status="limit"],
.ec-step-status[data-status="limit"]  { color: #ed6c02; font-weight: 700; }

/* ------------------------------------------------------------
   AUTH MODAL (shared)
------------------------------------------------------------ */
.ec-auth-modal[hidden] { display: none !important; }

.ec-auth-modal {
    position: fixed;
    inset: 0;
    z-index: var(--ec-z-auth-modal);
}

.ec-auth-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.ec-auth-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(520px, calc(100% - 32px));
    margin: 10vh auto 0;
    background: var(--ec-bg);
    border-radius: var(--ec-radius-2xl);
    padding: 28px;
    box-shadow: var(--ec-shadow-xl);
}

.ec-auth-modal__close {
    position: absolute;
    top: 14px;
    right: 16px;
    border: 0;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
}

.ec-auth-modal__actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.ec-auth-modal__primary,
.ec-auth-modal__secondary {
    padding: 12px 16px;
    border-radius: var(--ec-radius-lg);
    cursor: pointer;
}

.ec-feature-message {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--ec-radius-lg);
    background: var(--ec-success-bg);
    border: 1px solid var(--ec-success-light);
    color: var(--ec-success);
    font-size: var(--ec-font-lg);
    line-height: 1.4;
}

.ec-feature-message[hidden] { display: none !important; }

/* ------------------------------------------------------------
   SKELETON LOADING (shared)
------------------------------------------------------------ */
.ec-preload .ec-input-block {
    position: relative;
    overflow: hidden;
}

.ec-preload .ec-input-block::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(90deg, #f3f3f3 25%, #e7e7e7 37%, #f3f3f3 63%);
    background-size: 400% 100%;
    animation: ec-skeleton 1.2s infinite;
}

.ec-preload .ec-result-value {
    position: relative;
    color: transparent;
}

.ec-preload .ec-result-value::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--ec-radius-sm);
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(90deg, var(--ec-black) 25%, var(--ec-dark) 37%, var(--ec-black) 63%);
    background-size: 400% 100%;
    animation: ec-skeleton 1.2s infinite;
}

@keyframes ec-skeleton {
    0%   { background-position: 100% 0 }
    100% { background-position: 0 0 }
}

/* ------------------------------------------------------------
   TOUCH DEVICE OVERRIDES (no hover)
------------------------------------------------------------ */
@media (hover: none) {
    .ec-card:hover,
    .ec-popular-card:hover,
    .ec-value-card:hover,
    .ec-quick-link:hover {
        transform: none;
    }

    .ec-card:hover .ec-card-arrow {
        transform: none;
    }
}

/* ------------------------------------------------------------
   MOBILE SHADOW OPTIMIZATION
------------------------------------------------------------ */
@media (max-width: 768px) {
    .ec-hero,
    .ec-tool-finder,
    .ec-category-panel,
    .ec-popular-panel,
    .ec-card,
    .ec-popular-card,
    .ec-value-card {
        box-shadow: var(--ec-shadow-sm);
    }
}

/* ------------------------------------------------------------
   BLOCKSY OVERRIDES (single calculator)
------------------------------------------------------------ */
body.single-calculator .entry-header,
body.single-calculator .ct-post-title,
body.single-calculator .ct-breadcrumbs {
    display: none !important;
}

body.single-calculator .ct-header-divider,
body.single-calculator .ct-header-shadow,
body.single-calculator .ct-header-border,
body.single-calculator .ct-header-separator,
body.single-calculator header::after {
    display: none !important;
}

body.single-calculator header {
    border-bottom: none !important;
    box-shadow: none !important;
}

/* ------------------------------------------------------------
   ACCESSIBILITY
------------------------------------------------------------ */
.ec-section-muted {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
