/* ==========================================================================
   FiberNet v3.0 - Universal Mobile & Tablet Navigation System
   Obsługa smartfonów (iOS/Android), tabletów (iPad/Android Tab) oraz desktopu
   ========================================================================== */

/* Bezpieczne marginesy dla urządzeń z notchem i zaokrąglonymi rogami */
:root {
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --fbn-nav-bg: rgba(9, 13, 22, 0.94);
    --fbn-nav-border: rgba(51, 65, 85, 0.6);
    --fbn-accent: #3b82f6;
    --fbn-green: #10b981;
    --fbn-glow: rgba(59, 130, 246, 0.35);
}

/* Zapewnienie odstępu na dole ekranu by Bottom Bar nie zasłaniał treści */
body {
    padding-bottom: calc(76px + var(--safe-bottom)) !important;
}

/* Responsywność formularzy i tabel na małych ekranach */
input, select, textarea, button {
    font-size: 16px !important; /* Zapobiega auto-zoomowi w iOS Safari */
    touch-action: manipulation;
}

/* Przewijanie poziome dla tabel na małych ekranach */
table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Pływający pasek nawigacji dolnej (Bottom Navigation Bar) dla smartfonów i tabletów */
#fbn-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--fbn-nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--fbn-nav-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 99999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
}

.fbn-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #94a3b8;
    font-size: 10.5px;
    font-weight: 500;
    height: 100%;
    gap: 3px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    position: relative;
}

.fbn-nav-item:active {
    transform: scale(0.94);
}

.fbn-nav-item .fbn-icon {
    font-size: 19px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.fbn-nav-item.active {
    color: #60a5fa;
    font-weight: 700;
}

.fbn-nav-item.active .fbn-icon {
    transform: translateY(-2px) scale(1.1);
    filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.6));
}

.fbn-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    width: 24px;
    height: 3px;
    background: #60a5fa;
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0 8px #60a5fa;
}

/* Przycisk Menu Więcej / Drawer na smartfonach */
#fbn-menu-toggle {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 10.5px;
    font-weight: 500;
    height: 100%;
    flex: 1;
    gap: 3px;
}

/* Pełnoekranowy panel boczny (Drawer) ze wszystkimi modułami */
#fbn-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#fbn-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

#fbn-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 88vh;
    background: #090d16;
    border-top: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 20px 20px 0 0;
    padding: 20px 16px calc(24px + var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100001;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
}

#fbn-drawer-overlay.open #fbn-drawer {
    transform: translateY(0);
}

.fbn-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.fbn-drawer-title {
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fbn-drawer-close {
    background: rgba(51, 65, 85, 0.5);
    border: none;
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
}

.fbn-drawer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 600px) {
    .fbn-drawer-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.fbn-module-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 12px;
    padding: 14px 12px;
    text-decoration: none;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    transition: all 0.2s ease;
}

.fbn-module-card:hover, .fbn-module-card:active {
    background: rgba(30, 41, 59, 0.9);
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.fbn-module-card.current {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.fbn-mc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.fbn-mc-icon {
    font-size: 24px;
}

.fbn-mc-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.fbn-mc-name {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
}

.fbn-mc-sub {
    font-size: 10.5px;
    color: #94a3b8;
    line-height: 1.3;
}

/* Responsywność dla Tabletów (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    #fbn-bottom-nav {
        height: 60px;
    }
    .fbn-nav-item {
        font-size: 11px;
    }
    .fbn-nav-item .fbn-icon {
        font-size: 20px;
    }
}

/* Desktop (> 1024px) */
@media (min-width: 1025px) {
    #fbn-bottom-nav {
        display: none !important;
    }
    body {
        padding-bottom: 0 !important;
    }
}
