/* frontend/styles/layout.css */

/* --- GLÓWNY KONTENER --- */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-light);
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: fixed;
    height: 100%;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.logo-area {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: 3rem;
    letter-spacing: 1px;
}

.logo-area i {
    color: var(--highlight);
}

.menu-items {
    list-style: none;
    flex-grow: 1;
}

.menu-items li {
    margin-bottom: var(--space-md);
}

.menu-items a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: var(--text-base);
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

/* Aktywny element i hover */
.menu-items li.active a, .menu-items a:hover {
    background: linear-gradient(90deg, var(--color-primary), transparent);
    color: #ffffff; 
    box-shadow: 0 4px 15px var(--shadow-primary);
}

.owner-info {
    font-size: var(--text-xs);
    color: var(--text-muted);
    opacity: 0.5;
}

/* Klasa dla zablokowanych elementów menu */
.nav-item.locked {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(100%);
    cursor: default;
    position: relative;
}

.nav-item.locked::after {
    content: '\f023'; /* FontAwesome lock icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 15px;
    font-size: var(--text-sm);
    opacity: 0.7;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: var(--space-xl);
    background-image: url('https://images.unsplash.com/photo-1534438327276-14e5300c3a48?q=80&w=2070&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

/* Overlay przyciemniający tło */
.main-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /* Zamiast sztywnych gradientów stosujemy czysty, sprzętowo akcelerowany kolor bazowy z parametrem opacity ze zmiennych */
    background-color: var(--bg-main);
    opacity: 0.85;
    z-index: 0;
    pointer-events: none; /* zapobiega przechwytywaniu zdarzeń myszy przez overlay */
}

/* Zapewniamy, że treść jest nad overlayem */
.dashboard-grid, .main-footer, #app-topbar {
    position: relative;
    z-index: 1;
}

/* --- TOP BAR --- */
#app-topbar {
    position: relative; 
    z-index: 10000;    
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    position: relative;
    z-index: 10001; 
}

.welcome-text h1 {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--text-main);
}

.welcome-text p {
    color: var(--text-muted);
}

/* User Profile Area (Prawy górny róg) */
.user-profile-area {
    display: flex;
    align-items: center;
    gap: var(--space-xl);          
    margin-left: auto;  
}

/* Pigułka Profilu */
.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    padding: 6px 20px 6px 6px; 
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: 0.3s;
    height: 54px; 
    min-width: 150px;
}

.user-profile:hover {
    border-color: var(--color-primary);
    background: var(--bg-surface);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    border: 2px solid var(--accent-color);
    object-fit: cover;
}

/* Przycisk Wylogowania */
.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-circle);
    color: var(--text-muted);
    background: transparent;
    font-size: var(--text-lg);
    transition: all 0.2s;
    border: 1px solid transparent;
    cursor: pointer;
}

.logout-btn:hover {
    color: var(--color-danger);
    background: rgba(255, 77, 77, 0.1);
    border-color: var(--color-danger);
}

/* --- STOPKA --- */
.main-footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
    border-top: 1px solid var(--border-light);
    padding-top: var(--space-xl);
}

/* ========================================= */
/* SYSTEM POWIADOMIEŃ (GLOBALNY)             */
/* ========================================= */

.notification-wrapper {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
}

