/* header.css */

/* =======================================
   Navbar Styles
   ======================================= */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    background-color: var(--accent-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 1000;
    transition: height 0.3s ease, background-color 0.3s;
    color: var(--bg-primary);
}

body:not(.logged-in).shrunk .navbar,
.logged-in .navbar {
    height: var(--navbar-height-shrunk);
}

.left, .right {
    display: flex;
    align-items: center;
}

.brand-link {
    display: flex;
    align-items: center;
    color: inherit;
    transition: transform 0.3s ease;
}

.logo {
    width: 45px;
    height: 45px;
    margin-right: 12px;
    transition: width 0.3s ease, height 0.3s ease;
    fill: var(--bg-primary);
}

body:not(.logged-in).shrunk .logo,
.logged-in .logo {
    width: 35px;
    height: 35px;
}

.name {
    font-size: 1.5em;
    font-weight: 500;
    transition: font-size 0.3s ease;
}

body:not(.logged-in).shrunk .name,
.logged-in .name {
    font-size: 1.2em;
}

#sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--bg-primary);
    padding: 10px;
    border-radius: 8px;
    transition: color 0.3s, padding 0.3s ease;
}

body:not(.logged-in).shrunk #sidebar-toggle {
    padding: 8px;
}

#sidebar-toggle:hover {
    color: var(--accent-secondary);
}

#sidebar-toggle svg {
    transition: transform 0.3s ease;
    width: 28px;
    height: 28px;
    transform-origin: center;
    transform-box: fill-box;
}

body:not(.logged-in).shrunk #sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

.sidebar-open #sidebar-toggle svg {
    transform: rotate(180deg);
}

/* =======================================
   Sidebar Styles
   ======================================= */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: 100%;
    background-color: var(--bg-primary);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, top 0.3s ease;
    z-index: 999;
}

body:not(.logged-in).shrunk .sidebar,
.logged-in .sidebar {
    top: var(--navbar-height-shrunk);
}

.sidebar-open .sidebar {
    max-height: var(--sidebar-height);
    border-bottom: 3px solid var(--border-color);
}

.sidebar ul {
    list-style: none;
    padding: var(--sidebar-padding-top) 20px 10px;
    margin: 0;
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    height: calc(var(--sidebar-height) - var(--sidebar-padding-top));
}

.sidebar li {
    flex: 1;
    text-align: center;
    margin-top: -3px;
}

.sidebar a {
    color: var(--text-secondary);
    font-size: 1.2em;
    padding: 10px 20px;
    border-radius: 8px;
    transition: color 0.3s, font-weight 0.2s;
    display: inline-block;
}

.sidebar a:hover {
    color: var(--accent-primary);
    font-weight: 600;
}

.sidebar a.active {
    color: var(--accent-primary);
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    .sidebar {
        background-color: var(--bg-secondary);
    }

    .sidebar a {
        color: var(--text-secondary);
    }
}

/* =======================================
   App (logged-in) sidebar
   Wide screens: horizontal nav bar (old style)
   Narrow screens: dropdown menu
   ======================================= */

/* --- Wide screens: old horizontal bar --- */
.sidebar.app-sidebar {
    overflow: hidden;
    background-color: var(--bg-primary);
}
.sidebar.app-sidebar .app-sidebar-head {
    display: none;
}
.sidebar.app-sidebar ul {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    height: calc(var(--sidebar-height) - var(--sidebar-padding-top));
    padding: var(--sidebar-padding-top) 20px 10px;
    overflow: hidden;
}
.sidebar.app-sidebar li {
    flex: 1;
    text-align: center;
    margin-top: -3px;
}
.sidebar.app-sidebar a {
    display: inline-block;
    font-size: 1.2em;
    padding: 10px 20px;
    white-space: nowrap;
}
.sidebar.app-sidebar .app-sidebar-menu {
    position: static;
    display: flex;
    box-shadow: none;
    border-bottom: none;
}

/* Medium screens: keep the horizontal bar but shrink the text
   so all links fit before switching to the dropdown. */
@media (min-width: 901px) and (max-width: 1250px) {
    .sidebar.app-sidebar a {
        font-size: clamp(0.9rem, 1.5vw, 1.2rem);
        padding: 10px calc(10px + 0.6vw);
    }
}

/* --- Narrow screens: dropdown menu --- */
@media (max-width: 900px) {
    .sidebar.app-sidebar {
        overflow: visible;
    }
    .sidebar.app-sidebar .app-sidebar-head {
        width: 100%;
        height: var(--sidebar-height);
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        padding: 0 44px;
        background: none;
        border: none;
        cursor: pointer;
        font-family: 'Poppins', sans-serif;
        font-size: 1.3rem;
        font-weight: 600;
        color: var(--accent-primary);
    }
    .sidebar.app-sidebar .app-sidebar-caret {
        display: block;
        position: absolute;
        right: 18px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--accent-primary);
        transition: transform 0.25s ease;
    }
    .sidebar.app-sidebar.open .app-sidebar-caret {
        transform: translateY(-50%) rotate(180deg);
    }
    .sidebar.app-sidebar ul {
        display: block;
        height: auto;
        justify-content: initial;
        overflow: visible;
        padding: 6px 0;
    }
    .sidebar.app-sidebar li {
        flex: none;
        text-align: left;
        margin-top: 0;
    }
    .sidebar.app-sidebar a {
        display: block;
        font-size: 1.05rem;
        padding: 13px 28px;
        text-align: center;
    }
    .sidebar.app-sidebar .app-sidebar-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin: 0;
        display: none;
        background-color: var(--bg-primary);
        border: none;
        border-bottom: 2px solid var(--accent-primary);
        box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
        z-index: 1000;
    }
    .sidebar.app-sidebar.open .app-sidebar-menu {
        display: block;
    }
}

