/* ========================================
   Blue Radio — Sidebar Layout
   ======================================== */

/* --- Sidebar Variables --- */
:root {
    --sidebar-width: 260px;
    --mobile-topbar-height: 60px;
}

/* --- Layout --- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-smooth);
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transition: transform var(--transition-smooth);
}

/* --- Scrollable Area --- */
.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Scrollbar styling */
.sidebar-scrollable::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
}

.sidebar-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* --- 1. Logo --- */
.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-logo .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
}

.sidebar-logo .logo-icon {
    font-size: 28px;
    color: var(--blue);
    filter: drop-shadow(0 0 6px var(--blue-glow));
}

.sidebar-logo .logo-text {
    color: var(--text-primary);
}

.sidebar-logo .logo-highlight {
    color: var(--blue);
}

/* --- Section Labels --- */
.sidebar-section {
    padding: 16px 12px 8px;
    flex-shrink: 0;
}

.sidebar-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

/* --- Navigation Links --- */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.sidebar-link .material-icons {
    font-size: 20px;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--blue-muted);
    color: var(--text-primary);
}

.sidebar-link:hover .material-icons {
    color: var(--blue);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    color: #ffffff;
    box-shadow: 0 4px 16px var(--blue-glow);
    font-weight: 600;
}

.sidebar-link.active .material-icons {
    color: #ffffff;
}

/* --- 2-Column Grid (Categories & Countries) --- */
.sidebar-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 4px;
}

.sidebar-tile {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 8px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    overflow: hidden;
    min-width: 0;
}

.sidebar-tile>span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sidebar-tile:hover {
    border-color: var(--tile-color, var(--blue));
    background: rgba(0, 0, 0, 0.015);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Category tile icon with colored bg */
.sidebar-tile-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--tile-color, #2950aa) 12%, transparent);
    transition: all var(--transition-fast);
}

