/**
 * ==========================================
 * HEADER / TOPBAR
 * Üst menü, arama, kullanıcı alanı
 * ==========================================
 */

/* ========== TOPBAR ANA KAPLAYICI ========== */
/* Hem .yonetim-ui .topbar hem de sadece .topbar için çalışsın */
.yonetim-ui .topbar,
.topbar {
    /* Template ile uyumlu: sidebar ile aynı renklerden yatay gradient */
    background: linear-gradient(to right, #1e293b, #0f172a);
    /* Sidebar ile aynı efekt: ince alt çizgi + gölge */
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    height: var(--by-topbar-height);
    
    font-family: var(--by-font-main);
    /* Konumlandırma */
    position: fixed;
    top: 0;
    /* Sol boşluk sidebar genişliği kadar */
    left: var(--by-sidebar-width) !important;
    /* Genişlik sidebar'a göre ayarla - right kaldırıldı çünkü left+width birlikte kullanılıyor */
    width: calc(100% - var(--by-sidebar-width)) !important;
    
    /* Düzen */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    
    /* Katman ve Gölge – sidebar ile aynı his (alt gölge) */
    z-index: var(--z-sticky); /* 1020 */
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.10);
    
    /* Geçiş Efekti (Sidebar açılıp kapanırken) */
    transition: left var(--by-transition-slow), width var(--by-transition-slow);
}

/* Sidebar kapandığında header sola yaslansın ve genişliği güncellensin */
body.sidebar-collapsed .yonetim-ui .topbar,
body.sidebar-collapsed .topbar {
    left: var(--by-sidebar-collapsed) !important;
    width: calc(100% - var(--by-sidebar-collapsed)) !important;
    right: auto !important; /* right değerini sıfırla */
}

/* ========== SOL KISIM (Başlık & Rozetler) ========== */
.yonetim-ui .topbar-left,
.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Income: breadcrumb + geri ok (topbar içinde) */
.topbar .topbar-income-breadcrumb{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
}
.topbar .topbar-income-back{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:32px;
    height:32px;
    border-radius:12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color:#e5e7eb;
    text-decoration:none;
    flex-shrink:0;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.topbar .topbar-income-back:hover{
    color:#ffffff;
    border-color: rgba(255,255,255,0.20);
    background: rgba(255,255,255,0.12);
}
.topbar .topbar-income-crumbs{
    display:flex;
    align-items:center;
    gap:8px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.72);
    white-space:nowrap;
}
.topbar .topbar-income-crumbs a{
    color: rgba(255,255,255,0.72);
    text-decoration:none;
}
.topbar .topbar-income-crumbs a:hover{ color:#fff; }
.topbar .topbar-income-crumbs .sep{
    display:inline-flex;
    align-items:center;
    color: rgba(255,255,255,0.35);
    font-size: 0.75rem;
}
.topbar .topbar-income-crumbs .current{
    color: #ffffff;
    font-weight: 700;
}

/* Ek Gelirler / Gelir Türleri — firma ekstresi .by4-tab ile aynı: ikon + metin */
.topbar .topbar-income-crumbs .topbar-crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.25;
}
.topbar .topbar-income-crumbs .topbar-crumb > i {
    font-size: 0.8rem;
    opacity: 0.95;
}
.topbar .topbar-income-crumbs a.topbar-crumb:hover > i {
    opacity: 1;
}
.topbar .topbar-income-crumbs .topbar-crumb-current > i {
    color: rgba(255, 255, 255, 0.92);
}