@media (prefers-color-scheme: dark) {
    .sidebar.app-sidebar {
        background-color: var(--bg-secondary);
    }
    .sidebar.app-sidebar .app-sidebar-menu {
        background-color: var(--bg-secondary);
    }
}

/* =======================================
   Responsive: Marketing navbar & sidebar (index, login, etc.)
   ======================================= */
@media (max-width: 700px) {
    .name {
        font-size: 1.1em;
    }
    .sidebar a {
        font-size: 0.9em;
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 10px;
    }
    .logo {
        width: 30px;
        height: 30px;
    }
    .name {
        font-size: 0.95em;
    }
    .sidebar ul {
        padding-left: 8px;
        padding-right: 8px;
    }
    .sidebar a {
        font-size: 0.78em;
        padding: 8px 5px;
    }
}

/* =======================================
   Notification bell + popup
   ======================================= */
#notif-bell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: 10px;
    padding: 0;
    border: 1px solid var(--bg-primary);
    border-radius: 50%;
    background: transparent;
    color: var(--bg-primary);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

#notif-bell:hover {
    background: var(--bg-primary);
    color: var(--accent-primary);
}

#notif-bell .notif-icon {
    width: 22px;
    height: 22px;
    display: none;
}

#notif-bell.has-unread .notif-unread {
    display: block;
}

#notif-bell:not(.has-unread) .notif-read {
    display: block;
}

/* Notification popup (self-contained: also used on pages that don't load
   planning.css, e.g. the floor plan tool) */
.notif-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20000;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y pinch-zoom;
}

.notif-overlay .notif-popup {
    max-width: 620px;
    width: 90%;
    background: var(--bg-secondary);
    border: 4px solid var(--accent-primary);
    border-radius: 25px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
    max-height: calc(100vh - 40px);
    overflow-x: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y pinch-zoom;
}

.notif-overlay .notif-popup h3 {
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.notif-overlay .notif-popup .popup-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.notif-overlay .notif-popup .popup-btn {
    flex: 0 1 auto;
    padding: 10px 18px;
    min-height: 44px;
    font-size: 0.95em;
    border-radius: 25px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}

.notif-overlay .notif-popup .popup-btn.cancel {
    background: transparent;
    border: 2px solid var(--accent-primary);
    color: var(--text-secondary);
}

.notif-overlay .notif-popup .popup-btn.cancel:hover {
    background: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    color: #FFFFFF;
    font-weight: bold;
}

.notif-overlay .notif-popup .popup-btn.confirm {
    background: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    color: #FFFFFF;
    font-weight: 600;
}

.notif-overlay .notif-popup .popup-btn.confirm:hover {
    background: var(--accent-secondary);
    border: 2px solid var(--accent-secondary);
    font-weight: bold;
}

.notif-overlay .notif-popup #notif-delete {
    background: transparent;
    border-color: var(--delete-red);
    color: var(--delete-red);
}

.notif-overlay .notif-popup #notif-delete:hover:not(:disabled) {
    background: var(--delete-red);
    border-color: var(--delete-red);
    color: #FFFFFF;
}

.notif-list {
    max-height: 440px;
    overflow-y: auto;
    text-align: left;
    margin-bottom: 16px;
}

.notif-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 16px 0;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    background: var(--bg-primary);
}

.notif-item:hover {
    border-color: var(--accent-primary);
}

.notif-item.selected {
    border-color: var(--accent-primary);
    background: var(--hover-bg);
}

.notif-select-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: none;
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    color: var(--accent-primary);
    font-weight: 700;
}

.notif-overlay .notif-popup .popup-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.notif-item.read {
    opacity: 0.6;
}

.notif-item-main {
    flex: 1;
    min-width: 0;
}

.notif-item-main strong {
    display: block;
    font-size: 0.95em;
}

.notif-item-main p {
    margin: 4px 0 0;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.notif-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.notif-action {
    padding: 6px 12px;
    border: 1px solid var(--accent-primary);
    border-radius: 999px;
    background: transparent;
    color: var(--accent-primary);
    cursor: pointer;
    font: inherit;
    font-size: 0.78em;
    font-weight: 600;
}

.notif-action:hover {
    background: var(--accent-primary);
    color: #FFFFFF;
}

.notif-action.reject {
    border-color: var(--delete-red);
    color: var(--delete-red);
}

.notif-action.reject:hover {
    background: var(--delete-red);
    color: #FFFFFF;
}

.notif-item-time {
    flex: none;
    font-size: 0.75em;
    color: var(--text-secondary);
    white-space: nowrap;
}
