/*
 * Candan Market - Modern Header
 * Bu dosyayı sitenin ana CSS dosyasından sonra ekleyin.
 */

body.candan-modern-header-active #header {
    display: none !important;
}

body.cmh-mobile-category-open {
    overflow: hidden !important;
}

#candan-modern-header,
#candan-modern-header *,
#cmh-mobile-category-modal,
#cmh-mobile-category-modal * {
    box-sizing: border-box;
}

#candan-modern-header {
    position: relative;
    z-index: 99990;
    width: 100%;
    color: #10213b;
    background: #fff;
    box-shadow: 0 5px 25px rgba(15, 49, 80, 0.08);
    font-family: Poppins, Inter, Arial, sans-serif;
}

#candan-modern-header a {
    text-decoration: none;
}

#candan-modern-header svg,
#cmh-mobile-category-modal svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cmh-container {
    width: min(1400px, calc(100% - 48px));
    margin: 0 auto;
}

/* Üst bilgi bandı */
.cmh-topbar {
    min-height: 44px;
    color: #fff;
    background: linear-gradient(100deg, #087bb7 0%, #168fa4 55%, #2cab65 100%);
}

.cmh-topbar-inner {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
}

.cmh-topbar-left,
.cmh-topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.cmh-topbar a {
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0.96;
    transition: opacity 0.2s ease;
}

.cmh-topbar a:hover {
    color: #fff;
    opacity: 0.75;
}

.cmh-topbar svg {
    width: 18px !important;
    height: 18px !important;
}

.cmh-topbar-right a + a {
    position: relative;
}

.cmh-topbar-right a + a::before {
    content: "";
    position: absolute;
    left: -13px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
}

/* Logo, arama ve aksiyonlar */
.cmh-middle {
    padding: 26px 0;
    background: #fff;
}

.cmh-middle-inner {
    display: grid;
    grid-template-columns: minmax(220px, 270px) minmax(350px, 1fr) auto;
    align-items: center;
    gap: 42px;
}

.cmh-logo {
    display: flex;
    align-items: center;
}

.cmh-logo img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 92px;
    object-fit: contain;
}

