/**
 * Esnaf marka renkleri
 * Primary: #88ac35 | Primary active / hover: #6a8421
 */
:root,
[data-bs-theme="light"] {
    --bs-primary: #88ac35;
    --bs-primary-rgb: 136, 172, 53;
    --bs-primary-text-emphasis: #2d3a12;
    --bs-primary-bg-subtle: #eef3e3;
    --bs-primary-border-subtle: #c8dbaa;
    --bs-link-color: #88ac35;
    --bs-link-color-rgb: 136, 172, 53;
    --bs-link-hover-color: #6a8421;
    --bs-link-hover-color-rgb: 106, 132, 33;
    --bs-focus-ring-color: rgba(136, 172, 53, 0.25);

    --bs-primary-active: #6a8421;
    --bs-primary-light: #eef3e3;
    --bs-primary-clarity: rgba(136, 172, 53, 0.2);
    --bs-text-primary: #88ac35;
    --bs-component-active-bg: #88ac35;
    --bs-component-hover-color: #88ac35;
    --bs-component-checked-bg: #88ac35;
    --bs-menu-link-color-hover: #88ac35;
    --bs-menu-link-color-show: #88ac35;
    --bs-menu-link-color-here: #88ac35;
    --bs-menu-link-color-active: #88ac35;
    --bs-ribbon-label-bg: #88ac35;
    --bs-scrolltop-bg-color: #88ac35;
    --bs-scrolltop-bg-color-hover: #6a8421;
}

[data-bs-theme="dark"] {
    --bs-gray-100: #393A3D;
    --bs-gray-100-rgb: 57, 58, 61;
    --bs-primary-text-emphasis: #b8d67a;
    --bs-primary-bg-subtle: #1a2210;
    --bs-primary-border-subtle: #3d5020;
    --bs-link-color: #88ac35;
    --bs-link-hover-color: #9dbd5c;
    --bs-link-color-rgb: 136, 172, 53;
    --bs-link-hover-color-rgb: 157, 189, 92;

    --bs-primary: #88ac35;
    --bs-primary-active: #6a8421;
    --bs-primary-light: #1f2912;
    --bs-primary-clarity: rgba(136, 172, 53, 0.2);
    --bs-primary-rgb: 136, 172, 53;
    --bs-text-primary: #9dbd5c;
    --bs-component-active-bg: #88ac35;
    --bs-component-hover-color: #9dbd5c;
    --bs-component-checked-bg: #88ac35;
    --bs-menu-link-color-hover: #88ac35;
    --bs-menu-link-color-show: #88ac35;
    --bs-menu-link-color-here: #88ac35;
    --bs-menu-link-color-active: #88ac35;
    --bs-scrolltop-bg-color: #88ac35;
    --bs-scrolltop-bg-color-hover: #6a8421;
    --bs-ribbon-label-bg: #88ac35;
}

[data-bs-theme="dark"] .form-control {
    background-color: #393A3D !important;
    color: #9A9CAE !important;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #9A9CAE !important;
}

