/* CandyFitt Platform - Sidebar Navigation */

/* === Картки курсів Tutor LMS - прибрати рамку, залишити тільки тінь === */
/* Перебиваємо .tutor-card:not(.tutor-no-border){border:1px solid ...} */
.tutor-card,
.tutor-card:not(.tutor-no-border),
.tutor-course-card,
.tutor-course-card:not(.tutor-no-border),
#cf-main-content .tutor-card,
body.cf-has-sidebar .tutor-card,
body .tutor-frontend-dashboard .tutor-card {
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    overflow: hidden;
}
.tutor-card:hover,
.tutor-card:not(.tutor-no-border):hover,
.tutor-course-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-2px);
    transition: box-shadow 0.2s, transform 0.2s;
}

/* === Сітка курсів - запобігти обрізанню останньої картки === */
#tutor-courses-container,
.tutor-dashboard-content-inner.enrolled-courses,
.cf-courses-grid {
    padding-bottom: 40px;
}
/* На мобілці - збільшений padding знизу + body padding (для тулбара браузера) */
@media (max-width: 768px) {
    #tutor-courses-container,
    .tutor-dashboard-content-inner.enrolled-courses,
    .cf-courses-grid,
    #cf-main-content {
        padding-bottom: 100px !important;
    }
    .tutor-dashboard,
    .tutor-frontend-dashboard {
        padding-bottom: 60px !important;
    }
}

/* === Dashboard wrapper (flex layout) === */
.cf-dashboard-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}

/* Якщо ліве меню Tutor приховано - правий col-lg-9 на повну ширину */
.tutor-frontend-dashboard-maincontent > .tutor-col-12.tutor-col-md-4.tutor-col-lg-3 {
    display: none !important;
}
.tutor-frontend-dashboard-maincontent > .tutor-col-12.tutor-col-md-8.tutor-col-lg-9 {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* === Standalone wrapper (sidebar на sub-pages кабінету через wp_body_open) === */
/* Sidebar fixed ЗЛІВА, в тій самій позиції що і на головній dashboard */
@media (min-width: 769px) {
    .cf-sidebar-standalone-wrapper {
        position: fixed;
        top: 115px;
        /* Розраховуємо: (viewport - astra-container 1240px) / 2 + 32px (astra padding + tutor container)
           щоб sidebar був на тій самій позиції що і на головній dashboard (132px при 1440px viewport) */
        left: max(20px, calc((100vw - 1240px) / 2 + 32px));
        width: 280px;
        z-index: 50;
    }
    body.admin-bar .cf-sidebar-standalone-wrapper {
        top: 147px;
    }
    .cf-sidebar-standalone-wrapper .cf-sidebar {
        position: static;
        width: 100%;
    }
    /* Padding основного контенту щоб не перекривалось fixed sidebar (B1)
       Tutor LMS dashboard */
    body.cf-has-sidebar:has(.cf-sidebar-standalone-wrapper) .tutor-dashboard,
    body.cf-has-sidebar:has(.cf-sidebar-standalone-wrapper) .tutor-dashboard-content {
        padding-left: 310px;
    }
    /* /cart, /checkout, /product: sidebar скрыт, открывается бургером (B1) */
    .cf-sidebar-standalone-wrapper {
        display: none;
    }
    body.cf-sidebar-overlay-active .cf-sidebar-standalone-wrapper {
        display: block;
    }
    /* /dashboard/settings, /dashboard/purchase_history и др: sidebar всегда виден (B1) */
    body.cf-sidebar-dashboard .cf-sidebar-standalone-wrapper {
        display: block;
    }
}
@media (max-width: 768px) {
    .cf-sidebar-standalone-wrapper {
        position: static;
    }
}

#cf-main-content {
    flex: 1;
    min-width: 0;
}

/* === Sidebar === */
.cf-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    /* Враховуємо висоту km-header (101px) + admin-bar (32px якщо є) + gap */
    top: 115px;
    max-height: calc(100vh - 135px);
    overflow-y: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 10px 0;
}

/* Якщо залогінений з admin bar (admin-bar class додається WP) */
body.admin-bar .cf-sidebar {
    top: 147px;
    max-height: calc(100vh - 167px);
}
@media (max-width: 782px) {
    body.admin-bar .cf-sidebar {
        top: 46px;
        max-height: calc(100vh - 66px);
    }
}

.cf-sidebar-nav {
    display: flex;
    flex-direction: column;
}

/* === Вкладка (tab header) === */
.cf-tab-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: left;
    transition: background 0.15s;
    text-decoration: none;
}

.cf-tab-header:hover {
    background: #f5f5f5;
}

.cf-tab-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.cf-tab-label {
    flex: 1;
}

.cf-tab-arrow {
    flex-shrink: 0;
    transition: transform 0.2s;
    opacity: 0.5;
}

.cf-tab-open > .cf-tab-header {
    color: #333;
    background: #f8f8f8;
}

.cf-tab-open > .cf-tab-header .cf-tab-arrow {
    transform: rotate(180deg);
}

/* === Підвкладки (subtabs) === */
.cf-subtabs {
    display: none;
    flex-direction: column;
    padding: 0 0 6px 0;
}