.cmh-search {
    display: flex;
    height: 56px;
    border: 2px solid #1285bc;
    border-radius: 17px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 7px 22px rgba(11, 114, 168, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cmh-search:focus-within {
    border-color: #087bb7;
    box-shadow: 0 9px 28px rgba(11, 114, 168, 0.17);
}

.cmh-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 20px;
    border: 0;
    outline: 0;
    color: #17243a;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
}

.cmh-search input::placeholder {
    color: #8c949f;
}

.cmh-search button {
    flex: 0 0 72px;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #fff;
    background: linear-gradient(135deg, #087bb7, #1592c1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.cmh-search button:hover {
    filter: brightness(0.92);
}

.cmh-search button svg {
    width: 25px !important;
    height: 25px !important;
    stroke-width: 2.2 !important;
}

.cmh-actions {
    display: flex;
    align-items: stretch;
}

.cmh-action-wrap {
    position: relative;
    display: flex;
}

.cmh-action {
    min-width: 103px;
    padding: 4px 18px;
    border: 0;
    border-left: 1px solid #e4e8ed;
    outline: 0;
    color: #17243a;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s ease, transform 0.2s ease;
}

.cmh-action-wrap:first-child .cmh-action {
    border-left: 0;
}

.cmh-action:hover {
    color: #087bb7;
    transform: translateY(-2px);
}

.cmh-action-icon {
    position: relative;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmh-action-whatsapp {
    color: #20a85a;
}

.cmh-action-whatsapp:hover {
    color: #168c49;
}

.cmh-cart-badge {
    position: absolute;
    top: -8px;
    right: -11px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 20px;
    color: #fff;
    background: #087bb7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(8, 123, 183, 0.25);
}

/* Hesabım açılır menüsü */
.cmh-account-panel {
    position: absolute;
    top: calc(100% + 15px);
    right: 0;
    z-index: 999999;
    width: 220px;
    padding: 9px;
    border: 1px solid #e4e9ee;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(13, 45, 75, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.cmh-action-wrap.cmh-account-open .cmh-account-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cmh-account-panel a {
    display: block;
    padding: 11px 13px;
    border-radius: 9px;
    color: #17243a;
    font-size: 13px;
}

.cmh-account-panel a:hover {
    color: #087bb7;
    background: #eef8fc;
}

/* Alt kategori bandı */
.cmh-nav-placeholder {
    display: none;
    width: 100%;
    height: 0;
}

.cmh-nav {
    position: relative;
    min-height: 68px;
    border-top: 1px solid #edf0f3;
    background: #fff;
}

.cmh-nav-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 34px;
}

.cmh-cat-placeholder {
    flex: 0 0 275px;
    height: 52px;
}

.cmh-cat-wrap {
    position: relative;
    width: 275px;
    height: 52px;
}

.cmh-cat-button {
    width: 100%;
    height: 52px;
    padding: 0 20px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(135deg, #087bb7, #1697bd);
    display: flex;
    align-items: center;
    gap: 13px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    box-shadow: 0 9px 22px rgba(8, 123, 183, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cmh-cat-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 27px rgba(8, 123, 183, 0.27);
}

.cmh-cat-button .cmh-chevron {
    margin-left: auto;
    display: flex;
    transition: transform 0.2s ease;
}

.cmh-cat-wrap.cmh-cat-open .cmh-chevron {
    transform: rotate(180deg);
}

.cmh-cat-panel {
    position: absolute;
    top: calc(100% + 9px);
    left: 0;
    z-index: 999999;
    width: 330px;
    max-height: min(580px, calc(100vh - 90px));
    padding: 10px;
    border: 1px solid #e4e9ee;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 22px 55px rgba(13, 45, 75, 0.2);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.cmh-cat-wrap.cmh-cat-open .cmh-cat-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cmh-cat-panel a {
    min-height: 43px;
    padding: 10px 12px;
    border-radius: 9px;
    color: #17243a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 13px;
    font-weight: 500;
}

.cmh-cat-panel a:hover {
    color: #087bb7;
    background: #eef8fc;
}

.cmh-cat-panel b {
    color: #9aa4af;
    font-size: 19px;
    font-weight: 400;
}

.cmh-empty {
    padding: 14px;
    color: #687383;
    font-size: 12px;
    line-height: 1.6;
}

/* Dinamik ana/alt kategori ağacı */
.cmh-dynamic-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cmh-dynamic-item {
    position: relative;
    display: block;
    width: 100%;
}

.cmh-dynamic-item[hidden] {
    display: none !important;
}

.cmh-dynamic-link,
.cmh-dynamic-toggle {
    width: 100%;
    min-height: 37px !important;
    padding: 7px 10px !important;
    border: 0;
    border-radius: 8px !important;
    color: #172b48;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: inherit;
    font-size: 12px !important;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.cmh-dynamic-link:hover,
.cmh-dynamic-toggle:hover {
    color: #087bb7;
    background: #eef8fc;
}

.cmh-dynamic-chevron {
    display: flex;
    transition: transform 0.2s ease;
}

.cmh-dynamic-chevron svg {
    width: 15px !important;
    height: 15px !important;
}

.cmh-dynamic-children {
    display: none;
}

@media (min-width: 768px) {
    #candan-modern-header .cmh-cat-panel {
        width: 300px !important;
        max-height: none !important;
        padding: 7px !important;
        border-radius: 12px !important;
        overflow: visible !important;
    }

    .cmh-dynamic-tree,
    .cmh-dynamic-item {
        overflow: visible !important;
    }

    .cmh-dynamic-parent > .cmh-dynamic-children {
        position: absolute !important;
        top: -7px !important;
        left: calc(100% - 1px) !important;
        right: auto !important;
        z-index: 1000000;
        display: block !important;
        width: 285px !important;
        margin: 0 !important;
        padding: 7px !important;
        border: 1px solid #e3e9ee;
        border-radius: 12px !important;
        background: #fff;
        box-shadow: 0 20px 50px rgba(13, 45, 75, 0.2);
        overflow: visible !important;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(-4px);
        transition:
            opacity 0.2s ease,
            visibility 0.2s ease,
            transform 0.2s ease;
    }

    .cmh-dynamic-parent:hover > .cmh-dynamic-children,
    .cmh-dynamic-parent.cmh-dynamic-open > .cmh-dynamic-children {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
    }

    /* Paneller arasındaki mouse geçiş köprüsü */
    .cmh-dynamic-parent::after {
        content: "";
        position: absolute;
        top: 0;
        left: 100%;
        z-index: 1000001;
        width: 12px;
        height: 100%;
        background: transparent;
    }

    .cmh-dynamic-chevron {
        transform: rotate(-90deg) !important;
    }

    .cmh-dynamic-parent.cmh-flyout-left > .cmh-dynamic-children {
        right: calc(100% - 1px) !important;
        left: auto !important;
        transform: translateX(4px);
    }

    .cmh-dynamic-parent.cmh-flyout-left:hover > .cmh-dynamic-children,
    .cmh-dynamic-parent.cmh-flyout-left.cmh-dynamic-open > .cmh-dynamic-children {
        transform: translateX(0);
    }

    .cmh-dynamic-parent.cmh-flyout-left::after {
        right: 100%;
        left: auto;
    }

    .cmh-dynamic-children .cmh-dynamic-link,
    .cmh-dynamic-children .cmh-dynamic-toggle {
        min-height: 32px !important;
        padding: 5px 9px !important;
        font-size: 11.5px !important;
    }
}

@media (max-width: 767px) {
    .cmh-dynamic-link,
    .cmh-dynamic-toggle {
        min-height: 42px !important;
        padding: 8px 10px !important;
    }

    .cmh-dynamic-chevron {
        transform: rotate(0) !important;
    }

    .cmh-dynamic-parent > .cmh-dynamic-children {
        position: static !important;
        display: none;
        width: auto !important;
        margin: 3px 0 7px 13px !important;
        padding: 5px 0 5px 10px !important;
        border: 0 !important;
        border-left: 2px solid #dcecf3 !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .cmh-dynamic-parent.cmh-dynamic-open > .cmh-dynamic-children {
        display: block;
        animation: cmh-dynamic-open 0.2s ease both;
    }

    .cmh-dynamic-parent.cmh-dynamic-open
        > .cmh-dynamic-toggle
        .cmh-dynamic-chevron {
        transform: rotate(180deg) !important;
    }
}

@keyframes cmh-dynamic-open {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cmh-menu-links {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.cmh-menu-links a {
    position: relative;
    padding: 23px 2px;
    color: #153e73;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.cmh-menu-links a::after {
    content: "";
    position: absolute;
    right: 50%;
    bottom: 13px;
    left: 50%;
    height: 2px;
    border-radius: 4px;
    background: #1592c1;
    transition: right 0.2s ease, left 0.2s ease;
}

.cmh-menu-links a:hover {
    color: #1592c1;
}

.cmh-menu-links a:hover::after {
    right: 0;
    left: 0;
}

/* Masaüstünde kategori bandının tamamı sabitlenir */
@media (min-width: 768px) {
    .cmh-nav.cmh-desktop-nav-fixed {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: 0 !important;
        z-index: 2147482000 !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 8px 28px rgba(10, 42, 73, 0.15) !important;
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        animation: cmh-desktop-nav-in 0.24s ease both;
    }

    .cmh-nav.cmh-desktop-nav-fixed + * {
        scroll-margin-top: 80px;
    }
}

@keyframes cmh-desktop-nav-in {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobil kategori popupı */
#cmh-mobile-category-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: Poppins, Inter, Arial, sans-serif;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#cmh-mobile-category-modal.cmh-modal-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cmh-mobile-category-backdrop {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: rgba(8, 20, 36, 0.68);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: pointer;
}

.cmh-mobile-category-dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100dvh - 32px);
    border-radius: 24px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 25px 70px rgba(0, 24, 52, 0.4);
    transform: translateY(18px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#cmh-mobile-category-modal.cmh-modal-open .cmh-mobile-category-dialog {
    transform: translateY(0) scale(1);
}

.cmh-mobile-drag {
    width: 48px;
    height: 5px;
    margin: 10px auto 2px;
    border-radius: 10px;
    background: #dce2e8;
}

.cmh-mobile-category-header {
    min-height: 66px;
    padding: 9px 17px 9px 20px;
    border-bottom: 1px solid #edf0f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.cmh-mobile-category-heading {
    min-width: 0;
}

.cmh-mobile-category-heading strong {
    display: block;
    color: #102b4f;
    font-size: 18px;
    font-weight: 700;
}

.cmh-mobile-category-heading span {
    display: block;
    margin-top: 2px;
    color: #89929e;
    font-size: 11px;
}

.cmh-mobile-category-close {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #087bb7;
    background: #edf7fb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cmh-mobile-category-close svg {
    width: 21px !important;
    height: 21px !important;
    stroke-width: 2 !important;
}

.cmh-mobile-category-search-area {
    padding: 15px 17px 12px;
    background: #fff;
}

.cmh-mobile-category-search {
    height: 50px;
    padding: 0 15px;
    border: 1.5px solid #dfe8ee;
    border-radius: 14px;
    background: #f7fafc;
    display: flex;
    align-items: center;
    gap: 11px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cmh-mobile-category-search:focus-within {
    border-color: #1287ba;
    background: #fff;
    box-shadow: 0 7px 20px rgba(18, 135, 186, 0.13);
}

.cmh-mobile-category-search svg {
    flex: 0 0 21px;
    width: 21px !important;
    height: 21px !important;
    color: #1687b6;
    stroke-width: 2 !important;
}

.cmh-mobile-category-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    color: #17243a;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
}

.cmh-mobile-category-search input::placeholder {
    color: #9aa3ad;
}

.cmh-mobile-category-result {
    padding: 0 19px 9px;
    color: #8b949f;
    font-size: 11px;
}

.cmh-mobile-category-list {
    max-height: calc(100dvh - 275px);
    padding: 2px 12px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #cddce5 transparent;
}

.cmh-mobile-category-item {
    min-height: 58px;
    margin-bottom: 5px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: #172b48;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.cmh-mobile-category-item:active {
    transform: scale(0.98);
}

.cmh-mobile-category-item:hover {
    color: #087bb7;
    border-color: #dcecf3;
    background: #f1f9fc;
}

.cmh-mobile-category-item.cmh-category-hidden {
    display: none;
}

.cmh-mobile-category-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    color: #1188b8;
    background: linear-gradient(135deg, #e7f7fc, #ecf9f3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cmh-mobile-category-icon svg {
    width: 21px !important;
    height: 21px !important;
    stroke-width: 1.7 !important;
}

.cmh-mobile-category-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 550;
}

.cmh-mobile-category-arrow {
    flex: 0 0 18px;
    width: 18px !important;
    height: 18px !important;
    color: #9ba6af;
}

.cmh-mobile-category-empty {
    display: none;
    padding: 45px 20px 55px;
    color: #7c8794;
    text-align: center;
    font-size: 13px;
}

.cmh-mobile-category-empty.cmh-empty-visible {
    display: block;
}

@media (min-width: 768px) {
    #cmh-mobile-category-modal {
        display: none !important;
    }
}

@media (max-width: 1100px) {
    .cmh-middle-inner {
        grid-template-columns: 200px minmax(300px, 1fr) auto;
        gap: 22px;
    }

    .cmh-action {
        min-width: 78px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .cmh-menu-links {
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .cmh-menu-links::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 767px) {
    .cmh-container {
        width: calc(100% - 24px);
    }

    .cmh-topbar,
    .cmh-topbar-inner {
        min-height: 36px;
    }

    .cmh-topbar-right {
        display: none;
    }

    .cmh-topbar-left {
        width: 100%;
        justify-content: center;
    }

    .cmh-middle {
        padding: 14px 0;
    }

    .cmh-middle-inner {
        grid-template-columns: 1fr auto;
        gap: 13px;
    }

    .cmh-logo img {
        max-width: 180px;
        max-height: 58px;
    }

    .cmh-search {
        grid-column: 1 / -1;
        grid-row: 2;
        height: 48px;
        border-radius: 13px;
    }

    .cmh-search button {
        flex-basis: 58px;
    }

    .cmh-actions {
        justify-self: end;
    }

    .cmh-action-wrap:first-child {
        display: none;
    }

    .cmh-action {
        min-width: 52px;
        padding: 3px 8px;
        border-left: 0;
    }

    .cmh-action > span:last-child {
        display: none;
    }

    .cmh-nav,
    .cmh-nav-inner {
        min-height: 60px;
    }

    .cmh-nav-inner {
        gap: 16px;
    }

    .cmh-cat-placeholder {
        flex-basis: 220px;
        height: 46px;
    }

    .cmh-cat-wrap {
        width: 220px;
        height: 46px;
    }

    .cmh-cat-button {
        height: 46px;
        padding: 0 15px;
        font-size: 12px;
    }

    .cmh-cat-panel {
        display: none !important;
    }

    .cmh-menu-links a {
        padding-top: 20px;
        padding-bottom: 20px;
        font-size: 12px;
    }

    .cmh-cat-wrap.cmh-mobile-cat-fixed {
        position: fixed !important;
        top: 8px !important;
        left: 12px !important;
        z-index: 2147482000 !important;
        width: 220px !important;
        animation: cmh-mobile-cat-in 0.24s ease both;
    }
}

@keyframes cmh-mobile-cat-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
