/**
 * Tea Composition Insights - Frontend Styles
 *
 * Badge, Tooltip, Modal, Accordion, Ingredient Cards,
 * Tags, Effects, Cautions, Safety Badges, Disclaimer.
 *
 * @package TeaCompositionInsights
 */

/* ================================================================== */
/*  1. BADGE                                                           */
/* ================================================================== */

.tci-badge-wrap {
    position: relative;
    display: inline-block;
    margin: 8px 0;
    z-index: 10;
}

.tci-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #e8f5e3, #f0f7ee);
    border: 1px solid #c5ddc0;
    border-radius: 24px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #2d5a27;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    font-family: inherit;
    line-height: 1.4;
    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;
}

.tci-badge:hover {
    background: linear-gradient(135deg, #d4eace, #e8f5e3);
    box-shadow: 0 2px 8px rgba(45, 90, 39, 0.15);
}

.tci-badge:active {
    transform: scale(0.97);
}

.tci-badge:focus-visible {
    outline: 2px solid #4a8c3f;
    outline-offset: 2px;
}

.tci-badge svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ================================================================== */
/*  2. TOOLTIP                                                         */
/* ================================================================== */

.tci-tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px);
    z-index: 1000;
    max-width: 300px;
    min-width: 180px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #d4e8d0;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(45, 90, 39, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
    font-size: 0.85em;
    line-height: 1.5;
    color: #3d5c39;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

/* Arrow pointing up */
.tci-tooltip::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #d4e8d0;
}

.tci-tooltip::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #fff;
}

/* Visible state */
.tci-tooltip.tci-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* "Детальніше" button inside tooltip */
.tci-tooltip-detail-btn {
    display: block;
    margin-top: 6px;
    padding: 0;
    background: none;
    border: none;
    color: #4a8c3f;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-family: inherit;
}
.tci-tooltip-detail-btn:hover {
    color: #2d5a27;
}

/* Badge as <a> tag — reset link styles */
a.tci-badge {
    text-decoration: none;
    color: inherit;
}

/* ================================================================== */
/*  3. MODAL OVERLAY                                                   */
/* ================================================================== */

.tci-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

.tci-modal-overlay[hidden] {
    display: none;
}

.tci-modal-overlay.tci-active {
    opacity: 1;
}

/* ================================================================== */
/*  4. MODAL BOX                                                       */
/* ================================================================== */

.tci-modal-box {
    position: relative;
    background: #fff;
    max-width: 720px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.18),
        0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.3s ease;
    overscroll-behavior: contain;
}

.tci-modal-overlay.tci-active .tci-modal-box {
    transform: translateY(0) scale(1);
}

/* ================================================================== */
/*  5. MODAL HEADER                                                    */
/* ================================================================== */

.tci-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid #e0e8dd;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    border-radius: 16px 16px 0 0;
}

.tci-modal-header h2,
.tci-modal-header h3 {
    margin: 0;
    font-size: 1.15em;
    font-weight: 700;
    color: #2d5a27;
    line-height: 1.3;
}

/* ================================================================== */
/*  6. MODAL CLOSE BUTTON                                              */
/* ================================================================== */

.tci-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: #6b8f66;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.tci-modal-close:hover {
    background: #f0f7ee;
    color: #2d5a27;
}

.tci-modal-close:focus-visible {
    outline: 2px solid #4a8c3f;
    outline-offset: 2px;
}

/* ================================================================== */
/*  7. MODAL BODY                                                      */
/* ================================================================== */

.tci-modal-body {
    padding: 24px;
}

/* ================================================================== */
/*  8. MODAL FOOTER                                                    */
/* ================================================================== */

.tci-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e8dd;
    background: #f9faf8;
    border-radius: 0 0 16px 16px;
}

/* ================================================================== */
/*  9. INGREDIENT CARDS                                                */
/* ================================================================== */