[data-bs-theme="dark"] .form-select {
    background-color: #393A3D !important;
    color: #9A9CAE !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection--single,
[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection--multiple,
[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-dropdown,
[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-search__field,
[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-results__option {
    background-color: #393A3D !important;
    color: #9A9CAE !important;
}

/* Sabit hex kullanan bileşenler (bundle sonrası) */
.text-primary,
.link-primary {
    color: #88ac35 !important;
}

.btn-primary {
    --bs-btn-bg: #88ac35;
    --bs-btn-border-color: #88ac35;
    --bs-btn-hover-bg: #6a8421;
    --bs-btn-hover-border-color: #6a8421;
    --bs-btn-active-bg: #6a8421;
    --bs-btn-active-border-color: #6a8421;
    --bs-btn-disabled-bg: #88ac35;
    --bs-btn-disabled-border-color: #88ac35;
}

.btn-outline-primary {
    --bs-btn-color: #88ac35;
    --bs-btn-border-color: #88ac35;
    --bs-btn-hover-bg: #88ac35;
    --bs-btn-hover-border-color: #88ac35;
    --bs-btn-active-bg: #6a8421;
    --bs-btn-active-border-color: #6a8421;
}

.btn-light-primary,
.btn.btn-light-primary {
    color: #88ac35 !important;
}

.btn-light-primary:hover:not(.btn-active),
.btn-light-primary:focus:not(.btn-active),
.btn-light-primary:active:not(.btn-active),
.btn-light-primary.active,
.btn-check:checked + .btn-light-primary,
.btn-check:active + .btn-light-primary,
.show > .btn-light-primary,
.btn.btn-light-primary:hover:not(.btn-active),
.btn.btn-light-primary:focus:not(.btn-active),
.btn.btn-light-primary:active:not(.btn-active),
.btn.btn-light-primary.active {
    color: #fff !important;
}

.bg-primary {
    --bs-bg-opacity: 1;
    background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;
}

.border-primary {
    border-color: #88ac35 !important;
}

.form-check-input:checked {
    background-color: #88ac35;
    border-color: #88ac35;
}

.form-check-input:focus {
    border-color: #a8c76a;
    box-shadow: 0 0 0 0.25rem rgba(136, 172, 53, 0.25);
}

.page-link.active,
.active > .page-link,
.page-link:hover {
    z-index: 3;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: #88ac35;
}

.progress-bar {
    background-color: #88ac35;
}

.badge-light-primary {
    color: #6a8421;
    background-color: #eef3e3;
}

.menu-link.active,
.menu-link:hover:not(.disabled):not(.active),
.menu-link.show {
    color: #88ac35;
}

.aside-menu .menu-link.active .menu-icon i,
.aside-menu .menu-link:hover .menu-icon i {
    color: #88ac35;
}

/* Geniş yan menü: ikon solda, başlık sağda, tek satır */
:root {
    --esnaf-aside-width: 280px;
}

@media (min-width: 992px) {
    .aside-enabled.aside-fixed .wrapper {
        padding-left: var(--esnaf-aside-width) !important;
    }

    .aside-enabled.aside-fixed.header-fixed .header {
        left: var(--esnaf-aside-width) !important;
    }

    .aside-enabled.aside-fixed.toolbar-fixed .toolbar {
        left: var(--esnaf-aside-width) !important;
    }

    #kt_aside.aside.aside-expanded {
        width: var(--esnaf-aside-width) !important;
    }

    #kt_aside.aside.aside-expanded .aside-logo {
        justify-content: flex-start;
        height: auto;
        min-height: 72px;
        padding-top: 1.25rem;
        padding-bottom: 1.25rem;
    }
}

#kt_aside_menu.aside-menu .menu > .menu-item > .menu-link {
    width: auto !important;
    height: auto !important;
    min-height: 44px;
    margin: 0 0.75rem !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0.55rem 0.85rem !important;
    column-gap: 0;
}

#kt_aside_menu.aside-menu .menu > .menu-item > .menu-link .menu-icon {
    justify-content: center !important;
    width: 2rem !important;
    min-width: 2rem !important;
    margin: 0 0.75rem 0 0 !important;
    flex-shrink: 0 !important;
}

#kt_aside_menu.aside-menu .menu > .menu-item > .menu-link .menu-icon i {
    font-size: 1.35rem !important;
}

.aside-menu .menu > .menu-item > .menu-link .menu-title {
    color: #bababa;
}

#kt_aside_menu.aside-menu .menu > .menu-item > .menu-link .menu-title {
    flex-grow: 1 !important;
    font-size: 1.2rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    color: #bababa !important;
}

.aside-menu .menu > .menu-item > .menu-link.active .menu-title,
.aside-menu .menu > .menu-item.here > .menu-link .menu-title,
.aside-menu .menu > .menu-item > .menu-link:hover:not(.disabled):not(.active) .menu-title {
    color: #88ac35 !important;
}

#kt_aside_menu.aside-menu .menu > .menu-item {
    padding-top: 0.1rem !important;
    padding-bottom: 0.1rem !important;
}

#kt_aside_menu.aside-menu .menu-sub.menu-sub-accordion .menu-item .menu-link {
    padding: 0.3rem 3rem;
}

/* Hesap menüsü (üst bar profil) */
.esnaf-hesap-menu .menu-link:hover,
.esnaf-hesap-menu .menu-link:focus {
    background-color: #f4f6fa;
}

.esnaf-hesap-menu-dil {
    cursor: default;
    pointer-events: none;
}

.esnaf-hesap-menu-dil .badge {
    border-radius: 0.475rem;
}

.esnaf-profil-avatar-wrap .symbol img {
    width: 100%;
    height: 100%;
}

/* Ayarlar / Raporlar üst sekmeler (efatura sekmeleri ile aynı düzen) */
.esnaf-ayarlar-tabs .card-body {
    overflow: visible;
}

.esnaf-ayarlar-tabs-nav {
    flex-wrap: wrap;
    row-gap: 0.25rem;
    column-gap: 0;
    overflow: visible;
}

.esnaf-ayarlar-tabs-nav .nav-item {
    flex: 0 0 auto;
}

.esnaf-ayarlar-tabs-nav .nav-item .nav-link {
    margin: 0;
    margin-right: 1.25rem;
    white-space: nowrap;
}