.sidebar-tile-icon .material-icons {
    font-size: 15px;
    color: var(--tile-color, #2950aa);
}

.sidebar-tile:hover .sidebar-tile-icon {
    background: color-mix(in srgb, var(--tile-color, #2950aa) 18%, transparent);
    transform: scale(1.05);
}

/* Country tile flag — round image */
.sidebar-tile-flag-img {
    width: 26px;
    height: 26px;
    border-radius: 20px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sidebar-tile-country {
    --tile-color: #5a5a7a;
}

/* ── Show more / hidden tiles ── */
.sidebar-tile--hidden {
    display: none;
}

.sidebar-show-more {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    margin-top: 6px;
    border-radius: 20px;
    border: 1px dashed var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    justify-content: center;
}

.sidebar-show-more:hover {
    background: var(--blue-muted);
    border-color: var(--blue);
    color: var(--blue);
}

.sidebar-show-more .material-icons {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.sidebar-show-more[aria-expanded="true"] .material-icons {
    transform: rotate(180deg);
}

.sidebar-show-more em {
    font-style: normal;
    opacity: 0.7;
    font-size: 0.7rem;
}

/* ========================================
   CONTENT TOP BAR (Search Header)
   ======================================== */
.content-topbar {
    position: sticky;
    top: 0;
    z-index: 300;
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    padding: 0 32px;
    overflow: visible;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 77px;
    max-width: 1400px;
    margin: 0 auto;
}

.topbar-left {
    flex-shrink: 0;
}

.topbar-greeting {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Search Bar */
.topbar-center {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: flex-start;
}

.topbar-search {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin-left: -77px;
}

.topbar-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 21px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.topbar-search-input {
    width: 100%;
    padding: 10px 23px 14px 44px;
    border-radius: 30px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition-fast);
}

.topbar-search-input::placeholder {
    color: var(--text-muted);
}

.topbar-search-input:focus {
    border-color: var(--blue);
    background: #ffffff;
    box-shadow: 0 0 0 3px var(--blue-muted);
}

.topbar-search-input:focus~.topbar-search-icon,
.topbar-search:focus-within .topbar-search-icon {
    color: var(--blue);
}

/* Clear button */
.topbar-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    padding: 0;
}

.topbar-search-clear:hover {
    background: rgba(0, 0, 0, 0.14);
    color: var(--text-primary);
}

.topbar-search-clear .material-icons {
    font-size: 15px;
}

/* ---- Live Search Dropdown ---- */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    z-index: 500;
    overflow: hidden;
    display: none;
    animation: dropdownIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.search-dropdown.open {
    display: block;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.search-dropdown-inner {
    max-height: 460px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
}

.search-dropdown-inner::-webkit-scrollbar {
    width: 4px;
}

.search-dropdown-inner::-webkit-scrollbar-track {
    background: transparent;
}

.search-dropdown-inner::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* Results header */
.search-dropdown-header {
    padding: 8px 12px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* Each result row */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    text-decoration: none;
    color: inherit;
    position: relative;
}

.search-result-item:hover,
.search-result-item.focused {
    background: var(--bg-secondary);
}

/* Logo thumbnail with flag badge */
.search-result-logo-wrap {
    position: relative;
    flex-shrink: 0;
}

.search-result-logo {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    object-fit: cover;
    display: block;
    background: var(--bg-secondary);
}

.search-result-flag {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.search-result-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Text info */
.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.search-result-name mark {
    background: transparent;
    color: var(--blue);
    font-weight: 800;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.search-result-category {
    display: flex;
    align-items: center;
    gap: 3px;
}

.search-result-category .material-icons {
    font-size: 12px;
}

.search-result-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
    flex-shrink: 0;
}

.search-result-country {
    font-size: 0.72rem;
}

/* Play button on hover */
.search-result-play {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0.8);
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
}

.search-result-item:hover .search-result-play,
.search-result-item.focused .search-result-play {
    opacity: 1;
    transform: scale(1);
}

.search-result-play .material-icons {
    font-size: 18px;
}

/* Empty state */
.search-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
}

.search-empty .material-icons {
    font-size: 36px;
    margin-bottom: 8px;
    color: var(--text-muted);
    opacity: 0.5;
}

.search-empty p {
    font-size: 0.85rem;
}

/* See all results footer */
.search-dropdown-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 6px;
    margin-top: 2px;
}

.search-see-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
    transition: background var(--transition-fast);
}

.search-see-all:hover {
    background: var(--blue-muted);
}

.search-see-all .material-icons {
    font-size: 16px;
}

/* Right side — icons */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.topbar-btn:hover {
    background: var(--blue-muted);
    color: var(--blue);
}

.topbar-btn .material-icons {
    font-size: 22px;
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.topbar-avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 12px var(--blue-glow);
}

.topbar-avatar .material-icons {
    font-size: 20px;
    color: #ffffff;
}

.topbar-avatar-letter {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    text-transform: uppercase;
    font-family: inherit;
    pointer-events: none;
    user-select: none;
}

/* --- 5. Footer --- */
.sidebar-footer {
    margin-top: auto;
    flex-shrink: 0;
    padding: 12px 12px 16px;
}

/* Brand block */
.sidebar-footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 30px;
    background: linear-gradient(135deg, #1e3d7a 0%, #2950aa 60%, #3a6fd8 100%);
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}

.sidebar-footer-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.sidebar-footer-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-footer-logo .material-icons {
    font-size: 18px;
    color: #ffffff;
}

.sidebar-footer-brand-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.sidebar-footer-name {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.sidebar-footer-name strong {
    color: #ffffff;
    font-weight: 800;
}

.sidebar-footer-slogan {
    font-size: 0.66rem;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}

/* Animated equalizer bars */
.sidebar-footer-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer-bars span {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.5);
    animation: footerBar 1.4s ease-in-out infinite;
}

.sidebar-footer-bars span:nth-child(1) {
    height: 6px;
    animation-delay: 0s;
}

.sidebar-footer-bars span:nth-child(2) {
    height: 14px;
    animation-delay: 0.2s;
}

.sidebar-footer-bars span:nth-child(3) {
    height: 10px;
    animation-delay: 0.1s;
}

.sidebar-footer-bars span:nth-child(4) {
    height: 16px;
    animation-delay: 0.35s;
}

.sidebar-footer-bars span:nth-child(5) {
    height: 8px;
    animation-delay: 0.25s;
}

@keyframes footerBar {

    0%,
    100% {
        transform: scaleY(0.4);
        opacity: 0.5;
    }

    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Links */
.sidebar-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 6px;
    margin-bottom: 6px;
    padding: 0 2px;
}

.sidebar-footer-links a {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 6px;
    border-radius: 7px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
}

.sidebar-footer-links a .material-icons {
    font-size: 14px;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.sidebar-footer-links a:hover {
    background: var(--blue-muted);
    color: var(--blue);
    border-color: rgba(41, 80, 170, 0.15);
}

.sidebar-footer-links a:hover .material-icons {
    color: var(--blue);
}

/* Social */
.sidebar-footer-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 0 4px;
}

.sidebar-footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.sidebar-footer-social a:hover {
    background: var(--blue-muted);
    color: var(--blue);
    transform: translateY(-2px);
}

.sidebar-footer-social a svg {
    width: 15px;
    height: 15px;
}

[data-theme="dark"] .sidebar-footer-social a {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .sidebar-footer-social a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* Copyright */
.sidebar-copyright {
    font-size: 0.64rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
    padding: 4px 4px 0;
    border-top: 1px solid var(--sidebar-border);
}

/* --- Mobile Topbar --- */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-topbar-height);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--sidebar-border);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 999;
}