.tci-modal-ingredients {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.tci-modal-ing-card {
    padding: 12px;
    background: #f5faf3;
    border: 1px solid #d4e8d0;
    border-radius: 10px;
    text-align: center;
    transition: box-shadow 0.15s, transform 0.15s;
}

.tci-modal-ing-card:hover {
    box-shadow: 0 2px 10px rgba(45, 90, 39, 0.1);
    transform: translateY(-1px);
}

.tci-modal-ing-icon {
    font-size: 1.8em;
    line-height: 1.3;
}

.tci-modal-ing-name {
    font-weight: 600;
    color: #2d5a27;
    font-size: 0.9em;
    margin-top: 4px;
}

.tci-modal-ing-type {
    font-size: 0.75em;
    color: #6b8f66;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 2px;
}

/* ================================================================== */
/*  10. SECTIONS INSIDE MODAL                                          */
/* ================================================================== */

.tci-modal-section {
    margin-bottom: 20px;
}

.tci-modal-section:last-child {
    margin-bottom: 0;
}

.tci-modal-section-title {
    font-size: 1em;
    font-weight: 600;
    color: #2d5a27;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ================================================================== */
/*  11. TAGS                                                           */
/* ================================================================== */

.tci-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tci-modal-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.82em;
    font-weight: 500;
    line-height: 1.4;
}

.tci-modal-tag--substance {
    background: #eef6ec;
    color: #3d6b35;
    border: 1px solid #c5ddc0;
}

.tci-modal-tag--mineral {
    background: #f0f0ff;
    color: #4a4a8a;
    border: 1px solid #d0d0f0;
}

.tci-modal-tag--vitamin {
    background: #fff8e8;
    color: #8a6b18;
    border: 1px solid #f0dca0;
}

/* ================================================================== */
/*  12. EFFECTS LIST                                                   */
/* ================================================================== */

.tci-modal-effects {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tci-modal-effects li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 4px;
    color: #3d5c39;
    font-size: 0.9em;
    line-height: 1.5;
}

.tci-modal-effects li::before {
    content: "\2713"; /* checkmark */
    position: absolute;
    left: 0;
    color: #4a8c3f;
    font-weight: 700;
}

/* ================================================================== */
/*  13. CAUTIONS (amber, not red)                                      */
/* ================================================================== */

.tci-modal-cautions {
    background: #fdf8f0;
    border: 1px solid #e8dcc8;
    border-left: 3px solid #c9a96e;
    border-radius: 10px;
    padding: 16px;
    list-style: none;
    margin: 0;
}

.tci-modal-cautions li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 4px;
    color: #6b5528;
    font-size: 0.9em;
    line-height: 1.5;
}

.tci-modal-cautions li:last-child {
    margin-bottom: 0;
}

.tci-modal-cautions li::before {
    content: "\26A0"; /* warning sign */
    position: absolute;
    left: 0;
    color: #c9a96e;
}

/* ================================================================== */
/*  14. SAFETY BADGES                                                  */
/* ================================================================== */

.tci-safety-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tci-safety-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.82em;
    font-weight: 500;
    line-height: 1.4;
}

.tci-safety-badge--safe {
    background: #e8f5e3;
    color: #2d6b27;
    border: 1px solid #c5ddc0;
}

.tci-safety-badge--caution {
    background: #fff8e8;
    color: #8a6b18;
    border: 1px solid #f0dca0;
}

.tci-safety-badge--contraindicated {
    background: #fde8e8;
    color: #8a2727;
    border: 1px solid #f0c0c0;
}

/* ================================================================== */
/*  15. DISCLAIMER                                                     */
/* ================================================================== */

.tci-disclaimer {
    font-size: 0.82em;
    color: #8a9f87;
    text-align: center;
    margin: 0;
    line-height: 1.4;
}

/* ================================================================== */
/*  16. ACCORDION                                                      */
/* ================================================================== */

.tci-modal-accordion {
    border: 1px solid #e0e8dd;
    border-radius: 10px;
    overflow: hidden;
}

.tci-modal-accordion-item {
    border-bottom: 1px solid #e8f0e6;
}

.tci-modal-accordion-item:last-child {
    border-bottom: none;
}

