/* Scroll Navbar (Glass Effect) */
.scroll-navbar {
    opacity: 0;
    visibility: hidden;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    margin: 10px;
    padding: 0.05rem 1rem; /* Reduced from 0.5rem to shrink height */
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    cursor: pointer; /* Indicate the navbar is clickable */
}

.scroll-navbar.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

/* Collapsed Circle State */
.scroll-navbar.collapsed {
    background: none; /* Remove background for the container */
    backdrop-filter: none; /* Remove blur for the container */
    border-radius: 0;
    margin: 0;
    padding: 0;
}

.scroll-navbar-circle {
    display: none; /* Hidden by default */
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.scroll-navbar.collapsed .scroll-navbar-circle {
    display: flex; /* Show circle only when collapsed */
    animation: collapseToCircle 0.5s ease forwards;
}

/* Ensure the circle is hidden when not collapsed */
.scroll-navbar:not(.collapsed) .scroll-navbar-circle {
    display: none !important; /* Explicitly hide when not collapsed */
}

.scroll-navbar-circle img.navbar-logo {
    width: 40px;
    height: 40px;
}

/* Expanded Navbar Content */
.scroll-navbar-content {
    display: block;
}

.scroll-navbar.collapsed .scroll-navbar-content {
    display: none; /* Hide content when collapsed */
}

/* Animations */
@keyframes collapseToCircle {
    0% {
        width: 100%;
        height: 70px;
        border-radius: 25px;
        transform: translateX(0);
        left: 0;
    }
    50% {
        width: 200px;
        height: 70px;
        border-radius: 50px;
        transform: translateX(-50%);
        left: 50%;
    }
    100% {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        transform: translateX(-50%);
        left: 50%;
    }
}

@keyframes expandFromCircle {
    0% {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        transform: translateX(-50%);
        left: 50%;
    }
    50% {
        width: 200px;
        height: 70px;
        border-radius: 50px;
        transform: translateX(-50%);
        left: 50%;
    }
    100% {
        width: 100%;
        height: 70px;
        border-radius: 25px;
        transform: translateX(0);
        left: 0;
    }
}

/* Navbar Controls (Terminal Button) */
.navbar-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Prevent clicks on links and icons from triggering collapse */
.scroll-navbar .navbar-brand,
.scroll-navbar .navbar-logo,
.scroll-navbar .navbar-text-container,
.scroll-navbar .navbar-title,
.scroll-navbar .navbar-subtitle,
.scroll-navbar .mobile-terminal-btn,
.scroll-navbar .nav-link {
    cursor: default; /* Prevent these elements from triggering the collapse */
    pointer-events: auto; /* Ensure links/icons are still clickable */
}

/* Existing Styles (Unchanged) */
.scroll-navbar .navbar-brand {
    font-weight: 700;
    display: flex;
    align-items: flex-start; /* Align top to match icon height */
}

.scroll-navbar .navbar-logo {
    width: 45px; /* Matches title + subtitle height (desktop) */
    height: 45px;
    margin-right: 4px;
}

.scroll-navbar .navbar-text-container {
    display: flex;
    flex-direction: column;
    gap: 0px; /* No gap */
}

.scroll-navbar .navbar-title {
    display: inline-block;
    font-size: 1.6rem;
    white-space: nowrap;
    overflow: hidden;
    margin: 0;
    padding: 0;
    animation: none !important; /* Explicitly disable any animation */
}

.scroll-navbar .navbar-subtitle {
    color: #DC2626; /* Primary color */
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    margin: 0;
    padding: 0;
    margin-top: -8px; /* Pull subtitle closer to title */
}

.scroll-navbar .navbar-subtitle::after {
    content: '|';
    color: #ffffff; /* White cursor */
    animation: blink 0.7s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

.scroll-navbar .nav-link {
    color: #ffffff;
    margin: 0 0.5rem;
    transition: color 0.3s ease;
}

.scroll-navbar .nav-link:hover {
    color: #DC2626;
}

/* Mobile Terminal Controls */
.scroll-navbar .mobile-terminal-controls {
    display: none; /* Hidden by default */
    align-items: center;
}

.scroll-navbar .mobile-terminal-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.2rem;
    padding: 0.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.scroll-navbar .mobile-terminal-btn:hover {
    color: #DC2626;
    transform: scale(1.1);
}

/* Mobile Responsiveness for Scroll Navbar */
@media (max-width: 767px) {
    .scroll-navbar .navbar-nav {
        display: none !important; /* Hide nav links on mobile */
    }
    .scroll-navbar .navbar {
        display: flex;
        justify-content: space-between; /* Space between brand and controls */
        align-items: center; /* Center vertically */
    }
    .scroll-navbar .navbar-brand {
        margin: 0;
        align-items: flex-start;
    }
    .scroll-navbar .navbar-logo {
        width: 40px; /* Matches title + subtitle height (mobile) */
        height: 40px;
        margin-right: 3px; /* Match main-navbar mobile */
    }
    .scroll-navbar .navbar-title {
        font-size: 1.2rem; /* Match main-navbar mobile */
        animation: none !important; /* Explicitly disable any animation */
    }
    .scroll-navbar .navbar-subtitle {
        font-size: 0.7rem;
        margin-top: -4px; /* Slightly less aggressive on mobile */
    }
    .scroll-navbar .navbar-text-container {
        gap: 0px; /* No gap on mobile */
    }
    .scroll-navbar .mobile-terminal-controls {
        display: flex; /* Show on mobile */
    }
    .scroll-navbar-circle {
        width: 50px;
        height: 50px;
    }
    .scroll-navbar-circle img.navbar-logo {
        width: 40px; /* Increased size for mobile */
        height: 40px; /* Increased size for mobile */
    }
}

@media (min-width: 768px) {
    .scroll-navbar .navbar-nav {
        flex-direction: row;
        display: flex;
    }
    .scroll-navbar .navbar-brand {
        margin-left: 0; /* Left-align on desktop */
    }
    .scroll-navbar .mobile-terminal-controls {
        display: none; /* Hide on desktop */
    }
}