/* ==========================================================================
   Edumatris Mobile Navigation Component
   Modern 4+1 Sabit Alt Menü & Yukarı Kayan Bottom Sheet (Sıfır Emoji, Tabular Nums)
   ========================================================================== */

/* Masaüstü Ekranlarda (>= 992px) Tamamen Gizle */
@media (min-width: 992px) {
    .app-mobile-nav {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   1. Bottom Nav Bar (Sabit Alt Çubuk)
   -------------------------------------------------------------------------- */
.app-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-bar {
    position: relative;
    z-index: 1002;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border, #E5E7EB);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: content-box;
}

[data-mode="dark"] .mobile-bottom-bar {
    background: rgba(17, 24, 39, 0.94);
    border-top-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.25);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-width: 0;
    padding: 4px 2px 2px 2px;
    color: var(--text-muted, #6B7280);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    position: relative;
}

.bottom-nav-item .nav-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
}

.bottom-nav-item i {
    font-size: 19px;
    line-height: 1;
    transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.15s ease;
}

.bottom-nav-item .nav-label {
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 3px;
    letter-spacing: -0.15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color 0.15s ease;
}

/* Hover / Focus */
.bottom-nav-item:hover,
.bottom-nav-item:focus-visible {
    color: var(--text-main, #111827);
    outline: none;
}

[data-mode="dark"] .bottom-nav-item:hover,
[data-mode="dark"] .bottom-nav-item:focus-visible {
    color: #F3F4F6;
}

/* Aktif Durum */
.bottom-nav-item.active {
    color: #009D6C !important;
}

[data-mode="dark"] .bottom-nav-item.active {
    color: #34D399 !important;
}

.bottom-nav-item.active i {
    transform: translateY(-2px) scale(1.06);
}

.bottom-nav-item.active .nav-label {
    font-weight: 700;
}

/* Sayısal Rozet (Badge Pill) */
.nav-badge-pill {
    position: absolute;
    top: -3px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 9.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-mode="dark"] .nav-badge-pill {
    border-color: #111827;
}

/* Nokta Rozet (Menü Butonu için Badge Dot) */
.nav-badge-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #EF4444;
    border: 1.5px solid #FFFFFF;
}

[data-mode="dark"] .nav-badge-dot {
    border-color: #111827;
}

/* --------------------------------------------------------------------------
   2. Slide-up Bottom Sheet (Yukarı Kayan Menü)
   -------------------------------------------------------------------------- */
.mobile-bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1050;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0.25s;
}

.mobile-bottom-sheet.is-open {
    visibility: visible;
    pointer-events: auto;
}

.sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.mobile-bottom-sheet.is-open .sheet-overlay {
    opacity: 1;
}

.sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 82vh;
    background: var(--card-bg, #FFFFFF);
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

[data-mode="dark"] .sheet-content {
    background: #1F2937;
    box-shadow: 0 -8px 35px rgba(0, 0, 0, 0.45);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-bottom-sheet.is-open .sheet-content {
    transform: translateY(0);
}

/* Sheet Header & Drag Handle */
.sheet-header {
    display: flex;
    flex-direction: column;
    padding: 8px 18px 10px 18px;
    border-bottom: 1px solid var(--border, #E5E7EB);
    flex-shrink: 0;
}

[data-mode="dark"] .sheet-header {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.drag-handle {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--text-muted, #9CA3AF);
    opacity: 0.35;
    margin: 4px auto 10px auto;
}

.sheet-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sheet-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main, #111827);
    letter-spacing: -0.2px;
}

[data-mode="dark"] .sheet-title {
    color: #F9FAFB;
}

.sheet-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--input-bg, #F3F4F6);
    border: none;
    color: var(--text-muted, #6B7280);
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sheet-close-btn:hover {
    background: var(--border, #E5E7EB);
    color: var(--text-main, #111827);
}

[data-mode="dark"] .sheet-close-btn {
    background: #374151;
    color: #9CA3AF;
}

[data-mode="dark"] .sheet-close-btn:hover {
    background: #4B5563;
    color: #F9FAFB;
}

/* Sheet Body & Sections */
.sheet-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 16px 0;
    flex: 1 1 auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border, #E5E7EB) transparent;
}

.sheet-section {
    padding: 4px 0;
}

.sheet-section + .sheet-section {
    border-top: 1px solid var(--border, #F3F4F6);
    margin-top: 4px;
    padding-top: 6px;
}

[data-mode="dark"] .sheet-section + .sheet-section {
    border-top-color: rgba(255, 255, 255, 0.05);
}

.sheet-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #9CA3AF);
    padding: 8px 20px 4px 20px;
}

.sheet-section-list {
    display: flex;
    flex-direction: column;
}

/* Sheet Items */
.sheet-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 10px 20px;
    color: var(--text-main, #1F2937);
    text-decoration: none;
    transition: background-color 0.12s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.sheet-item:hover,
.sheet-item:active {
    background: var(--input-bg, #F9FAFB);
}

[data-mode="dark"] .sheet-item {
    color: #E5E7EB;
}

[data-mode="dark"] .sheet-item:hover,
[data-mode="dark"] .sheet-item:active {
    background: rgba(255, 255, 255, 0.05);
}

.sheet-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--input-bg, #F3F4F6);
    color: var(--text-main, #374151);
    font-size: 15px;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

[data-mode="dark"] .sheet-icon-wrapper {
    background: #374151;
    color: #D1D5DB;
}

.sheet-label {
    flex: 1;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: -0.1px;
    line-height: 1.35;
}

.sheet-chevron {
    font-size: 11px;
    color: var(--text-muted, #9CA3AF);
    transition: transform 0.15s ease;
}

.sheet-item:hover .sheet-chevron {
    transform: translateX(2px);
    color: var(--text-main, #111827);
}

[data-mode="dark"] .sheet-item:hover .sheet-chevron {
    color: #F9FAFB;
}

/* Aktif Sheet Item */
.sheet-item.active {
    color: #009D6C !important;
}

[data-mode="dark"] .sheet-item.active {
    color: #34D399 !important;
}

.sheet-item.active .sheet-icon-wrapper {
    background: rgba(0, 157, 108, 0.12);
    color: #009D6C;
}

[data-mode="dark"] .sheet-item.active .sheet-icon-wrapper {
    background: rgba(52, 211, 153, 0.15);
    color: #34D399;
}

.sheet-item.active .sheet-label {
    font-weight: 700;
}

/* Sayısal Rozet (Sheet Badge) */
.sheet-badge {
    padding: 2px 7px;
    border-radius: 999px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 10.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

/* Tehlike / Çıkış Butonu (Danger) */
.sheet-item.is-danger {
    color: #EF4444 !important;
}

.sheet-item.is-danger .sheet-icon-wrapper {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

[data-mode="dark"] .sheet-item.is-danger .sheet-icon-wrapper {
    background: rgba(239, 68, 68, 0.18);
    color: #F87171;
}

.sheet-item.is-danger:hover,
.sheet-item.is-danger:active {
    background: rgba(239, 68, 68, 0.05);
}

/* --------------------------------------------------------------------------
   3. Global Mobil Düzen Uyumluluğu (Padding & Chat Lift)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    /* Alt barın sayfa altındaki footer veya butonları örtmemesi için ana içerik altına emniyet boşluğu */
    .app-main-content {
        padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    /* Chat balonunun alt bar ile çakışmaması için yukarı kaldır */
    .chat-dock-container .chat-box.roster-box.minimized {
        bottom: calc(75px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