.tci-accordion-trigger {
    display: flex;
    width: 100%;
    padding: 12px 16px;
    background: #fafdf9;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    color: #2d5a27;
    text-align: left;
    transition: background 0.15s;
    font-family: inherit;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.tci-accordion-trigger:hover {
    background: #f0f7ee;
}

.tci-accordion-trigger:focus-visible {
    outline: 2px solid #4a8c3f;
    outline-offset: -2px;
}

.tci-accordion-trigger[aria-expanded="true"] {
    background: #e8f2e5;
}

.tci-accordion-trigger .tci-chevron {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.tci-accordion-trigger[aria-expanded="true"] .tci-chevron {
    transform: rotate(180deg);
}

.tci-accordion-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 16px;
}

.tci-accordion-panel:not([hidden]) {
    padding: 12px 16px;
}

/* ================================================================== */
/*  17. BODY SCROLL LOCK                                               */
/* ================================================================== */

body.tci-modal-open {
    overflow: hidden;
}

/* ================================================================== */
/*  18. RESPONSIVE                                                     */
/* ================================================================== */

@media (max-width: 600px) {
    .tci-modal-box {
        width: 95vw;
        max-height: 90vh;
        border-radius: 12px;
    }

    .tci-modal-header {
        padding: 14px 16px;
        border-radius: 12px 12px 0 0;
    }

    .tci-modal-body {
        padding: 16px;
    }

    .tci-modal-footer {
        padding: 12px 16px;
        border-radius: 0 0 12px 12px;
    }

    .tci-modal-ingredients {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .tci-tooltip {
        max-width: 250px;
        font-size: 0.82em;
    }
}


/* ══════════════════════════════════════════════════════════════════════
 * MICRO ICONS (near product title)
 * ══════════════════════════════════════════════════════════════════════ */

.tci-micro-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px;
}

.tci-micro-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f5faf3;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    color: #4a8c3f;
    padding: 0;
}

.tci-micro-icon:hover {
    background: #e8f2e5;
    box-shadow: 0 2px 8px rgba(45, 90, 39, 0.12);
}

.tci-micro-icon svg {
    width: 18px;
    height: 18px;
}

/* Tooltip for micro icons (appears on hover/click) */
.tci-micro-icon::after {
    content: attr(data-tci-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #2c3e2d;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 1px solid #e4ede2;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 10;
}

.tci-micro-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
    z-index: 10;
}

.tci-micro-icon:hover::after,
.tci-micro-icon:hover::before,
.tci-micro-icon.tci-tip-active::after,
.tci-micro-icon.tci-tip-active::before {
    opacity: 1;
    visibility: visible;
}


/* ══════════════════════════════════════════════════════════════════════
 * ENCYCLOPEDIA BLOCK
 * ══════════════════════════════════════════════════════════════════════ */

/*
 * Eliminate excess WooCommerce gap above encyclopedia.
 * The woocommerce_after_single_product_summary hook fires inside
 * .summary or after tabs — themes often add large bottom-margin
 * on .woocommerce-tabs. We tighten this specifically before our block.
 */
.woocommerce-tabs + .tci-encyclopedia,
.woocommerce-tabs ~ .tci-encyclopedia {
    margin-top: 0;
}
/* Some themes put a large margin-bottom on the tabs container */
.woocommerce div.product .woocommerce-tabs {
    margin-bottom: 0;
}

.tci-facts-between {
    max-width: 1100px;
    margin: 16px auto 10px;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #2c3e2d;
    line-height: 1.6;
}

.tci-facts-between .tci-ency-section {
    margin-bottom: 14px;
}

.tci-facts-between + .tci-encyclopedia {
    margin-top: 6px;
}

.tci-encyclopedia {
    max-width: 1100px;
    margin: 20px auto 40px;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #2c3e2d;
    line-height: 1.6;
    /* Smooth scroll target offset */
    scroll-margin-top: 80px;
}

/* ── Header ── */
.tci-ency-header {
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid #d4e8d0;
}

.tci-ency-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.55em;
    font-weight: 700;
    color: #2d5a27;
    margin: 0 0 10px;
}

.tci-ency-title svg {
    color: #4a8c3f;
    flex-shrink: 0;
}

.tci-ency-intro {
    font-size: 0.95em;
    color: #5a7a56;
    margin: 0;
    max-width: 700px;
}

/* ── Sections ── */
.tci-ency-section {
    margin-bottom: 36px;
}

.tci-ency-section-title {
    font-size: 1.15em;
    font-weight: 600;
    color: #2d5a27;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e4ede2;
}