.cf-tab-open > .cf-subtabs {
    display: flex;
}

.cf-subtab-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 8px 46px;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.cf-subtab-link:hover {
    background: #f8f8f8;
    color: #333;
}

.cf-subtab-link.cf-subtab-active {
    background: #fef2f2;
    color: #FE152D;
    border-left-color: #FE152D;
    font-weight: 600;
}

.cf-subtab-label {
    flex: 1;
}

/* === Badge (непрочитані) === */
.cf-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #FE152D;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    flex-shrink: 0;
}

/* === Розіграші (внизу sidebar) === */
.cf-tab-giveaway {
    margin-top: auto;
    border-top: 1px solid #eee;
    padding-top: 6px;
}

.cf-tab-giveaway .cf-tab-header-link {
    color: #FE152D;
}

/* === Loading / Error states === */
/* div.cf-loading - тільки для контейнерів (не buttons/inputs) */
div.cf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
    width: 100%;
    text-align: center;
    min-height: 200px;
    box-sizing: border-box;
}

/* На кнопках/інпутах cf-loading - просто disabled-стейт без розширення */
button.cf-loading,
input.cf-loading,
.cf-btn-like.cf-loading,
.cf-comment-input.cf-loading,
.cf-btn-bookmark.cf-loading {
    opacity: 0.6;
    pointer-events: none;
    min-height: 0 !important;
    padding: inherit;
    width: auto !important;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.cf-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #FE152D;
    border-radius: 50%;
    animation: cf-spin 0.6s linear infinite;
    margin: 0 auto 10px auto;
}

@keyframes cf-spin {
    to { transform: rotate(360deg); }
}

.cf-error {
    padding: 20px;
    text-align: center;
    color: #e53935;
}

/* === Мобільна кнопка toggle === */
.cf-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #FE152D;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(254, 21, 45, 0.3);
    align-items: center;
    justify-content: center;
}

.cf-sidebar-close {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 4px;
}

/* === Мобільна версія (< 768px) === */
@media (max-width: 768px) {
    .cf-dashboard-wrapper {
        display: block !important;
    }

    /* Tutor LMS grid - повна ширина на мобілці */
    .tutor-frontend-dashboard-maincontent > .tutor-col-12,
    .tutor-frontend-dashboard-maincontent > [class*="tutor-col-md"],
    .tutor-frontend-dashboard-maincontent > [class*="tutor-col-lg"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    /* Tutor sidebar навігація (ліве меню) - прибрати на мобілці */
    .tutor-frontend-dashboard-maincontent > .tutor-col-12.tutor-col-md-4.tutor-col-lg-3 {
        display: none !important;
    }

    .cf-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        max-height: 100vh;
        z-index: 10000;
        border-radius: 0;
        padding-top: 50px;
        overflow-y: auto;
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.25s ease, visibility 0.25s;
        /* Виключити з flex flow - не впливати на ширину main content */
        flex: 0 0 0px !important;
        min-width: 0 !important;
    }

    /* Main content на повну ширину */
    #cf-main-content {
        width: 100% !important;
        flex: 1 1 100% !important;
        min-width: 0;
    }

    .cf-sidebar.cf-sidebar-open {
        transform: translateX(0);
        visibility: visible;
    }

    .cf-sidebar-toggle {
        display: flex;
    }

    .cf-sidebar-close {
        display: block;
    }

    /* Body scroll lock при открытом sidebar */
    body.cf-sidebar-overlay-active {
        overflow: hidden;
    }

    /* Overlay на основному контенті */
    body.cf-sidebar-overlay-active::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
    }
}

/* === Аватар і автор === */
.cf-author-block {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cf-author-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.cf-author-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.cf-post-date {
    font-size: 12px;
    color: #999;
}

.cf-avatar {
    border-radius: 50%;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center center;
}

/* Bug #2 (19.05.2026): глобальний фiкс розтягнутих аватарок у чатi/форумi/коментарях.
   get_avatar() ставить inline width/height однаковi, але CSS object-fit за замовчуванням
   = fill (розтягує). Тому фото 3:4 виглядало овальним. */
img.cf-msg-avatar,
img.cf-lf-avatar,
.cf-mobile-user-avatar,
.cf-author-avatar,
.cf-comment-author img,
.cf-forum img.avatar,
.cf-msg img.avatar {
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 50%;
}

/* === Іконка закладок в хедері === */
.km-bookmarks-icon {
    display: inline-flex;
    align-items: center;
    color: inherit;
    margin-right: 8px;
}

/* === Scrollbar (sidebar) === */
.cf-sidebar::-webkit-scrollbar {
    width: 4px;
}

.cf-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.cf-sidebar::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.cf-sidebar::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* === Мобільні блоки в sidebar (пошук, повідомлення, збережене, сторінки, аватар) === */
.cf-mobile-only {
    display: none;
}

/* Hamburger зліва - прихований на десктопі */
.cf-mobile-hamburger {
    display: none;
}

.cf-mobile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}

.cf-mobile-link:hover {
    background: #f5f5f5;
}

.cf-mobile-link svg {
    flex-shrink: 0;
    opacity: 0.6;
}