.mobile-topbar .logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
}

.mobile-topbar .logo-icon {
    font-size: 24px;
    color: var(--blue);
}

.mobile-logo {
    height: 34px;
    width: auto;
    object-fit: contain;
    display: block;
}

.mobile-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-topbar-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-topbar-btn:hover {
    background: var(--blue-muted);
    color: var(--blue);
}

.mobile-topbar-btn .material-icons {
    font-size: 22px;
}

.menu-toggle {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--blue-muted);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: 2px;
}

/* --- Sidebar Overlay (mobile) --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 998;
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ========================================
   USER DROPDOWN
   ======================================== */
.topbar-user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 54px;
    right: 0;
    width: 240px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, rgba(0,0,0,0.08));
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    z-index: 1001;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s ease;
}

.user-dropdown-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.user-dropdown-header {
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.user-dropdown-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary, #111);
}

.user-dropdown-email {
    font-size: 0.8rem;
    color: var(--text-muted, #777);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color, rgba(0,0,0,0.08));
    margin: 4px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary, #444);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    font-family: inherit;
}

.user-dropdown-item:hover {
    background: var(--blue-muted, #f0f4ff);
    color: var(--blue, #2950aa);
}

.user-dropdown-item .material-icons {
    font-size: 20px;
}

.user-logout-btn {
    color: #ef4444 !important;
}

.user-logout-btn:hover {
    background: rgba(239, 68, 68, 0.05) !important;
}

/* ========================================
   RESPONSIVE — Sidebar
   ======================================== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.1);
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar-overlay.active {
        pointer-events: auto;
    }

    .mobile-topbar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding-top: var(--mobile-topbar-height);
    }

    .content-topbar {
        display: none;
        padding: 0 16px;
        top: var(--mobile-topbar-height);
        z-index: 100;
        background: var(--topbar-bg);
        border-bottom: 1px solid var(--sidebar-border);
    }

    .content-topbar.active {
        display: block;
        animation: topbarSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

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

    .topbar-greeting {
        display: none;
    }

    .topbar-search {
        max-width: 100%;
    }

    .content-topbar .topbar-right {
        display: none;
    }
}

/* --- User Dropdown Mobile Fixes --- */
@media (max-width: 900px) {
    body.user-menu-open .content-topbar {
        display: block !important;
        height: 0;
        padding: 0;
        overflow: visible;
        border: none;
        background: transparent;
    }
    
    body.user-menu-open .content-topbar .topbar-center,
    body.user-menu-open .content-topbar .topbar-greeting {
        display: none !important;
    }

    body.user-menu-open .content-topbar .topbar-right {
        display: block !important;
        position: static;
    }

    /* Hide other desktop topbar items when mobile user menu is open */
    body.user-menu-open .content-topbar .topbar-right > *:not(.topbar-user-menu) {
        display: none !important;
    }

    /* Hide the desktop avatar itself on mobile when the menu is active */
    body.user-menu-open .topbar-avatar {
        display: none !important;
    }

    .user-dropdown {
        position: fixed !important;
        top: calc(var(--mobile-topbar-height) + 12px) !important;
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        margin-top: -53px !important;
        z-index: 1501 !important;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .user-dropdown-open {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        display: block !important;
    }
}

/* ========================================
   NOTIFICATION BUTTON — badge
   ======================================== */
.topbar-notif-wrapper {
    position: relative;
}

.topbar-btn.active {
    background: var(--blue-muted);
    color: var(--blue);
}

.notif-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #FF3B30;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
    box-sizing: border-box;
    /* Use box-shadow for a sharper outer stroke and drop shadow instead of a muddy border */
    box-shadow: 0 0 0 2.5px #ffffff, 0 4px 8px rgba(0, 0, 0, 0.15);
    animation: badgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 5;
}

@keyframes badgePop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================
   NOTIFICATION DROPDOWN
   ======================================== */
.notif-dropdown {
    position: fixed;
    top: 80px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.13), 0 4px 16px rgba(0, 0, 0, 0.06);
    z-index: 1500;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transform-origin: top right;
    transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 660px) {
    .notif-dropdown {
        top: calc(var(--mobile-topbar-height) + 12px) !important;
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        max-width: 100vw !important;
        transform-origin: top center;
    }
    .notif-list {
        max-height: calc(100vh - 180px) !important;
    }
    .notif-dropdown-header {
        padding: 14px 14px 10px !important;
    }
    .notif-dropdown-title {
        font-size: 0.9rem !important;
    }
    .notif-mark-all {
        font-size: 0.72rem !important;
    }
}

.notif-dropdown--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Dropdown header */
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.notif-dropdown-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-dropdown-title .material-icons {
    font-size: 18px;
    color: var(--blue);
}

.notif-mark-all {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--blue);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background var(--transition-fast);
}

.notif-mark-all:hover {
    background: var(--blue-muted);
}

/* Notification list */
.notif-list {
    max-height: 420px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
}

.notif-list::-webkit-scrollbar {
    width: 4px;
}

.notif-list::-webkit-scrollbar-track {
    background: transparent;
}

.notif-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* Notification item */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
}