/* Firma ekstresi: sadece metin breadcrumb; uzun firma adı ellipsis */
.topbar .topbar-income-crumbs--text-only {
    gap: 6px;
}
.topbar .topbar-company-ekstre-title,
.topbar .topbar-personel-ekstre-title,
.topbar .topbar-bank-ekstre-title {
    display: inline-block;
    max-width: min(42vw, 520px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.yonetim-ui .topbar-title,
.topbar-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

/* Rozetler (Badge) */
.yonetim-ui .topbar-property-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.yonetim-ui .badge {
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--by-radius-sm);
}

/* ========== ORTA KISIM (Arama) ========== */
.yonetim-ui .topbar-search,
.topbar-search {
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
}

/* ========== SAĞ KISIM (Butonlar & Profil) ========== */
.yonetim-ui .topbar-right,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

/* Topbar buton grupları */
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

/* Özet sayfası: demo + SMS + bildirim tek satırda kalsın */
.topbar .topbar-actions--ozet {
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    overflow: visible;
}

.topbar .topbar-demo-notice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    background: rgba(220, 53, 69, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    max-width: 190px;
    min-width: 0;
    flex-shrink: 1;
    white-space: nowrap;
    overflow: hidden;
}

.topbar .topbar-demo-notice > i {
    color: #ffc107;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.topbar .topbar-demo-notice-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.topbar .topbar-demo-tanitim {
    flex-shrink: 0;
    height: 32px;
    padding: 0 10px !important;
    white-space: nowrap;
}

.topbar .topbar-ziraat-tur-btn {
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    height: 26px;
    padding: 0 11px;
    margin: 0;
    border: none;
    border-radius: 980px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    font-weight: 510;
    letter-spacing: -0.01em;
    line-height: 26px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.topbar .topbar-ziraat-tur-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.topbar .topbar-ziraat-tur-btn:active {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(0.97);
}

.topbar .topbar-ozet-sms {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 6px 0 12px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    white-space: nowrap;
    line-height: 1;
    box-sizing: border-box;
}
.topbar .topbar-ozet-sms-bubble {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9em;
    height: 1.55em;
    flex-shrink: 0;
    line-height: 0;
    overflow: visible;
}
.topbar .topbar-ozet-sms #ozetSmsBilgilendirmeIcon {
    font-size: 1.9rem;
    color: #198754;
    line-height: 1;
}
.topbar .topbar-ozet-sms-bubble-txt {
    position: absolute;
    left: 50%;
    top: 44%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
    pointer-events: none;
    white-space: nowrap;
}
.topbar .topbar-ozet-sms-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1em;
    height: 22px;
    padding: 0 8px;
    border-radius: 4px;
    background: #3B7FB9;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.topbar .topbar-ozet-sms-toggle {
    padding-left: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    transform: none !important;
}
.topbar .topbar-ozet-sms-toggle .form-check-input {
    cursor: pointer;
    margin: 0;
    width: 2.2em;
    height: 1.15em;
    min-height: 1.15em;
    min-width: 2.2em;
}
.topbar .topbar-ozet-sms-yukle {
    appearance: none;
    -webkit-appearance: none;
    height: 24px;
    padding: 0 10px;
    margin: 0;
    border: none;
    border-radius: 4px;
    background: #ffc107;
    color: #212529;
    font-size: 12px;
    font-weight: 700;
    line-height: 24px;
    cursor: pointer;
    white-space: nowrap;
}
.topbar .topbar-ozet-sms-yukle:hover {
    background: #ffca2c;
}
.topbar .topbar-ozet-sms-toplu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    -webkit-appearance: none;
    height: 24px;
    padding: 0 10px;
    margin: 0;
    border: none;
    border-radius: 4px;
    background: #0d6efd;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 24px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.topbar .topbar-ozet-sms-toplu:hover {
    background: #0b5ed7;
    color: #fff;
    text-decoration: none;
}

.topbar .topbar-kolay-mod-switch {
    /* Şimdilik gizli — Kolay/Klasik geçiş sistemi hazır değil */
    display: none !important;
    height: 32px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    white-space: nowrap;
}

.topbar .topbar-kolay-mod-switch .topbar-mode-lbl {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1;
}

.topbar .topbar-kolay-mod-switch:not(.is-kolay) .topbar-mode-lbl-klasik,
.topbar .topbar-kolay-mod-switch.is-kolay .topbar-mode-lbl-kolay {
    color: #fff;
}

.topbar .topbar-kolay-mod-switch .js-kolay-mod-switch:checked {
    background-color: #198754;
    border-color: #198754;
}

.topbar .topbar-ozet-sms-balance {
    flex-shrink: 0;
}

@media (max-width: 1400px) {
    .topbar .topbar-demo-notice-text {
        display: none;
    }
    .topbar .topbar-demo-notice {
        max-width: none;
        padding: 0 8px;
    }
}

@media (max-width: 1100px) {
    .topbar .topbar-kolay-mod-switch .topbar-mode-lbl-klasik {
        display: none;
    }
}

@media (max-width: 1200px) {
    .topbar .topbar-demo-tanitim-label {
        display: none;
    }
}

.topbar-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-btn-group-spaced {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

/* Header Butonları - !important TEMİZLENDİ */
.btn-topbar {
    position: relative; /* Badge için gerekli */
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: var(--by-radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-topbar:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: #ffffff;
    text-decoration: none;
}

/* Aktif buton durumu - aynı tasarımda kalacak */
.btn-topbar.active,
.btn-topbar:active,
.btn-topbar.active:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    text-decoration: none;
}

/* Topbar içinde btn-primary butonu - Backup'taki gibi mavi */
.topbar-actions .btn-primary,
.topbar .topbar-actions .btn-primary,
.topbar-btn-group-spaced .btn-primary {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
    padding: 6px 12px !important;
    border-radius: var(--by-radius-md) !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: all 0.2s ease !important;
    height: auto !important;
}

.topbar-actions .btn-primary:hover,
.topbar .topbar-actions .btn-primary:hover,
.topbar-btn-group-spaced .btn-primary:hover {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3) !important;
}