/* Badge кількості (для Повідомлень) */
.cf-mobile-link .cf-mobile-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #FE152D;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.cf-mobile-divider {
    height: 1px;
    background: #eee;
    margin: 6px 0;
}

/* Аватар юзера (мобільний) */
.cf-mobile-user {
    margin-top: auto;
}

.cf-mobile-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}

.cf-mobile-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cf-mobile-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.cf-mobile-user-links {
    display: flex;
    flex-direction: column;
    padding: 0 14px 10px;
}

.cf-mobile-user-links a {
    padding: 6px 0 6px 46px;
    color: #666;
    text-decoration: none;
    font-size: 13px;
}

.cf-mobile-user-links a:hover {
    color: #FE152D;
}

/* === Пошук overlay === */
.cf-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 10002;
    flex-direction: column;
}

.cf-search-overlay.cf-search-open {
    display: flex;
}

.cf-search-overlay-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
}

.cf-search-overlay-header input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 6px 0;
    background: transparent;
}

.cf-search-cancel {
    background: none;
    border: none;
    color: #FE152D;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.cf-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cf-search-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.cf-search-empty p {
    margin-top: 10px;
    font-size: 14px;
}

/* === Мобільний хедер: hamburger зліва, лого центр, кабінет+корзина справа === */
@media (max-width: 768px) {
    /* Показати мобільні блоки в sidebar */
    .cf-mobile-only {
        display: block;
    }

    /* Sidebar nav як flex column для аватара внизу */
    .cf-sidebar-nav {
        min-height: calc(100vh - 50px);
    }

    /* Хедер: 3 колонки - hamburger | лого | cart+cabinet */
    .km-header--secondary .km-header-inner {
        display: flex;
        align-items: center;
        padding: 0 12px;
        height: 56px;
    }

    /* Стандартний hamburger Astra - прибрати ТІЛЬКИ для залогінених (наш CF hamburger замість нього) */
    body.logged-in .km-header--secondary .km-hamburger,
    body.logged-in .km-header--primary .km-hamburger,
    body.logged-in #km-hamburger-secondary,
    body.logged-in #km-hamburger-primary {
        display: none !important;
    }
    /* Для незалогінених на мобілці primary - показати hamburger */
    body:not(.logged-in) .km-header--primary .km-hamburger,
    body:not(.logged-in) #km-hamburger-primary {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        padding: 8px;
        background: none;
        border: none;
        cursor: pointer;
    }
    body:not(.logged-in) .km-hamburger span {
        width: 22px;
        height: 2px;
        background: #111;
        display: block;
    }

    /* Приховати зайве в хедері тільки для залогінених */
    body.logged-in .km-header--secondary .km-nav-left,
    body.logged-in .km-header--secondary .km-bookmarks-icon,
    body.logged-in .km-header--secondary .tutor-notification-wrapper,
    body.logged-in .km-header--secondary .tutor-user-profile-menu,
    body.logged-in .km-header--secondary .wc-account-menu-wrapper,
    body.logged-in .km-header--secondary .wc-acc-wrapper,
    body.logged-in .km-header--secondary [class*="account_menu"],
    body.logged-in .km-header--secondary .km-nav-right > :not(.km-cart-wrapper) {
        display: none !important;
    }
    body.logged-in .km-header--secondary .km-cart-wrapper {
        display: flex !important;
    }
    /* Для незалогінених: показати кнопку Увійти */
    body:not(.logged-in) .km-header--secondary .wc-acc-wrapper,
    body:not(.logged-in) .km-header--secondary .wc-account-menu-wrapper {
        display: flex !important;
    }
    body:not(.logged-in) .km-header--secondary .wc-acc-wrapper a,
    body:not(.logged-in) .km-header--secondary .wc-account-menu-wrapper a {
        font-size: 12px !important;
        padding: 4px 8px !important;
        white-space: nowrap !important;
    }

    /* Лого - абсолютно по центру viewport, незалежно від ширини burger/nav-right (F1) */
    .km-header--secondary .km-header-inner,
    .km-header--primary .km-header-inner {
        position: relative;
    }
    .km-header--secondary .km-logo,
    .km-header--primary .km-logo {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        justify-content: center;
        align-items: center;
        flex: 0 0 auto;
        pointer-events: auto;
        z-index: 2;
    }
    /* Burger та nav-right залишаються по краях */
    .km-header--secondary .cf-mobile-hamburger,
    .km-header--primary .cf-mobile-hamburger {
        margin-right: auto;
    }
    .km-header--secondary .km-nav-right,
    .km-header--primary .km-nav-right {
        margin-left: auto;
    }

    /* П1 fix5 (28.04.2026): Настя сказала "немного больше, как было".
       Раніше було 40px висоти, я fix4 зменшив до 33px - стало мало.
       Збільшуємо хедер до 64px (вiльне мiсце 48px) + лого 48px висоти.
       Картинка 1533x2560, ratio 1:1.67 → max-width 28px дає висоту ~47px. */
    .km-header .km-logo .custom-logo-link img,
    .km-header--secondary .km-logo .custom-logo-link img,
    .km-header--primary .km-logo .custom-logo-link img {
        max-width: 28px !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain;
    }
    /* Fallback для випадку без custom-logo (img напряму в .km-logo a) */
    .km-header .km-logo > a > img {
        max-width: 28px !important;
        width: auto !important;
        height: auto !important;
    }

    /* Правий блок - тільки корзина */
    .km-header--secondary .km-nav-right {
        gap: 12px;
    }

    /* Приховати Tutor LMS хедер елементи на мобілці */
    .tutor-header-right-side > *:not(.tutor-header-cart-wrapper),
    .tutor-notification-icon-wrapper,
    .tutor-user-profile-menu,
    .tutor-header-profile-menu,
    [class*="tutor-header-notification"],
    [class*="tutor-header-user"],
    .tutor-header-right-side .tutor-mr-16,
    .tutor-header-right-side .tutor-mr-24 {
        display: none !important;
    }

    /* Кнопка hamburger зліва (додається через JS) */
    .cf-mobile-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        color: #111;
        flex-shrink: 0;
    }

    /* Приховати стандартне мобільне меню ТІЛЬКИ для залогінених (наш sidebar замість нього) */
    body.logged-in #km-mobile-menu-secondary,
    body.logged-in #km-mobile-menu-primary,
    body.logged-in .km-mobile-menu,
    body.logged-in .ast-mobile-header-wrap,
    body.logged-in .main-header-bar-navigation,
    body.logged-in .ast-mobile-popup-drawer,
    body.logged-in .main-header-menu,
    body.logged-in .menu-toggle {
        display: none !important;
    }
    /* Стандартний Astra hamburger - повністю прибрати */
    body.logged-in .ast-mobile-menu-buttons,
    body.logged-in .ast-builder-menu-mobile {
        display: none !important;
    }

    /* Сховати нашу окрему кнопку toggle */
    .cf-sidebar-toggle {
        display: none !important;
    }

    /* П1 fix5 (28.04.2026): хедер 64px (раніше 44px) щоб помістити лого 48px.
       Настя писала "можно на мобилке саму рамку хедера немного увеличить".
       Старе правило для лого видалено - воно дублювало fix5 вище і
       не застосовувалось через нижчу специфічність. */
    .km-header--secondary .km-header-inner,
    .km-header--primary .km-header-inner {
        min-height: 64px;
        height: auto;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    /* Правка 6: Корзину трохи вліво */
    .km-header--secondary .km-cart-wrapper {
        margin-right: 4px;
    }

    /* Правка 7: Корзина dropdown - вмістити у viewport */
    .km-cart-dropdown,
    .km-header--secondary .km-cart-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        border-radius: 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 9999;
    }
    .km-cart-dropdown .woocommerce-mini-cart-item {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
    }
    .km-cart-dropdown .woocommerce-mini-cart-item img {
        width: 50px;
        height: 50px;
        object-fit: cover;
        flex-shrink: 0;
    }
    .km-cart-dropdown .woocommerce-mini-cart-item a:not(.remove) {
        font-size: 13px;
        line-height: 1.3;
        word-break: break-word;
    }
}

