* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

/* Mobil Varsayılan: Soldan Açılan Menü (Drawer) */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: #ffffff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.brand-user-container {
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #edf2f7;
}

.sidebar-header h2 {
    font-size: 1.2rem;
    color: #1a202c;
    font-weight: 700;
}

/* Logo Yanı Kullanıcı Bilgileri */
.user-info-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #edf2f7;
    background: #fafbfc;
}

.user-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d3748;
}

.user-role {
    font-size: 0.75rem;
    color: #718096;
}

/* Sağ Grup Kapsayıcısı (Mobilde Dikey) */
.nav-right-group {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto;
}

/* Menü Elemanları */
.sidebar-menu {
    list-style: none;
    padding: 15px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-menu li {
    margin: 4px 16px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: #4a5568;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sidebar-menu a:hover {
    background-color: #f7fafc;
    color: #2b6cb0;
}

.sidebar-menu a svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    margin-right: 12px;
    flex-shrink: 0;
}

/* Giriş Yap Butonu Bölümü */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #edf2f7;
    margin-top: auto;
}

.login-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.25);
    transition: opacity 0.2s, transform 0.1s;
}

.login-btn svg {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    flex-shrink: 0;
}

.login-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Mobil Üst Bar (Navbar) */
.navbar {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    flex-shrink: 0;
}

.navbar h1 {
    font-size: 1.15rem;
    color: #2d3748;
}

/* Hamburger İkonu */
.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #4a5568;
    border-radius: 2px;
    transition: all 0.3s;
}

/* Ana İçerik Alanı */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0 !important;
    margin: 0 !important;
}

.content-body {
    padding: 0 20px 20px 20px;
}

.content-body h2 {
    font-size: 1.75rem;
    color: #1a202c;
    margin-bottom: 12px;
}

.content-body p {
    color: #718096;
    line-height: 1.6;
}

/* Arka Plan Karartması (Overlay) */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 768px ve Üzeri (Tablet ve Masaüstü): Yatay Üst Menü - Optimize Edilmiş Boşluklar */
@media (min-width: 768px) {
    .sidebar {
        position: static;
        left: 0;
        width: 100%;
        height: 70px; /* Biraz daha kompakt yaptık */
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px; /* Yan boşlukları daralttık ki iPad'e rahat sığsın */
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
        border-bottom: 1px solid #edf2f7;
    }

    .brand-user-container {
        flex-direction: row;
        align-items: center;
        gap: 10px; /* Boşluk azaltıldı */
        border-bottom: none;
    }

    .sidebar-header {
        padding: 0;
        border-bottom: none;
    }
    
    .sidebar-header h2 {
        font-size: 1.1rem; /* Başlık boyutu ufak optimize edildi */
    }

    .user-info-badge {
        border-bottom: none;
        background: transparent;
        padding: 0;
        border-left: 1px solid #e2e8f0;
        padding-left: 12px;
    }

    .nav-right-group {
        flex-direction: row;
        align-items: center;
        gap: 8px; /* Sağ grup içi boşluk daraltıldı */
        overflow-y: visible;
        flex-grow: 0;
    }

    .sidebar-menu {
        flex-direction: row;
        padding: 0;
        gap: 2px; /* Menü elemanları birbirine yaklaştırıldı */
        overflow-y: visible;
        align-items: center;
    }

    .sidebar-menu li {
        margin: 0;
    }

    .sidebar-menu a {
        padding: 6px 8px; /* Linklerin iç boşlukları küçültüldü (iPad için hayat kurtarır) */
        border-radius: 6px;
        font-size: 0.88rem; /* Yazı boyutu hafifçe daraltıldı */
    }

    .sidebar-menu a svg {
        margin-right: 6px; /* SVG ikon ile yazı arası mesafe kısaltıldı */
        width: 17px !important;
        height: 17px !important;
        min-width: 17px !important;
        min-height: 17px !important;
    }

    .sidebar-footer {
        padding: 0;
        border-top: none;
        margin-top: 0;
    }

    .login-btn {
        padding: 6px 12px;
        width: auto;
        font-size: 0.88rem;
    }

    .navbar {
        display: none;
    }

    .overlay {
        display: none !important;
    }
}

/* Menü ana kapsayıcısı için gerekli temel stil */
.menu-container {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Her bir menü öğesi */
.menu-item {
    position: relative;
}

/* Ana menü linki */
.menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    font-family: sans-serif;
}

/* Alt menü ana taşıyıcısı */
.has-submenu {
    position: relative;
}

/* Muhasebe satırı düzeni ve ok simgesi */
.has-submenu > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.has-submenu .arrow-icon {
    transition: transform 0.3s ease;
}

/* Menü açıldığında okun dönmesi */
.has-submenu.open .arrow-icon {
    transform: rotate(180deg);
}

/* Alt menü (Aidat) - Sağ tarafa yaslı olarak açılır */
.has-submenu .submenu {
    display: none;
    position: absolute;  
    top: 100%;         
    right: 0;          
    left: auto;        
    min-width: 180px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    list-style: none;
    padding: 8px 0;
    margin: 4px 0 0 0;
    z-index: 1050;     
}

/* JavaScript ile 'open' sınıfı eklendiğinde görünür olur */
.has-submenu.open .submenu {
    display: block;
}

/* Alt menü bağlantı tasarımı */
.submenu li a {
    padding: 10px 16px;
    display: block;
    text-decoration: none;
    color: #4a5568;
    font-size: 0.95rem;
    text-align: right; 
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.submenu li a:hover {
    background-color: #f7fafc;
    color: #319795;
}