.notification-bell {
    font-size: 1.3rem;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.notification-wrapper:hover .notification-bell {
    color: var(--text-main);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    transform: scale(1.1); 
}

/* Czerwona kropka */
.notification-dot {
    position: absolute;
    top: 5px; right: 5px; 
    width: 10px; height: 10px;
    background: var(--color-danger);
    border-radius: var(--radius-circle);
    border: 2px solid var(--bg-main); 
    display: none;
    box-shadow: 0 0 5px var(--color-danger); 
}
.notification-dot.visible { display: block; }

/* Pulsacja dzwonka */
@keyframes bellPulse {
    0% { transform: scale(1); color: var(--text-light); text-shadow: 0 0 0 transparent; }
    50% { transform: scale(1.15); color: var(--text-main); text-shadow: 0 0 12px rgba(255, 255, 255, 0.6); }
    100% { transform: scale(1); color: var(--text-light); text-shadow: 0 0 0 transparent; }
}

.notification-wrapper.pulsing .notification-bell {
    animation: bellPulse 2s infinite ease-in-out;
}

/* Lista powiadomień (Dropdown) */
.notification-dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); 
    z-index: 199999; 
    overflow: hidden;
    display: none;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
    cursor: default;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown.active {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Elementy listy powiadomień */
.notif-item {
    display: flex; gap: 12px; padding: 15px;
    border-bottom: 1px solid var(--border-light);
    align-items: flex-start;
    background: transparent;
    transition: background 0.2s;
}
.notif-item:hover { background: var(--bg-surface); }
.notif-item:last-child { border-bottom: none; }

.notif-avatar { width: 40px; height: 40px; border-radius: var(--radius-circle); object-fit: cover; }
.notif-content { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.notif-text { font-size: var(--text-sm); color: var(--text-main); line-height: 1.3; }

.notif-actions { display: flex; gap: var(--space-sm); margin-top: 5px; }

/* Przyciski akcji powiadomień */
.btn-xs {
    padding: 5px 12px; border: none; border-radius: var(--radius-sm);
    font-size: var(--text-xs); font-weight: var(--weight-bold); cursor: pointer; transition: 0.2s;
}
.btn-accept { background: var(--color-success); color: #fff; }
.btn-accept:hover { filter: brightness(0.9); }
.btn-reject { background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border-light); }
.btn-reject:hover { background: rgba(255, 77, 77, 0.1); color: var(--color-danger); border-color: var(--color-danger); }

.empty-notif { padding: var(--space-xl); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }


/* --- RWD (Mobile) --- */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* --- DOLNY PASEK NAWIGACYJNY (BOTTOM BAR) --- */
    .sidebar {
        width: 100%;
        height: auto;
        min-height: 65px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) 10px;
        
        position: fixed; 
        bottom: 0;
        top: auto;
        left: 0;
        
        border-right: none;
        border-top: 1px solid var(--border-light);
        border-radius: var(--radius-xl) var(--radius-xl) 0 0; 
        
        background: var(--bg-panel);
        backdrop-filter: blur(20px);
        box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
        
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        
        z-index: 9999; 
        overflow-x: hidden; 
    }

    .logo-area, .owner-info {
        display: none;
    }

    /* --- MENU ITEMS (Poziome) --- */
    .menu-items {
        display: flex;
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        margin: 0;
        padding: 0;
    }

    .menu-items li {
        margin: 0;
        flex: 1; 
        display: flex;
        justify-content: center;
    }

    .menu-items a {
        flex-direction: column; 
        padding: 5px;
        font-size: 0.65rem; 
        gap: 4px;
        border-radius: var(--radius-sm);
        color: var(--text-muted);
        background: transparent !important; 
        box-shadow: none !important;
        text-align: center;
        width: 100%;
        white-space: nowrap; 
    }

    .menu-items a i {
        font-size: 1.3rem; 
        margin-bottom: 2px;
        display: block;
    }

    .menu-items li.active a {
        color: var(--highlight);
    }
    
    .menu-items li.active a::before {
        content: '';
        position: absolute;
        top: 0;
        width: 20px;
        height: 2px;
        background: var(--highlight);
        border-radius: 0 0 4px 4px;
        box-shadow: 0 2px 8px var(--highlight);
    }

    /* --- GŁÓWNA ZAWARTOŚĆ --- */
    .main-content {
        margin-left: 0;
        padding: 1.5rem 1rem 90px 1rem;
        width: 100%;
    }

    /* --- TOP BAR (Mobile) --- */
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 2rem;
    }

    .welcome-text h1 {
        font-size: var(--text-xl); 
    }

    .user-profile-area {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }

    .user-profile {
        flex: 1; 
        margin: 0 10px;
        min-width: auto;
    }
}
/* Animacja znikania notyfikacji (Optimistic UI) */
.notification-dismissing {
    opacity: 0 !important;
    transform: translateX(20px) !important;
    transition: all 0.3s ease !important;
}