/* === Правка 5: Хедер ДО входу (мобілка) === */
@media (max-width: 768px) {
    .km-header--primary .km-header-inner {
        display: flex;
        align-items: center;
        padding: 4px 12px;
        min-height: 48px;
    }
    /* Прибрати текстове меню зліва */
    .km-header--primary .km-nav-left {
        display: none !important;
    }
    /* Лого по центру */
    .km-header--primary .km-logo {
        flex: 1;
        display: flex;
        justify-content: center;
    }
    .km-header--primary .km-logo img {
        max-height: 28px;
        height: auto;
    }
    /* Правий блок - компактний */
    .km-header--primary .km-nav-right {
        flex-shrink: 0;
        gap: 8px;
    }
    /* Кнопка Увійти - повністю видима */
    .km-header--primary .km-nav-right .wc-account-menu-wrapper,
    .km-header--primary .km-nav-right [class*="account"] {
        white-space: nowrap;
    }
    .km-header--primary .km-nav-right a {
        font-size: 12px;
        padding: 4px 8px;
    }
    /* Стандартне мобільне меню Astra primary - прибрати ТІЛЬКИ для залогінених */
    body.logged-in #km-mobile-menu-primary {
        display: none !important;
    }
}

/* === Правка 8: Корзина ПК - вкладки === */
.woocommerce-cart .woocommerce .return-to-shop,
.woocommerce-cart .km-header--secondary .km-nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* === Правка 14: Spinner по центру === */
.cf-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
}
.cf-loading .cf-spinner {
    margin: 0 auto;
}

/* === Спеціальні сторінки (notifications, bookmarks, my-courses, orders, shop) === */
.cf-special-page {
    padding: 10px 0;
}
.cf-special-page h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px;
    color: #333;
}

/* Повідомлення */
.cf-notifications-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cf-notification-item {
    padding: 12px 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
}
.cf-notification-unread {
    border-left: 3px solid #FE152D;
    background: #fff8f8;
}
.cf-notification-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}
.cf-notification-content {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}
.cf-notification-time {
    font-size: 11px;
    color: #999;
}

