/* ── Reset для елементів плагіну ── */
#zhokl-cc-portal *,
.zhokl-cc-open-btn {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ── Кнопка відкриття ── */
.zhokl-cc-open-btn {
    color: #fff;
    border: none;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(13, 43, 107, 0.4);
    transition: filter .2s, transform .15s, box-shadow .15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}
.zhokl-cc-open-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(13, 43, 107, 0.5);
}

/* ── Overlay ── */
#zhokl-cc-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(60, 60, 60, 0.72);
    backdrop-filter: blur(3px);
    z-index: 2147483647 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin: 0 !important;
}
#zhokl-cc-modal-overlay.zhokl-cc-open {
    display: flex !important;
}

/* ── Модальна коробка ── */
#zhokl-cc-modal-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 90px rgba(0,0,0,.45);
    width: 100%;
    max-width: 1240px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: none;
    position: relative;
}

/* ── Header ── */
#zhokl-cc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: linear-gradient(180deg, #163983 0%, #0d2b6b 100%);
    color: #fff;
    flex-shrink: 0;
    border-radius: 16px 16px 0 0;
}
#zhokl-cc-modal-title {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .3px;
}
.zhokl-cc-menu-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}
.zhokl-cc-head-btn {
    border: 1px solid rgba(255,255,255,.35);
    background: rgba(255,255,255,.16);
    color: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.zhokl-cc-head-btn:hover { background: rgba(255,255,255,.28); }
.zhokl-cc-head-ico { font-size: 15px; line-height: 1; }
.zhokl-cc-menu-actions.zhokl-cc-actions-icons .zhokl-cc-head-btn {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
}
.zhokl-cc-menu-actions.zhokl-cc-actions-icons .zhokl-cc-head-txt {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
#zhokl-cc-close-btn {
    background: rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.3);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, border-color .2s;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 12px;
}
#zhokl-cc-close-btn:hover {
    background: rgba(255,255,255,.3);
    border-color: rgba(255,255,255,.6);
}

/* ── Body ── */
#zhokl-cc-modal-body {
    overflow-y: auto;
    padding: 20px 24px;
    flex: 1;
    background: #f5f7fa;
}
#zhokl-cc-modal-body::-webkit-scrollbar { width: 6px; }
#zhokl-cc-modal-body::-webkit-scrollbar-track { background: #eef0f5; }
#zhokl-cc-modal-body::-webkit-scrollbar-thumb { background: #8ba3d4; border-radius: 3px; }

/* ── Controls ── */
.zhokl-cc-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #dde3ee;
    font-size: 15px;
}
.zhokl-cc-link {
    color: #0d2b6b;
    text-decoration: none;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 6px;
    background: #e6ecf8;
    transition: background .15s;
    font-size: 14px;
}
.zhokl-cc-link:hover { background: #c8d5f0; }
.zhokl-cc-sep { color: #bbb; }
#zhokl-cc-xval {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid #c0cce8;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    outline: none;
    color: #0d2b6b;
}
#zhokl-cc-xval:focus { border-color: #0d2b6b; }

/* ── Total bar ── */
#zhokl-cc-total-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #163983 0%, #0d2b6b 100%);
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: 17px;
    font-weight: 600;
}
#zhokl-cc-grand-total {
    font-size: 28px;
    font-weight: 800;
    margin: 0 4px;
    color: #7eb8ff;
}


/* ── Search ── */
.zhokl-cc-search-wrap {
    margin-bottom: 16px;
    background: #ffffff;
    padding: 10px;
    border: 1px solid #dbe4f7;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(13,43,107,.06);
}
.zhokl-cc-search-input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid #b9c7e8;
    border-radius: 12px;
    font-size: 15px;
    color: #0d2b6b;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.zhokl-cc-search-input:focus {
    border-color: #0d2b6b;
    box-shadow: 0 0 0 3px rgba(13, 43, 107, 0.12);
}

.zhokl-cc-search-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #2a3f74;
}

/* ── Категорії ── */
.zhokl-cc-cat {
    border: 1px solid #dde3ee;
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(13,43,107,.08);
}
.zhokl-cc-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    min-height: 60px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #1a418f 0%, #11357d 100%);
    cursor: pointer;
    user-select: none;
    transition: background .15s;
    border-radius: 14px;
}
.zhokl-cc-cat.open .zhokl-cc-cat-header { border-radius: 14px 14px 0 0; }
.zhokl-cc-cat-header:hover { background: linear-gradient(180deg, #214c9f 0%, #15408f 100%); }
.zhokl-cc-cat-title {
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
}
.zhokl-cc-cat-arrow {
    transition: transform .2s;
    font-size: 11px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    flex-shrink: 0;
}
.zhokl-cc-cat.open .zhokl-cc-cat-arrow { transform: rotate(180deg); }
.zhokl-cc-cat-kcal {
    font-size: 12px;
    font-weight: 700;
    color: #0d2b6b;
    background: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.zhokl-cc-cat-body {
    display: none;
    padding: 12px 12px 16px;
    padding: 10px 10px 14px;
    background: linear-gradient(180deg, #f9fbff 0%, #f4f7ff 100%);
}
.zhokl-cc-cat.open .zhokl-cc-cat-body { display: block; }

/* ── Рядок продукту ── */
.zhokl-cc-item {
    display: grid;
    grid-template-columns: 1fr 88px 90px;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid #e9eef9;
    border-radius: 10px;
    margin: 4px 0;
    background: #fff;
}
.zhokl-cc-item:last-child { border-bottom: none; }
.zhokl-cc-item-name { font-size: 15px; color: #2a3550; padding-left: 8px; }
.zhokl-cc-item-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #c0cce8;
    border-radius: 6px;
    font-size: 15px;
    text-align: right;
    outline: none;
    transition: border-color .15s, background .15s;
    color: #0d2b6b;
}
.zhokl-cc-item-input:focus { border-color: #0d2b6b; }
.zhokl-cc-item-input.has-value { background: #eef2fc; border-color: #0d2b6b; font-weight: 600; }
.zhokl-cc-item-kcal {
    font-size: 14px;
    font-weight: 600;
    color: #0d2b6b;
    text-align: right;
    white-space: nowrap;
}

/* ── Loading ── */
.zhokl-cc-loading {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 15px;
}

/* ── Mobile ── */
@media (max-width: 520px) {
    #zhokl-cc-modal-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px;
    }
    #zhokl-cc-modal-title,
    .zhokl-cc-menu-actions {
        flex: 0 0 100%;
    }
    .zhokl-cc-menu-actions {
        order: 3;
    }
    .zhokl-cc-head-btn {
        width: 100%;
    }
    #zhokl-cc-modal-body { padding: 14px 12px; }
    #zhokl-cc-modal-box { max-height: 95vh; }
    .zhokl-cc-item { grid-template-columns: 1fr 68px 74px; gap: 6px; padding: 8px 10px; }
    .zhokl-cc-item-name { font-size: 14px; }
    .zhokl-cc-item-input { font-size: 14px; padding: 6px 8px; }
    .zhokl-cc-item-kcal { display: block; font-size: 12px; }
    .zhokl-cc-search-input { padding: 10px 12px; }
}

@media (min-width: 1200px) {
    #zhokl-cc-modal-box { max-width: 1360px; }
    #zhokl-cc-modal-body { padding: 26px 30px; }
}