/* === GLOBAL RESET ===
   Override the default ASP.NET sticky-footer margins from site.css so the
   100vh app shell fills the viewport exactly (no bare strip at the bottom). */
html, body {
    margin: 0;
}

/* === APP LAYOUT === */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: #f8fafc;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0f172a;
}

/* === SIDEBAR === */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 10;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0d6efd;
    text-decoration: none;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.nav-item:hover { background: #f1f5f9; color: #0f172a; }
.nav-item.active { background: #d1e6ff; color: #0d6efd; }
.nav-item i { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    color: #dc2626;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: all 0.2s;
    border-radius: 8px;
    font-size: 0.95rem;
}

.logout-btn:hover { background: #fee2e2; color: #b91c1c; }

.user-profile-sm {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
}

a.user-profile-sm {
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
}

a.user-profile-sm:hover { background: #f1f5f9; }
a.user-profile-sm.active { background: #eff6ff; }

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #64748b;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-info-sm h4 { margin: 0; font-size: 0.9rem; color: #0f172a; }
.user-info-sm p { margin: 0; font-size: 0.75rem; color: #64748b; font-weight: 600; }

/* Competency rank below the username (derived from the readiness score) */
.user-info-sm p.rank-mastered { color: #10b981; }
.user-info-sm p.rank-developing { color: #0d6efd; }
.user-info-sm p.rank-emerging { color: #ef4444; }

/* === MAIN CONTENT AREA === */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #f8fafc;
}

/* === TOP NAV === */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
}

.search-container {
    width: 400px;
    height: 45px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    color: #64748b;
}

.search-container input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    color: #0f172a;
}

.search-container input::placeholder { color: #94a3b8; }

.top-nav-icons {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #64748b;
    font-size: 1.2rem;
    margin-left: auto;
}

.nav-icon-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-icon-btn:hover { background: #f1f5f9; color: #0f172a; }

/* Profile chip in the top nav (avatar + username) */
.nav-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    padding: 4px 10px 4px 4px;
    border-radius: 25px;
    transition: background 0.2s;
}

.nav-profile:hover { background: #f1f5f9; }

.nav-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: #e2e8f0;
    border: 1px solid #e2e8f0;
}

.nav-username {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
}

/* === NOTIFICATION BELL & DROPDOWN === */
.notif-bell-wrapper {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    pointer-events: none;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 380px;
    max-height: 440px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: notifSlideDown 0.2s ease;
}

.notif-dropdown.active {
    display: flex;
}

@keyframes notifSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f1f5f9;
}

.notif-dropdown-header h6 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.notif-mark-all {
    font-size: 0.78rem;
    font-weight: 600;
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.notif-mark-all:hover {
    color: #0b5ed7;
}

.notif-dropdown-list {
    flex: 1;
    overflow-y: auto;
    max-height: 320px;
}

.notif-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}

.notif-dropdown-item:hover {
    background: #f8fafc;
}

.notif-dropdown-item.unread {
    background: #eff6ff;
}

.notif-dropdown-item.unread:hover {
    background: #dbeafe;
}

.notif-dropdown-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #eff6ff;
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-dropdown-item.unread .notif-dropdown-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.notif-dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.notif-dropdown-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.notif-dropdown-message {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-dropdown-time {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
    margin-top: 2px;
}

.notif-dropdown-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    color: #94a3b8;
    gap: 8px;
}

.notif-dropdown-empty i {
    font-size: 1.5rem;
}

.notif-dropdown-empty p {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 500;
}

.notif-dropdown-footer {
    padding: 10px 20px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}

.notif-dropdown-footer a {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.2s;
}

.notif-dropdown-footer a:hover {
    color: #0b5ed7;
}

/* === HAMBURGER (hidden on desktop, mirrors landing .lp-hamburger) === */
.app-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
}
.app-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #0f172a;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* === MOBILE PANEL (top-down dropdown, mirrors landing .lp-nav__links.active) === */
.app-mobile-panel {
    display: none;
}

@media (max-width: 1199.98px) {
    .app-hamburger { display: flex; }
    .sidebar { display: none; }
    .top-nav {
        padding: 14px 16px;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 900;
    }
    /* 992-1200px tier keeps search wide (~400px) since the sidebar freed ~260px */
    .search-container {
        width: 100%;
        max-width: 400px;
        height: 40px;
    }
    .nav-username { display: none; }
    .notif-dropdown {
        position: fixed;
        top: 70px;
        left: 16px;
        right: 16px;
        width: auto;
    }
    .app-mobile-panel {
        display: flex;
        position: fixed;
        top: 70px;
        left: 2.5%;
        right: 2.5%;
        background: #fff;
        border-radius: 16px;
        flex-direction: column;
        padding: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
        border: 1px solid #f1f5f9;
        z-index: 899;
        text-align: left;
        max-height: calc(100vh - 90px);
        overflow-y: auto;
    }
    .app-mobile-panel[hidden] { display: none; }
    /* Cloned content keeps sidebar spacing: features on top, logout/account separated at bottom */
    .app-mobile-panel .nav-links { flex-grow: 0; }
    .app-mobile-panel .sidebar-bottom {
        margin-top: 12px;
        padding-top: 12px;
    }
    .app-mobile-panel .diagnostic-cta { margin-bottom: 12px; }
}

/* Phone/tablet tier only: shrink search to 280px below 992px */
@media (max-width: 991.98px) {
    .search-container {
        max-width: 280px;
    }
}

@media (max-width: 575.98px) {
    .search-container { max-width: none; }
    .search-container input::placeholder { font-size: 0.8rem; }
    .top-nav-icons { gap: 4px; }
}