/* ═══ Уніфіковані картки курсів у вкладках sidebar (ТОЙ САМИЙ стиль що в Мої курси Tutor) ═══ */
.cf-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding: 0;
}
@media (max-width: 768px) {
    .cf-courses-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}
/* Progress bar для уніфікованої картки */
.cf-progress-track {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}
.cf-progress-fill {
    height: 100%;
    background: #FE152D;
    border-radius: 3px;
    transition: width 0.3s ease;
}
.cf-course-thumb-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
}
/* Кнопка "Продовжити навчання" - червона як в Tutor */
.cf-courses-grid .cf-btn-continue,
.cf-courses-grid .cf-btn-buy {
    background: #FE152D !important;
    border-color: #FE152D !important;
    color: #fff !important;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: background 0.2s;
}
.cf-courses-grid .cf-btn-continue:hover,
.cf-courses-grid .cf-btn-buy:hover {
    background: #d91023 !important;
    color: #fff !important;
}

/* Старі картки (cf-course-card) - залишаємо для зворотньої сумісності */
.cf-course-grid-legacy {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.cf-course-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}
.cf-course-thumb img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}
.cf-course-body {
    padding: 10px;
}
.cf-course-body h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 6px;
}
.cf-course-body h4 a {
    color: #333;
    text-decoration: none;
}
.cf-progress-bar {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}
.cf-progress-fill {
    height: 100%;
    background: #FE152D;
    border-radius: 2px;
}
.cf-progress-text {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    display: inline-block;
}

/* Замовлення */
.cf-orders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* P3 fix12 (28.04.2026): чистый refactor - mobile-first layout, все
   старые правила удалены. Логика: на любой ширине плашка на 2й строке
   снизу через grid-template-areas. На широком ПК (>1100px) inline. */
.cf-order-item {
    padding: 12px 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #eee;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "header total"
        "status status";
    column-gap: 12px;
    row-gap: 8px;
    align-items: center;
}
.cf-order-header {
    grid-area: header;
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
}
.cf-order-number {
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.cf-order-date {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}
.cf-order-status {
    grid-area: status;
    justify-self: start;
    font-size: 12px;
    padding: 4px 14px;
    border-radius: 12px;
    background: rgba(107,114,128,0.15);
    color: rgb(75,85,99);
    border: 1px solid rgba(107,114,128,0.4);
    font-weight: 500;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
    min-width: 180px;
}
.cf-status-completed { background: rgba(16,185,129,0.15); color: rgb(5,120,87); border-color: rgba(16,185,129,0.4); }
.cf-status-processing,
.cf-status-on-hold   { background: rgba(245,158,11,0.15); color: rgb(180,83,9); border-color: rgba(245,158,11,0.4); }
.cf-status-pending   { background: rgba(59,130,246,0.15); color: rgb(29,78,216); border-color: rgba(59,130,246,0.4); }
.cf-status-cancelled { background: rgba(107,114,128,0.15); color: rgb(75,85,99); border-color: rgba(107,114,128,0.4); }
.cf-status-refunded  { background: rgba(168,85,247,0.15); color: rgb(126,34,206); border-color: rgba(168,85,247,0.4); }
.cf-status-failed    { background: rgba(220,38,38,0.15); color: rgb(153,27,27); border-color: rgba(220,38,38,0.4); }
.cf-order-total {
    grid-area: total;
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
}
/* На широком ПК (>1100px) status переезжает в одну строку с header+total.
   Фиксированные ширины 200px/130px чтобы плашки и цены строго в столбике. */
@media (min-width: 1101px) {
    .cf-order-item {
        grid-template-columns: 1fr 200px 130px;
        grid-template-areas: "header status total";
    }
    .cf-order-status {
        justify-self: stretch;
        min-width: 0;
    }
}

/* Магазин курсів */
/* WooCommerce-стиль карточки "Курси CandyFitt" */
.cf-wc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.cf-wc-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}
.cf-wc-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.cf-wc-card-thumb {
    position: relative;
    overflow: hidden;
}
.cf-wc-card-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.cf-wc-card:hover .cf-wc-card-thumb img {
    transform: scale(1.03);
}
.cf-wc-card-placeholder {
    width: 100%;
    height: 200px;
    background: #f5f5f5;
}
.cf-wc-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.cf-wc-card-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 8px;
    line-height: 1.4;
}
.cf-wc-card-title a {
    color: #333;
    text-decoration: none;
}
.cf-wc-card-title a:hover {
    color: #FE152D;
}
.cf-wc-card-price {
    font-size: 15px;
    color: #FE152D;
    font-weight: 700;
    margin-bottom: 10px;
}
.cf-wc-card-price del {
    color: #999;
    font-weight: 400;
    font-size: 13px;
}
.cf-wc-card-price ins {
    text-decoration: none;
}
.cf-wc-btn {
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    margin-top: auto;
    transition: background 0.2s, transform 0.1s;
    border: none;
}
.cf-wc-btn:active {
    transform: scale(0.97);
}
/* P4 (28.04.2026): отступ между "Додати в кошик" и появляющейся после AJAX
   "Переглянути кошик" - запрос Насти на созвоне 23.04 [16:05] и в чате 28.04.
   Раньше кнопки слипались ("одна на другой висит"). 12px разделение. */
