:root {
    --topnav-height: 3.75rem;
    --topnav-bg: color-mix(in srgb, var(--background, #0f172a) 88%, white 12%);
    --topnav-border: color-mix(in srgb, var(--background, #0f172a) 72%, white 28%);
    --topnav-text: var(--text-primary, #f1f5f9);
    --topnav-muted: var(--text-secondary, #94a3b8);
    --topnav-hover: color-mix(in srgb, var(--background, #0f172a) 78%, white 22%);
    --topnav-badge-bg: #ef4444;
    --topnav-badge-text: #ffffff;
}

html,
body {
    height: 100%;
    background: transparent;
    margin: 0;
    padding: 0;
    /* Add these to prevent horizontal overflow */
    overflow-x: hidden;
    max-width: 100vw;
}

.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw; /* Add this */
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Add this */
}

/* TopNav Styles */
.topnav {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--topnav-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    width: 100%;
    max-width: 100vw; /* Add this */
    margin: 0;
    box-sizing: border-box;
    
    /* Darker gradient background for distinction */
    background: linear-gradient(135deg, #0d2e24 0%, #1a3d32 50%, #1f4a3d 100%);
    
    /* Subtle radial gradients for depth */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(16, 185, 129, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 50%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
        linear-gradient(135deg, #0d2e24 0%, #1a3d32 50%, #1f4a3d 100%);
    
    /* Glass morphism effect */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    /* Distinguished border with glow */
    border-bottom: 2px solid rgba(16, 185, 129, 0.5);
    
    /* Shadow for depth */
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(16, 185, 129, 0.15),
        inset 0 -1px 0 rgba(16, 185, 129, 0.3);
    
    position: relative;
    overflow: hidden;
}

/* Animated shimmer effect */
.topnav::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(16, 185, 129, 0.08) 25%,
        rgba(59, 130, 246, 0.06) 50%,
        rgba(139, 92, 246, 0.05) 75%,
        transparent 100%
    );
    animation: topnav-shimmer 8s infinite linear;
    pointer-events: none;
}

/* Top glow accent */
.topnav::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--primary-color) 20%,
        var(--secondary-color) 50%,
        var(--accent-color) 80%,
        transparent 100%
    );
    opacity: 0.5;
}

@keyframes topnav-shimmer {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(50%);
    }
}

.topnav__left,
.topnav__center,
.topnav__right {
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1;
}

.topnav__left {
    justify-content: flex-start;
    min-width: auto;
    flex-shrink: 1;
}

.topnav__center {
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.topnav__right {
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: auto;
    flex-shrink: 1;
}

.topnav__title {
    margin: 0;
    color: var(--topnav-text);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50vw;
    flex-shrink: 1;
    /* Enhanced text shadow for better visibility */
    text-shadow: 
        0 0 10px rgba(16, 185, 129, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

.topnav__icon-btn {
    position: relative;
    width: 2.4rem;
    height: 2.4rem;
    border: 0;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.topnav__icon-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    transform: scale(1.05);
}

.topnav__icon-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.topnav__icon-btn[disabled],
.topnav__icon-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.45;
    background: rgba(16, 185, 129, 0.05);
}

.topnav__icon-btn[disabled]:hover,
.topnav__icon-btn[aria-disabled="true"]:hover {
    transform: none;
    box-shadow: none;
}

.topnav__icon {
    font-size: 1.5rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.topnav__bell-icon,
.topnav__settings-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.topnav__notifications-btn {
    position: relative;
}

.topnav__badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.25rem;
    border-radius: 9999px;
    background: var(--topnav-badge-bg);
    color: var(--topnav-badge-text);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
    box-shadow: 
        0 2px 8px rgba(239, 68, 68, 0.6),
        0 0 0 2px rgba(13, 46, 36, 0.8);
    animation: topnav-badge-pulse 2s infinite;
}

@keyframes topnav-badge-pulse {
    0%, 100% {
        box-shadow: 
            0 2px 8px rgba(239, 68, 68, 0.6),
            0 0 0 2px rgba(13, 46, 36, 0.8);
    }
    50% {
        box-shadow: 
            0 2px 12px rgba(239, 68, 68, 0.8),
            0 0 0 2px rgba(13, 46, 36, 0.8),
            0 0 20px rgba(239, 68, 68, 0.4);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .topnav {
        padding: 1rem 1rem;
        height: 3.5rem;
    }

    .topnav__title {
        font-size: 1.125rem;
        max-width: 60vw;
    }

    .topnav__icon-btn {
        width: 2.2rem;
        height: 2.2rem;
    }
    
    .topnav__right {
        gap: 0.375rem;
    }
}

.topnav__back-btn {
    visibility: visible;
    display: flex;
}

.topnav__back-btn[disabled] {
    visibility: hidden;
}