.esnaf-ayarlar-tabs-nav .nav-item:last-child .nav-link {
    margin-right: 0;
}

/* Kasa: varlıklar arası aktarım butonu */
.btn-esnaf-virman {
    --bs-btn-color: #fff;
    --bs-btn-bg: #e8a317;
    --bs-btn-border-color: #d49212;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #cf920f;
    --bs-btn-hover-border-color: #b8840d;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #b8840d;
    --bs-btn-active-border-color: #a6780c;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #e8a317;
    --bs-btn-disabled-border-color: #d49212;
    --bs-btn-disabled-opacity: 0.55;
    color: #fff !important;
}

.btn-esnaf-virman:hover,
.btn-esnaf-virman:focus,
.btn-esnaf-virman:active,
.btn-esnaf-virman:disabled {
    color: #fff !important;
}

.btn-esnaf-virman i,
.btn-esnaf-virman [class*='ki-'],
.btn-esnaf-virman i::before,
.btn-esnaf-virman [class*='ki-']::before {
    color: #fff !important;
}

/* Arama kutusu + Ara butonu bitişik */
.plankey-search-input-group .form-control {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.plankey-search-input-group .btn {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    margin-left: 0;
}

/* Filtre: Temizle + aksiyon yan yana */
.plankey-filter-actions {
    flex-wrap: nowrap !important;
}

.plankey-filter-actions .btn {
    flex-shrink: 0;
}

/* Üst menü banner (Hızlı işlem / bildirim) */
.esnaf-header-menu-banner {
    background: linear-gradient(135deg, #6a8421 0%, #88ac35 55%, #9dbd5c 100%);
}

#kt_header_menu .menu-custom-icon {
    background-color: var(--bs-primary-bg-subtle, #eef3e3) !important;
}

#kt_aside_logo .logo {
    display: block;
    max-width: 100%;
}

/* Mobil üst bar logosu (yatay PNG) */
.esnaf-logo-mobile {
    display: block;
    height: 40px;
    width: auto;
    max-width: min(220px, 58vw);
    object-fit: contain;
}

/* Auth — giriş / kayıt */
.auth-form-logo--desktop {
    display: block;
    max-height: 56px;
    width: auto;
    max-width: min(320px, 90vw);
    object-fit: contain;
}

.auth-hero-logo {
    display: inline-block;
    object-fit: contain;
}

.auth-hero-logo--mobile {
    max-height: 52px;
}

.auth-hero-logo--desktop {
    max-height: 80px;
}

/* Program dökümanı modül kartları */
.esnaf-handbook-card {
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.esnaf-handbook-card:hover,
.esnaf-handbook-card:focus {
    border-color: var(--bs-primary, #88ac35) !important;
    box-shadow: 0 0.5rem 1.5rem rgba(136, 172, 53, 0.12);
}

#esnaf_handbook_sections code {
    font-size: 0.9em;
    color: var(--bs-primary-text-emphasis, #2d3a12);
    background: var(--bs-primary-bg-subtle, #eef3e3);
    padding: 0.1em 0.35em;
    border-radius: 0.25rem;
}

/* Üst bar lisans / deneme uyarısı */
.esnaf-lisans-bar {
    margin-bottom: 15px;
    border-bottom: 1px solid transparent;
    z-index: 99;
}

.esnaf-lisans-bar--info {
    background: var(--bs-primary-bg-subtle, #eef3e3);
    border-bottom-color: var(--bs-primary-border-subtle, #c8dbaa);
    color: var(--bs-primary-text-emphasis, #2d3a12);
}

.esnaf-lisans-bar--warning {
    background: #fff8dd;
    border-bottom-color: #ffc700;
    color: #7e6a00;
}

.esnaf-lisans-bar--danger,
.esnaf-lisans-bar--expired {
    background: #fff5f8;
    border-bottom-color: #f1416c;
    color: #9e2146;
}

[data-bs-theme="dark"] .esnaf-lisans-bar--info {
    background: #1f2912;
    border-bottom-color: #3d5020;
    color: #b8d67a;
}

[data-bs-theme="dark"] .esnaf-lisans-bar--warning {
    background: #2a2410;
    border-bottom-color: #665500;
    color: #ffc700;
}

[data-bs-theme="dark"] .esnaf-lisans-bar--danger,
[data-bs-theme="dark"] .esnaf-lisans-bar--expired {
    background: #2a1218;
    border-bottom-color: #7a2840;
    color: #f1416c;
}

/* Modal: ekran icinde kalsin, govde kaydirilsin (mobil + masaustu) */
.modal .modal-dialog {
    margin: 0.5rem auto;
}

.modal .modal-dialog.modal-dialog-centered {
    min-height: calc(100% - 1rem);
    align-items: flex-start;
}

.modal .modal-content {
    max-height: calc(100dvh - 1rem);
}

.modal .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobilde tablolar: yatay kaydirma + etiket/hucre okunabilirligi */
@media (max-width: 991.98px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive > .table {
        min-width: 640px;
    }

    .table-responsive > .table > :not(caption) > * > * {
        white-space: nowrap;
        font-size: 0.8125rem;
        vertical-align: middle;
    }

    .table-responsive .badge,
    .table-responsive .btn {
        white-space: nowrap;
    }
}

/* Hata sayfaları (404, 500, …) */
.esnaf-error-icon-wrap {
    display: flex;
    justify-content: center;
}

.esnaf-error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 50%;
}

.esnaf-error-icon--primary {
    background: rgba(62, 151, 255, 0.12);
    color: #3e97ff;
}

.esnaf-error-icon--warning {
    background: rgba(255, 199, 0, 0.14);
    color: #ffc700;
}

.esnaf-error-icon--danger {
    background: rgba(241, 65, 108, 0.12);
    color: #f1416c;
}

.esnaf-error-icon--info {
    background: rgba(114, 57, 234, 0.12);
    color: #7239ea;
}

/* Header çekmeceleri: kur + son işlemler */
.esnaf-header-drawer {
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    z-index: 1101 !important;
    border-left: 1px solid var(--bs-gray-200);
    box-shadow: -8px 0 32px rgba(24, 28, 50, 0.08);
}

.esnaf-header-drawer-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
    background: var(--bs-body-bg);
}

.esnaf-header-drawer-header {
    flex-shrink: 0;
    min-height: 4rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bs-gray-200);
    gap: 0.75rem;
}

.esnaf-header-drawer-header .card-title {
    font-size: 1.05rem;
    line-height: 1.35;
    padding-right: 0.5rem;
}

.esnaf-header-drawer-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1.25rem;
}

.esnaf-header-drawer--kurlar .table {
    font-size: 0.82rem;
    margin-bottom: 0;
}

.esnaf-header-drawer--kurlar .table th,
.esnaf-header-drawer--kurlar .table td {
    white-space: nowrap;
    vertical-align: middle;
}

.esnaf-header-drawer--kurlar .table-responsive {
    margin: 0 -0.15rem;
}

.esnaf-header-drawer-header.esnaf-header-drawer-header--kurlar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    min-height: 0 !important;
    height: auto;
    padding: 0.75rem 1rem !important;
    gap: 0.5rem;
    border-bottom: 1px solid var(--bs-gray-200);
    background: var(--bs-body-bg);
}

.esnaf-header-drawer-header--kurlar .esnaf-header-drawer-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--bs-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.esnaf-header-drawer-header--kurlar .esnaf-header-drawer-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.35rem;
}

@media (min-width: 768px) {
    .esnaf-header-drawer--kurlar[data-kt-drawer='true'] {
        width: 420px !important;
        max-width: 420px !important;
    }
}

@media (max-width: 767.98px) {
    .esnaf-header-drawer[data-kt-drawer='true'] {
        width: 100% !important;
        max-width: 100% !important;
    }

    .esnaf-header-drawer-header {
        align-items: flex-start;
    }

    .esnaf-header-drawer-header--kurlar {
        align-items: center;
    }

    .esnaf-header-drawer--kurlar .table {
        font-size: 0.78rem;
    }
}

/* Servis iş emri liste durum ikonları */
.si-liste-satir:hover > td {
    background-color: rgba(136, 172, 53, 0.06);
}

.si-durum-ikonlar {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.si-durum-ikon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 0.35rem;
    line-height: 1;
    cursor: default;
}

.si-durum-ikon i {
    font-size: 0.9rem;
}

.si-durum-ikon.is-inactive {
    color: #9ca3af;
    background: rgba(156, 163, 175, 0.14);
}

.si-durum-ikon--muhasebe.is-active {
    color: #ffffff;
    background: #16a34a;
}

.si-durum-ikon--fatura.is-active {
    color: #ffffff;
    background: #dc2626;
}

.si-durum-ikon.is-active i,
.si-durum-ikon.is-active [class*='ki-'],
.si-durum-ikon.is-active i::before,
.si-durum-ikon.is-active [class*='ki-']::before {
    color: #ffffff !important;
}

/* Randevu görünüm değiştirici */
.esnaf-randevu-gorunumler .btn {
    border: 1px solid #e4e6ef;
}

.esnaf-randevu-gorunumler .btn.btn-primary {
    border-color: transparent;
}

.esnaf-randevu-gorunumler .btn + .btn {
    margin-left: -1px;
}