.cf-wc-card .added_to_cart {
    margin-top: 12px;
}
.cf-wc-btn-cart {
    background: #FE152D;
    color: #fff;
}
.cf-wc-btn-cart:hover {
    background: #e0112a;
    color: #fff;
}
.cf-wc-btn-buy {
    background: #333;
    color: #fff;
}
.cf-wc-btn-buy:hover {
    background: #555;
    color: #fff;
}

/* Чат опис */
.cf-chat-description {
    font-size: 12px;
    color: #888;
    margin: 2px 0 0;
    font-weight: 400;
}

/* Завантаження медіа в форумі */
.cf-media-uploading {
    opacity: 0.6;
    position: relative;
}
.cf-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #FE152D;
    animation: cf-upload-pulse 1s infinite;
}
@keyframes cf-upload-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* === Правка 18: WooCommerce шрифти (Курси CandyFitt) === */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2 {
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product a.button {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    background: #FE152D;
    color: #fff;
    border-radius: 6px;
    border: none;
    padding: 8px 16px;
}
.woocommerce ul.products li.product .button:hover {
    background: #d91225;
}
.woocommerce ul.products li.product .price {
    font-family: inherit;
    font-size: 14px;
}
.woocommerce ul.products li.product .price del {
    color: #999;
}
.woocommerce ul.products li.product .price ins {
    color: #FE152D;
    font-weight: 700;
    text-decoration: none;
}
.woocommerce ul.products li.product .onsale {
    font-family: inherit;
}

/* === Tutor LMS Settings Profile - мобільні правки === */
@media (max-width: 768px) {
    /* Прибрати обложку профілю (фіолетовий блок "ЗАВАНТАЖИТИ ЗОБРАЖЕННЯ ОБКЛАДИНКИ") */
    .tutor_cover_deleter,
    .tutor-profile-cover-area,
    [class*="tutor_cover"],
    [class*="tutor-cover"],
    [class*="cover-photo"],
    [class*="cover_photo"],
    .tutor-profile-cover-photo-upload,
    .tutor-dashboard-content-inner .tutor-mb-32:has(.tutor_cover_deleter) {
        display: none !important;
    }

    /* Прибрати "Майстерність/Рід занять" - через JS (див. candyfitt-platform.php) */

    /* Заборонити горизонтальний скролл */
    html, body,
    .tutor-dashboard-content,
    .tutor-dashboard-content-inner,
    .tutor-wrap,
    #tutor-single-entry-content,
    .tutor-row {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    /* Замітки та будь-який контент - не виходити за межі */
    .tutor-dashboard-content textarea,
    .tutor-dashboard-content .note-editor,
    .tutor-dashboard-content [class*="note"],
    .tutor-dashboard-content pre,
    .tutor-dashboard-content table,
    .tutor-dashboard-content-inner * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Профіль форма - на повну ширину */
    .tutor-dashboard-content-inner .tutor-row,
    .tutor-dashboard-content-inner .tutor-col-12 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    .tutor-dashboard-setting .tutor-profile-photo-wrapper img {
        max-width: 80px;
        max-height: 80px;
    }
}

/* === Фікс обрізання контенту по бокам на мобілці === */
@media (max-width: 768px) {
    /* WooCommerce карточки - не виходити за viewport */
    .woocommerce ul.products,
    .woocommerce .products,
    .woocommerce-page .products {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        box-sizing: border-box !important;
    }

    /* Загальна заборона overflow на всіх контейнерах */
    .site-content,
    .ast-container,
    .entry-content,
    #primary,
    #content,
    main,
    article {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    /* Кнопка "Увійти" - не обрізати */
    .km-header--primary .km-nav-right,
    .km-header--secondary .km-nav-right {
        flex-shrink: 0;
        overflow: visible;
        white-space: nowrap;
    }
    .km-header--primary .km-nav-right a,
    .km-header--primary .km-nav-right button,
    .km-header--secondary .km-nav-right a {
        font-size: 12px;
        padding: 4px 6px;
    }

    /* Хедер не обрізати - все вміщується */
    .km-header--primary .km-header-inner,
    .km-header--secondary .km-header-inner {
        overflow: visible !important;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    /* Лого ще компактніше щоб дати місце кнопкам */
    .km-header--primary .km-logo,
    .km-header--secondary .km-logo {
        min-width: 0;
        overflow: hidden;
    }
}

/* === Правки для незалогінених (до входу) === */
@media (max-width: 768px) {
    /* Кнопка Увійти - не обрізати, зменшити */
    .km-header--primary .km-nav-right {
        flex-shrink: 0 !important;
        gap: 6px !important;
    }
    .km-header--primary .km-nav-right a,
    .km-header--primary .km-nav-right .wc-account-menu-wrapper a {
        font-size: 11px !important;
        padding: 4px 8px !important;
        white-space: nowrap !important;
    }
    /* Лого для незалогінених - компактне */
    .km-header--primary .km-logo img {
        max-height: 28px !important;
    }
}

/* === WooCommerce продукти - біла рамка з тінню, без зовнішньої рамки === */
.woocommerce ul.products li.product {
    border: 1px solid #f0f0f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    outline: none !important;
    overflow: hidden;
}

/* === Збережене - відступ заголовка === */
.cf-special-page h3,
.cf-bookmarks-page .cf-bookmarks-title {
    margin-bottom: 20px !important;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* === Overflow поля - глобальний фікс === */
@media (max-width: 768px) {
    input, textarea, select, .tutor-form-control {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* === Глобальний фікс overflow на мобілці === */
@media (max-width: 768px) {
    /* Все контейнери - без overflow */
    html, body,
    .site-content, .ast-container, .entry-content,
    #primary, #content, main, article,
    .tutor-dashboard-content, .tutor-dashboard-content-inner,
    .tutor-wrap, .tutor-row, .tutor-container,
    .woocommerce, .woocommerce-page,
    #cf-main-content, .cf-dashboard-wrapper,
    .cf-special-page, .cf-bookmarks-page {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    /* Всі елементи форм */
    input, textarea, select, table, pre, code,
    .tutor-form-control, .woocommerce table {
        max-width: 100% !important;
        box-sizing: border-box !important;
        word-break: break-word;
    }

    /* Padding для контенту щоб не притискало до країв */
    #cf-main-content {
        padding: 0 10px !important;
    }
    .cf-special-page, .cf-bookmarks-page {
        padding: 0 5px;
    }
}

/* === Кнопка Увійти - повністю видима === */
@media (max-width: 768px) {
    /* Хедер primary - лого менше, місце для кнопки */
    .km-header--primary .km-logo {
        flex: 1;
        display: flex;
        justify-content: center;
        min-width: 0;
    }
    .km-header--primary .km-logo img {
        max-height: 24px !important;
        height: 24px !important;
    }
    /* Правий блок не обрізати */
    .km-header--primary .km-nav-right {
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center;
        gap: 6px;
    }
    /* Кнопка Увійти */
    .km-header--primary .km-nav-right .wc-account-menu-wrapper,
    .km-header--primary .km-nav-right .wc-account-menu-wrapper a,
    .km-header--primary .km-nav-right [class*="account"] a {
        font-size: 11px !important;
        padding: 4px 8px !important;
        white-space: nowrap !important;
        display: inline-block !important;
    }
}

/* === Корзина мобілка - текст не ламається, кнопки друг під другом === */
@media (max-width: 768px) {
    /* Сторінка корзини - товари */
    .woocommerce-cart .woocommerce-cart-form table.cart td,
    .woocommerce-cart .woocommerce-cart-form .product-name {
        word-break: break-word !important;
        font-size: 13px !important;
    }
    .woocommerce-cart .woocommerce-cart-form .product-thumbnail img {
        width: 50px !important;
        height: 50px !important;
        object-fit: cover;
    }
    
    /* Кнопки корзини - друг під другом, однакова ширина */
    .wc-proceed-to-checkout,
    .woocommerce .cart-collaterals .wc-proceed-to-checkout {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    .wc-proceed-to-checkout a.button,
    .wc-proceed-to-checkout .checkout-button {
        width: 100% !important;
        text-align: center !important;
        box-sizing: border-box !important;
        font-size: 13px !important;
        padding: 10px 16px !important;
    }

    /* Mini-cart dropdown - текст ширше */
    .km-cart-dropdown .woocommerce-mini-cart-item {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    .km-cart-dropdown .woocommerce-mini-cart-item img {
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0;
    }
    .km-cart-dropdown .woocommerce-mini-cart-item a:not(.remove) {
        font-size: 12px !important;
        line-height: 1.3 !important;
        word-break: break-word !important;
        flex: 1;
        min-width: 0;
    }
    /* Кнопки mini-cart друг під другом */
    .km-cart-dropdown .woocommerce-mini-cart__buttons,
    .widget_shopping_cart_content .woocommerce-mini-cart__buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
    }
    .km-cart-dropdown .woocommerce-mini-cart__buttons a,
    .widget_shopping_cart_content .woocommerce-mini-cart__buttons a {
        width: 100% !important;
        text-align: center !important;
        box-sizing: border-box !important;
        font-size: 12px !important;
        padding: 8px !important;
    }
}

/* P3 fix12: блок "Замовлення - статус" удален, всё в основном блоке выше. */

/* === АГРЕСИВНИЙ МОБІЛЬНИЙ ФІКС (всі залишені проблеми) === */
@media (max-width: 768px) {

    /* --- Хедер primary (до входу): залишити корзину + Увійти + km-login-btn--mobile --- */
    .km-header--primary .km-nav-right > *:not(.km-cart-wrapper):not(.wc-acc-wrapper):not(.wc-account-menu-wrapper):not(.km-login-btn--mobile) {
        display: none !important;
    }
    .km-header--primary .km-cart-wrapper {
        display: flex !important;
    }
    /* km-login-btn--mobile - наша кнопка Увійти, прямокутна рамка біля корзини */
    .km-header--primary .km-nav-right .km-login-btn--mobile {
        display: inline-flex !important;
        padding: 6px 14px !important;
        font-size: 13px !important;
        align-items: center;
        line-height: 1;
        border-radius: 6px;
        background: #FE152D;
        color: #fff !important;
    }
    /* Приховати дублюючий wc_account_menu (бо вже є km-login-btn--mobile) */
    .km-header--primary .wc-acc-wrapper,
    .km-header--primary .wc-account-menu-wrapper {
        display: none !important;
    }
    /* Прибрати іконку user, залишити текст "Увійти" */
    .km-header--primary .wc-acc-wrapper .acc-ico {
        display: none !important;
    }
    .km-header--primary .wc-acc-trigger {
        font-size: 12px !important;
        padding: 4px 10px !important;
        background: #FE152D;
        color: #fff !important;
        border-radius: 6px;
        text-decoration: none !important;
        white-space: nowrap;
    }

    /* --- Налаштування профілю: всі поля на повну ширину --- */
    .tutor-dashboard-content-inner .tutor-row > [class*="tutor-col"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
    }
    .tutor-dashboard-content-inner .tutor-form-control,
    .tutor-dashboard-content-inner select,
    .tutor-dashboard-content-inner textarea,
    .tutor-dashboard-content-inner input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    /* Часовий пояс select */
    .tutor-dashboard-content-inner select {
        appearance: auto;
    }

    /* --- Корисна інформація: низ не обрізати --- */
    .cf-info-grid {
        padding-bottom: 20px !important;
    }
    .cf-info-card:last-child {
        margin-bottom: 20px;
    }

    /* --- Збережене: текст не виходить, блок вужчий --- */
    .cf-bookmarks-page .cf-bookmark-item {
        max-width: 100% !important;
        overflow: hidden;
        padding-right: 40px !important;
        box-sizing: border-box;
    }
    .cf-bookmarks-page .cf-bookmark-item a,
    .cf-bookmarks-page .cf-bookmark-item span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
        max-width: calc(100vw - 120px);
    }

    /* --- Мої курси: блоки не обрізати --- */
    .tutor-courses-container,
    .tutor-grid,
    .tutor-grid-3,
    #tutor-courses-grid,
    #tutor-courses-container,
    .tutor-dashboard-content-inner .tutor-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    .tutor-grid > .tutor-col-12,
    .tutor-grid > [class*="tutor-col"],
    .tutor-grid-3 > * {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
    }
    /* Tutor course card */
    .tutor-card,
    .tutor-course-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* --- Корзина: текст ширше --- */
    .woocommerce-cart .shop_table td.product-name {
        word-break: break-word !important;
        max-width: 150px !important;
    }
    .woocommerce-cart .shop_table td.product-thumbnail img {
        width: 50px !important;
        height: auto !important;
    }
    .woocommerce-cart .shop_table {
        font-size: 13px !important;
    }
}

/* === Сторінка кошику - текст товарів ширше === */
@media (max-width: 768px) {
    .woocommerce-cart .shop_table {
        width: 100% !important;
        table-layout: fixed !important;
    }
    .woocommerce-cart .shop_table td.product-thumbnail {
        width: 60px !important;
        padding: 5px !important;
    }
    .woocommerce-cart .shop_table td.product-thumbnail img {
        width: 50px !important;
        height: 50px !important;
        object-fit: cover !important;
    }
    .woocommerce-cart .shop_table td.product-name {
        word-break: break-word !important;
        font-size: 13px !important;
        line-height: 1.3 !important;
        max-width: none !important;
    }
    .woocommerce-cart .shop_table td.product-price,
    .woocommerce-cart .shop_table td.product-subtotal {
        white-space: nowrap;
        font-size: 13px !important;
        width: 80px !important;
    }
    .woocommerce-cart .shop_table td.product-remove {
        width: 30px !important;
    }
}

/* === ФІНАЛЬНИЙ ФІКС: кнопка Увійти для незалогінених === */
@media (max-width: 768px) {
    /* Лого компактне (перебиває ВСЕ) */
    .km-header .km-logo img,
    .km-header .km-logo .custom-logo,
    .km-header--secondary .km-logo img,
    .km-header--primary .km-logo img {
        max-height: 28px !important;
        height: 28px !important;
        width: auto !important;
    }

    /* Для незалогінених у мобільному хедері - ховаємо WooCommerce account dropdown
       (замість нього вже є окрема червона кнопка .km-login-btn--mobile) */
    body:not(.logged-in) .km-header--primary .wc-acc-wrapper,
    body:not(.logged-in) .km-header--primary .wc-account-menu-wrapper {
        display: none !important;
    }
    /* Ховаємо ДРУГИЙ гамбургер (зліва вже є cf-mobile-hamburger що відкриває новий sidebar) */
    body:not(.logged-in) .km-header--primary #km-hamburger-primary {
        display: none !important;
    }
    /* Червона кнопка "Увійти" біля корзини - повна форма без обрізання */
    body:not(.logged-in) .km-header--primary .km-login-btn--mobile {
        display: inline-flex !important;
        align-items: center;
        background: #FE152D;
        color: #fff !important;
        font-size: 13px !important;
        font-weight: 600;
        padding: 6px 14px !important;
        border-radius: 6px;
        text-decoration: none;
        white-space: nowrap;
        line-height: 1;
        flex-shrink: 0;
    }
}