/* Bildirim Butonu */
.btn-notification {
    position: relative;
    background: #27ae60;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%; /* Tam yuvarlak */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.btn-notification:hover {
    transform: scale(1.05);
    background: #219150;
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e74c3c;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    border: 2px solid var(--by-bg-shell-solid);
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    z-index: 10;
    display: none;
}
.notification-badge.show,
.topbar #webNotificationBtn .notification-badge {
    display: inline-block;
}

/* Topbar: yardım video ikonu – Kasalar başlığının yanında, koyu header’da okunur */
.topbar-help-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: rgba(255, 255, 255, 0.92);
    opacity: 0.95;
    border-radius: 10px;
    text-decoration: none;
}
.topbar-help-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.92);
    opacity: 1;
}

/* ========== COMPACT TOPBAR (48px) ========== */
.topbar {
    display: flex;
    align-items: center;
}
.topbar .logo {
    font-size: 16px;
}
/* Arama kutusu – BY4 Topbar.tsx ile 1:1 */
.topbar .topbar-search .input-group {
    height: 40px;
    border-radius: var(--by-radius-md);
    background: rgba(255, 255, 255, 0.10); /* bg-white/10 */
    border: 1px solid rgba(255, 255, 255, 0.20); /* border-white/20 */
    backdrop-filter: blur(12px); /* backdrop-blur-md */
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.40); /* shadow-lg hissi */
}

.topbar .topbar-search .input-group-text {
    background: transparent;
    border: none;
    padding: 0 12px;
    color: #e5e7eb;
}

.topbar .topbar-search .input-group-text i {
    font-size: 14px;
}

.topbar .topbar-search .form-control {
    height: 40px;
    font-size: 13px;
    padding: 0 16px;
    border: none;
    background: transparent;
    color: #ffffff;
}

.topbar .topbar-search .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5); /* placeholder:text-white/50 */
}

.topbar .topbar-search .form-control:focus {
    box-shadow: none;
}

.topbar .topbar-search .input-group:focus-within {
    border-color: rgba(255, 255, 255, 0.30);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.55);
}
/* Başlık – tek tık küçük, baskın değil */
.topbar h1,
.topbar .topbar-title {
    font-size: 18px;
    font-weight: 600;
}
/* Yeni Kişi Ekle vb. primary – topbar’dan dikkat çalmayacak boyut */
.topbar .btn-primary,
.topbar .topbar-actions .btn-primary {
    height: 34px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
}
.topbar .btn {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    border-radius: 6px;
}
/* SMS Bakiye – kompakt chip (logo + sayı + switch) */
.topbar .sms-balance,
.topbar #ozetSmsBalanceContainer {
    font-size: 13px;
    line-height: 1;
}
.topbar .form-switch {
    transform: scale(0.8);
}
.topbar span {
    line-height: 1;
}
.topbar .right-area {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar i {
    font-size: 18px;
}
/* Bildirim ikonu biraz küçült */
.topbar #webNotificationBtn {
    position: relative;
    width: 34px;
    min-width: 34px;
    padding: 0;
    overflow: visible;
    justify-content: center;
}
.topbar #webNotificationBtn i {
    font-size: 15px;
    margin: 0;
}

/* ========== KİŞİ EKSTRE: TOPBAR SADECE BU SAYFADA GİZLİ ========== */
body.kisi-ekstre-page .topbar {
    display: none !important;
}
body.kisi-ekstre-page.yonetim-ui .app-content {
    padding-top: 0;
}

/* ========== MOBİL UYUMLULUK ========== */
@media (max-width: 992px) {
    .yonetim-ui .topbar,
    .topbar {
        left: 0 !important; /* Mobilde tam genişlik */
        width: 100% !important; /* Mobilde tam genişlik */
        padding: 10px 15px;
        height: auto; /* İçeriğe göre uzasın */
        flex-wrap: wrap; /* Sığmazsa alt satıra geç */
        gap: 10px;
    }
    
    .yonetim-ui .topbar-search,
    .topbar-search {
        order: 3; /* Mobilde aramayı en alta al */
        width: 100%;
        max-width: 100%;
        margin: 10px 0 0 0;
    }
}