/* ══════════════════════════════════════════════════════════════════════
 * TEA PASSPORT
 * ══════════════════════════════════════════════════════════════════════ */

.tci-passport {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #fdfcf8 0%, #f8f5ee 100%);
    border: 1px solid #e8dcc8;
    border-radius: 14px;
}

.tci-passport-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #f0e8d8;
    min-width: 120px;
}

.tci-passport-label {
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8a7a60;
    font-weight: 600;
}

.tci-passport-value {
    font-size: 0.9em;
    color: #2d5a27;
    font-weight: 500;
}

.tci-passport-color-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}


/* ══════════════════════════════════════════════════════════════════════
 * SENSORY EQUALIZER
 * ══════════════════════════════════════════════════════════════════════ */

.tci-equalizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    height: 180px;
    padding: 20px 16px 0;
    background: linear-gradient(180deg, #fafdf9 0%, #f0f7ee 100%);
    border: 1px solid #d4e8d0;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}

/* Subtle horizontal grid lines */
.tci-equalizer::before {
    content: '';
    position: absolute;
    inset: 20px 16px 40px;
    background: repeating-linear-gradient(0deg, transparent, transparent 19%, #e4ede2 19%, #e4ede2 20%);
    pointer-events: none;
    opacity: 0.5;
}

.tci-eq-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 60px;
    min-width: 30px;
    position: relative;
    z-index: 1;
    cursor: pointer;
}

.tci-eq-fill {
    width: 100%;
    max-width: 32px;
    height: var(--bar-height, 50%);
    background: var(--bar-color, #4a8c3f);
    border-radius: 6px 6px 0 0;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.85;
    min-height: 4px;
}

.tci-eq-bar:hover .tci-eq-fill {
    opacity: 1;
    transform: scaleX(1.1);
}

.tci-eq-label {
    font-size: 0.65em;
    color: #6b8f66;
    margin-top: 8px;
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
    max-width: 60px;
    word-break: break-word;
}

/* Tooltip on hover */
.tci-eq-bar::after {
    content: attr(data-tci-tip);
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e2d;
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.tci-eq-bar:hover::after {
    opacity: 1;
}


/* ══════════════════════════════════════════════════════════════════════
 * FLAVOR & AROMA PROFILE
 * ══════════════════════════════════════════════════════════════════════ */

.tci-ency-profiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.tci-ency-profile-col {
    background: #fafdf9;
    border: 1px solid #e4ede2;
    border-radius: 12px;
    padding: 16px 20px;
}

.tci-ency-profile-label {
    font-size: 0.95em;
    font-weight: 600;
    color: #2d5a27;
    margin: 0 0 10px;
}

.tci-ency-profile-item {
    font-size: 0.88em;
    color: #4a6347;
    margin: 0 0 6px;
}


/* ══════════════════════════════════════════════════════════════════════
 * INGREDIENT CARDS (ENCYCLOPEDIA)
 * ══════════════════════════════════════════════════════════════════════ */

.tci-ency-ingredients {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.tci-ency-ing-card {
    background: linear-gradient(145deg, #f5faf3 0%, #fafdf9 100%);
    border: 1px solid #d4e8d0;
    border-radius: 14px;
    padding: 20px;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.tci-ency-ing-card:hover {
    box-shadow: 0 6px 24px rgba(45, 90, 39, 0.1);
    transform: translateY(-2px);
}

.tci-ency-ing-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.tci-ency-ing-thumb {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e8f2e5;
}

.tci-ency-ing-thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
}

.tci-ency-ing-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #2d5a27;
    margin: 0 0 2px;
}

.tci-ency-ing-meta {
    font-size: 0.78em;
    color: #6b8f66;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.tci-ency-ing-desc {
    font-size: 0.9em;
    color: #4a6347;
    margin: 0 0 10px;
}

.tci-ency-ing-profile {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.tci-ency-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.82em;
    font-weight: 500;
}

.tci-ency-tag--taste {
    background: #fdf5e6;
    color: #8a6b18;
    border: 1px solid #f0dca0;
}

.tci-ency-tag--aroma {
    background: #f5eef5;
    color: #7a5a7a;
    border: 1px solid #e0cfe0;
}

.tci-ency-ing-usage {
    font-size: 0.88em;
    color: #3d5c39;
    margin: 0 0 8px;
}

.tci-ency-ing-fact {
    font-size: 0.88em;
    color: #5a7850;
    background: #f0f7ee;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 8px 0 0;
}


/* ══════════════════════════════════════════════════════════════════════
 * SUBSTANCE CARDS
 * ══════════════════════════════════════════════════════════════════════ */

.tci-ency-substances {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.tci-ency-subst-card {
    background: #fafdf9;
    border: 1px solid #e0eadd;
    border-radius: 12px;
    padding: 16px 20px;
}

.tci-ency-subst-name {
    font-size: 1em;
    font-weight: 600;
    color: #2d5a27;
    margin: 0 0 8px;
}

.tci-ency-subst-desc {
    font-size: 0.9em;
    color: #4a6347;
    margin: 0 0 6px;
}

.tci-ency-subst-role {
    font-size: 0.88em;
    color: #5a7a56;
    margin: 0;
}


/* ══════════════════════════════════════════════════════════════════════
 * BREWING GUIDE
 * ══════════════════════════════════════════════════════════════════════ */

.tci-brew-methods {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tci-brew-card {
    background: #fdfcf8;
    border: 1px solid #e8dcc8;
    border-radius: 14px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.tci-brew-card:hover {
    box-shadow: 0 4px 16px rgba(139, 107, 24, 0.08);
}

.tci-brew-card-title {
    font-size: 1.05em;
    font-weight: 600;
    color: #6b5528;
    margin: 0 0 14px;
}

.tci-brew-params {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.tci-brew-param {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #f0e8d8;
    border-radius: 10px;
    min-width: 70px;
}

.tci-brew-param-icon {
    font-size: 1.3em;
    margin-bottom: 2px;
}

.tci-brew-param-val {
    font-size: 1em;
    font-weight: 600;
    color: #2d5a27;
}

.tci-brew-param-label {
    font-size: 0.72em;
    color: #8a7a60;
}

.tci-brew-tips {
    font-size: 0.85em;
    color: #6b5528;
    font-style: italic;
    margin: 8px 0 0;
}

.tci-brew-extras {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tci-brew-extra-tag {
    padding: 4px 12px;
    background: #f5faf3;
    border: 1px solid #d4e8d0;
    border-radius: 16px;
    font-size: 0.82em;
    color: #3d6b35;
}


/* ══════════════════════════════════════════════════════════════════════
 * INFUSION PROGRESSION (timeline)
 * ══════════════════════════════════════════════════════════════════════ */

.tci-infusion-journey {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding: 16px 0;
    scrollbar-width: thin;
}

.tci-infusion-step {
    flex: 0 0 auto;
    width: 160px;
    text-align: center;
    position: relative;
    padding: 0 12px;
}

/* Connecting line */
.tci-infusion-step::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 0;
    right: 0;
    height: 2px;
    background: #d4e8d0;
    z-index: 0;
}

.tci-infusion-step:first-child::before {
    left: 50%;
}

.tci-infusion-step:last-child::before {
    right: 50%;
}

.tci-infusion-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a8c3f, #6ba85f);
    color: #fff;
    font-weight: 700;
    font-size: 0.9em;
    position: relative;
    z-index: 1;
    margin-bottom: 8px;
}

.tci-infusion-desc {
    font-size: 0.82em;
    color: #4a6347;
    line-height: 1.4;
    margin: 0;
}


/* ══════════════════════════════════════════════════════════════════════
 * PAIRINGS
 * ══════════════════════════════════════════════════════════════════════ */

.tci-pairings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.tci-pairing-card {
    background: #fdfcf8;
    border: 1px solid #f0e8d8;
    border-radius: 12px;
    padding: 16px 20px;
}

.tci-pairing-card h4 {
    font-size: 0.95em;
    font-weight: 600;
    color: #6b5528;
    margin: 0 0 8px;
}

.tci-pairing-card p {
    font-size: 0.88em;
    color: #5a6b50;
    margin: 0;
    line-height: 1.5;
}


/* ══════════════════════════════════════════════════════════════════════
 * AUDIENCE / WHO WILL LIKE
 * ══════════════════════════════════════════════════════════════════════ */

.tci-audience {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tci-audience-likes,
.tci-audience-less {
    padding: 16px 20px;
    border-radius: 12px;
}

.tci-audience-likes {
    background: #f5faf3;
    border: 1px solid #d4e8d0;
}

.tci-audience-less {
    background: #faf8f5;
    border: 1px solid #e8dcc8;
}

.tci-audience h4 {
    font-size: 0.95em;
    font-weight: 600;
    margin: 0 0 8px;
}

.tci-audience-likes h4 {
    color: #2d6b27;
}

.tci-audience-less h4 {
    color: #8a6b18;
}

.tci-audience p {
    font-size: 0.88em;
    color: #4a6347;
    margin: 0;
    line-height: 1.5;
}


/* ══════════════════════════════════════════════════════════════════════
 * EFFECTS TAGS (ENCYCLOPEDIA)
 * ══════════════════════════════════════════════════════════════════════ */

.tci-ency-effects {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tci-ency-effect-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: #e8f5e3;
    border: 1px solid #c5ddc0;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    color: #2d6b27;
}


/* ══════════════════════════════════════════════════════════════════════
 * ACCORDION (ENCYCLOPEDIA)
 * ══════════════════════════════════════════════════════════════════════ */

.tci-ency-accordion {
    border: 1px solid #d4e8d0;
    border-radius: 14px;
    overflow: hidden;
}

.tci-ency-accordion-item {
    border-bottom: 1px solid #e8f0e6;
}

.tci-ency-accordion-item:last-child {
    border-bottom: none;
}

.tci-ency-accordion-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 16px 20px;
    background: #fafdf9;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    color: #2d5a27;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s ease;
}

.tci-ency-accordion-trigger:hover {
    background: #f0f7ee;
}

.tci-ency-accordion-trigger[aria-expanded="true"] {
    background: #e8f2e5;
}

.tci-ency-accordion-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.tci-ency-chevron {
    margin-left: auto;
    color: #6b8f66;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.tci-ency-accordion-trigger[aria-expanded="true"] .tci-ency-chevron {
    transform: rotate(180deg);
}

.tci-ency-accordion-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.tci-ency-accordion-panel[hidden] {
    display: block !important;
    max-height: 0;
}

.tci-ency-accordion-panel.tci-ency-panel-open {
    max-height: 2000px;
}

.tci-ency-accordion-content {
    padding: 16px 20px 20px;
    font-size: 0.92em;
    color: #3d5c39;
    line-height: 1.7;
}

.tci-ency-accordion-content p {
    margin: 0 0 10px;
}

.tci-ency-accordion-content p:last-child {
    margin-bottom: 0;
}


/* ══════════════════════════════════════════════════════════════════════
 * FACTS
 * ══════════════════════════════════════════════════════════════════════ */

.tci-ency-facts {
    display: grid;
    gap: 12px;
}

.tci-ency-fact-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 18px;
    background: #fdf8f0;
    border: 1px solid #f0e0c4;
    border-radius: 12px;
}

.tci-ency-fact-icon {
    font-size: 1.3em;
    flex-shrink: 0;
    line-height: 1;
}

.tci-ency-fact-card p {
    margin: 4px 0 0;
    font-size: 0.9em;
    color: #5a6b50;
}

.tci-ency-fact-card strong {
    color: #2d5a27;
    font-size: 0.92em;
}


/* ══════════════════════════════════════════════════════════════════════
 * DISCLAIMER (ENCYCLOPEDIA)
 * ══════════════════════════════════════════════════════════════════════ */

.tci-ency-disclaimer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid #e4ede2;
    margin-top: 8px;
}

.tci-ency-disclaimer p {
    font-size: 0.82em;
    color: #8a9f87;
    margin: 0;
    line-height: 1.4;
}


/* ══════════════════════════════════════════════════════════════════════
 * RESPONSIVE - ENCYCLOPEDIA & ALL NEW SECTIONS
 * ══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .tci-passport {
        flex-direction: column;
    }
    .tci-equalizer {
        height: 150px;
        gap: 4px;
    }
    .tci-eq-label {
        font-size: 0.55em;
    }
    .tci-ency-profiles {
        grid-template-columns: 1fr;
    }
    .tci-ency-ingredients {
        grid-template-columns: 1fr;
    }
    .tci-ency-substances {
        grid-template-columns: 1fr;
    }
    .tci-brew-methods {
        grid-template-columns: 1fr;
    }
    /* .tci-infusion-journey already scrollable */
    .tci-pairings-grid {
        grid-template-columns: 1fr;
    }
    .tci-audience {
        grid-template-columns: 1fr;
    }
    .tci-micro-icons {
        gap: 6px;
    }
    .tci-micro-icon {
        width: 32px;
        height: 32px;
    }
    .tci-ency-title {
        font-size: 1.25em;
    }
    .tci-ency-ing-head {
        gap: 10px;
    }
    .tci-ency-ing-thumb {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .tci-encyclopedia {
        padding: 0 10px;
        margin: 32px auto;
    }
    .tci-ency-section {
        margin-bottom: 24px;
    }
    .tci-equalizer {
        height: 120px;
        padding: 12px 8px 0;
    }
    .tci-eq-fill {
        max-width: 22px;
    }
    .tci-infusion-step {
        width: 130px;
    }
    .tci-ency-accordion-trigger {
        padding: 14px 14px;
        font-size: 0.9em;
    }
}


/* ==================================================================
 * FIX 2.1.0 — CARD CLASS ALIASES (modal uses different class names)
 * ================================================================== */

.tci-ingredient-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.tci-ingredient-card {
    padding: 14px 12px;
    background: linear-gradient(145deg, #f5faf3 0%, #eef7ea 100%);
    border: 1px solid #c5ddc0;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(45, 90, 39, 0.07);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.tci-ingredient-card:hover {
    box-shadow: 0 6px 20px rgba(45, 90, 39, 0.15);
    transform: translateY(-2px);
}

.tci-ingredient-icon {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    margin: 0 auto 6px;
}

.tci-ingredient-icon--placeholder {
    font-size: 2em;
    line-height: 1.2;
    margin-bottom: 4px;
}

.tci-ingredient-name {
    display: block;
    font-weight: 600;
    color: #2d5a27;
    font-size: 0.88em;
    line-height: 1.3;
    margin-top: 4px;
}

.tci-ingredient-type {
    display: block;
    font-size: 0.73em;
    color: #6b8f66;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 3px;
}

/* ==================================================================
 * FIX 2.1.0 — REINFORCE ENCYCLOPEDIA INGREDIENT CARDS (theme override)
 * ================================================================== */

.tci-encyclopedia .tci-ency-ing-card {
    background: linear-gradient(145deg, #f5faf3 0%, #fafdf9 100%) !important;
    border: 1px solid #d4e8d0 !important;
    border-radius: 14px !important;
    padding: 20px !important;
    box-shadow: 0 2px 10px rgba(45, 90, 39, 0.07) !important;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.tci-encyclopedia .tci-ency-ing-card:hover {
    box-shadow: 0 8px 28px rgba(45, 90, 39, 0.16) !important;
    transform: translateY(-2px);
}

/* ==================================================================
 * FIX 2.1.0 — ENCYCLOPEDIA BOTTOM SPACING
 * ================================================================== */

.tci-encyclopedia {
    margin-bottom: 60px !important;
}

.tci-insights-block,
.tci-ency-wrap {
    margin-bottom: 48px !important;
}

/* ==================================================================
 * FIX 2.1.0 — WARNINGS SECTION (ENCYCLOPEDIA)
 * ================================================================== */

.tci-ency-warnings {
    background: linear-gradient(135deg, #fffbf2 0%, #fdf8ec 100%);
    border: 1px solid #e8dcc8;
    border-left: 4px solid #c9a96e;
    border-radius: 12px;
    padding: 16px 20px;
}

.tci-ency-warnings-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tci-ency-warning-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9em;
    color: #6b5528;
    line-height: 1.5;
}

.tci-ency-warning-item span:first-child {
    flex-shrink: 0;
    font-size: 1.1em;
    line-height: 1.4;
    margin-top: 1px;
}

/* ==================================================================
 * FIX 2.1.0 — MOBILE ADDITIONS
 * ================================================================== */

@media (max-width: 768px) {
    .tci-ingredient-cards {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .tci-ency-warnings {
        padding: 14px 16px;
    }
}