.notif-item:hover {
    background: var(--bg-secondary);
}

.notif-item--unread {
    background: rgba(41, 80, 170, 0.03);
}

.notif-item--unread:hover {
    background: rgba(41, 80, 170, 0.07);
}

.notif-item-logo {
    position: relative;
    flex-shrink: 0;
}

.notif-item-logo img {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: block;
}

.notif-item-icon-only {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.notif-item-icon-only .material-icons {
    font-size: 24px;
}

.notif-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 1px 3px rgba(41, 80, 170, 0.4);
}


/* ── Flag badge — bottom-right corner of logo thumbnail ── */
.notif-item-flag-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    border: 2.5px solid var(--bg-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.05);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    flex-shrink: 0;
}

.notif-item-flag {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.notif-item-flag-emoji {
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Country chip shown in notification content ── */
.notif-item-country {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.07);
    padding: 1px 7px 1px 2px;
    border-radius: 99px;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
}

.notif-item-country-flag {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.notif-item-country-emoji {
    font-size: 13px;
    line-height: 1;
}


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

.notif-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.notif-item-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 2px 7px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--tag-color, #2950aa) 12%, transparent);
    color: var(--tag-color, #2950aa);
}

.notif-item-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.notif-item-title {
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-desc {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notif-item-arrow {
    font-size: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
    align-self: center;
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.notif-item:hover .notif-item-arrow {
    transform: translateX(3px);
    color: var(--blue);
}

/* Empty state */
.notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.notif-empty .material-icons {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.35;
    display: block;
}

.notif-empty p {
    font-size: 0.85rem;
}

/* ========================================
   NOTIFICATION DETAIL MODAL
   ======================================== */
.notif-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 40, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.notif-detail-overlay[hidden] {
    display: none !important;
}

.notif-detail-overlay.notif-detail-open {
    opacity: 1;
    pointer-events: auto;
}

.notif-detail-overlay.notif-detail-open .notif-detail-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.notif-detail-modal {
    background: var(--bg-card);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transform: translateY(20px) scale(0.97);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

/* Modal hero banner */
.notif-detail-hero {
    position: relative;
    padding: 32px 24px 20px;
    background: var(--bg-secondary);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.notif-detail-logo-wrap {
    flex-shrink: 0;
    position: relative;
}

.notif-detail-logo {
    width: 68px;
    height: 68px;
    border-radius: 14px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: block;
}

.notif-detail-icon-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.notif-detail-icon-badge .material-icons {
    font-size: 14px;
}

/* Flag badge — top-left of modal logo */
.notif-detail-flag-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    border: 2.5px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Country name row */
.notif-detail-country-row {
    margin-bottom: 8px;
}

.notif-detail-country {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.07);
    padding: 3px 9px;
    border-radius: 99px;
}


.notif-detail-hero-info {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
}

.notif-detail-hero-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.notif-detail-tag {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 3px 10px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--tag-color, #2950aa) 13%, transparent);
    color: var(--tag-color, #2950aa);
}

.notif-detail-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.notif-detail-date .material-icons {
    font-size: 14px;
}

.notif-detail-hero-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Modal close button */
.notif-detail-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.notif-detail-close:hover {
    background: rgba(0, 0, 0, 0.12);
    color: var(--text-primary);
}

.notif-detail-close .material-icons {
    font-size: 18px;
}

/* Modal body */
.notif-detail-body {
    padding: 22px 24px 28px;
}

.notif-detail-short {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    line-height: 1.5;
}

.notif-detail-full {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 22px;
}

.notif-detail-actions {
    display: flex;
    gap: 10px;
}

.notif-detail-actions .btn {
    flex: 1;
    justify-content: center;
}

@media (max-width: 500px) {
    .notif-detail-modal {
        max-width: calc(100vw - 32px) !important;
    }
    .notif-detail-hero {
        padding: 30px 18px 18px !important;
        gap: 12px !important;
    }
    .notif-detail-logo {
        width: 60px !important;
        height: 60px !important;
    }
    .notif-detail-hero-title {
        font-size: 1rem !important;
    }
    .notif-detail-body {
        padding: 18px 20px 24px !important;
    }
    .notif-detail-actions {
        flex-direction: column-reverse !important;
        gap: 12px !important;
    }
    .notif-detail-actions .btn {
        width: 100% !important;
        padding: 12px !important;
    }
}