/* Consistent card heights or spacing */
.card.h-100 {
    height: 100%;
}

/* Basic styling for the chart containers if needed */
canvas {
    max-width: 100%;
    max-height: 100px;
    /* Smaller height for micro-charts */
    height: auto;
}

/* Styles for smaller text in statistics cards */
.card-body.p-2 .card-title {
    font-size: 0.75rem;
    /* Smaller title for micro-charts */
}

.card-body.p-2 .card-text {
    font-size: 1.25rem !important;
    /* Smaller number for micro-charts */
}

/* Adjustments for language distribution cards */
#language-charts-container .col-md-2 {
    flex: 0 0 16.666667%;
    /* Bootstrap default for col-md-2 */
    max-width: 16.666667%;
}

#language-charts-container .card-body {
    padding: 0.5rem;
    /* Smaller padding */
}

#language-charts-container .card-title {
    font-size: 0.8rem;
    /* Smaller language title */
    margin-bottom: 0.25rem;
}

#language-charts-container .card-text {
    font-size: 0.7rem;
    /* Smaller snippet count text */
}


/* Marquee Styles */
.marquee-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    height: 200px;
    /* Adjust height as needed */
}

.marquee-content {
    display: flex;
    animation: marquee 60s linear infinite;
    will-change: transform;
    width: 200%;
}

.marquee-item {
    flex: 0 0 auto;
    width: 150px;
    /* Adjust width of each chart item */
    margin-right: 15px;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* Page transition animations */
#page-content {
    position: relative;
    transition: opacity 0.5s, transform 0.5s;
}

.fade-in {
    opacity: 1;
    transform: translateX(0);
}

.fade-out {
    opacity: 0;
    transform: translateX(-20px);
}

/* Text animations */
.char {
    opacity: 0;
    transition: opacity 0.5s;
}

/* Particle background */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background: transparent !important;
}

/* Ensure particles canvas is visible */
#particles-js canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: -2 !important;
}

@keyframes twinkle {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

.particle-star {
    animation: twinkle 2s infinite;
}

.main-content {
    position: relative;
    z-index: 1;
}

#page-content {
    transition-timing-function: ease-in-out;
}

.char {
    transition-timing-function: ease-in-out;
}

/* Modal dropdown fix: allow dropdowns to overflow modal */
/* Removed overflow: visible !important from modal elements to prevent UI breakage */
/* .modal-body {
    overflow: visible !important;
}

.modal-dialog {
    overflow: visible !important;
}

.modal-content {
    overflow: visible !important;
} */

/* Ensure select elements are interactive in modals */
.modal .form-select {
    position: relative;
    z-index: 1050;
}

/* Dropdown menu positioning in modals */
.modal .dropdown-menu {
    position: absolute;
    z-index: 1060;
}

/* Custom styles for buttons on hover */
button:hover,
.btn:hover {
    background-color: darkgreen !important;
    border-color: darkgreen !important;
}

/* ============================================
   HYBRID RESPONSIVE NAVIGATION STRATEGY
   ============================================ */

/* Layout Container */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    width: 100%;
    overflow-x: hidden;
}

/* Sidebar Styles - Desktop Persistent */
.sidebar {
    width: 280px;
    background-color: var(--bs-dark);
    border-right: 1px solid var(--bs-border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1050;
    transform: translateX(0);
    transition: transform 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: visible;
    padding: 1rem 0;
}

/* Allow dropdowns to overflow when sidebar is not collapsed */
.sidebar:not(.collapsed) {
    overflow-x: visible;
}

/* Allow dropdowns to overflow when sidebar is collapsed */
.sidebar.collapsed {
    overflow-x: visible;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: var(--bs-primary);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--bs-primary-hover);
}

/* Collapsible Sidebar Functionality */
.sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: -12px;
    background: var(--bs-primary);
    border: 2px solid var(--bs-dark);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1051;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.sidebar-toggle:hover {
    background: var(--bs-primary);
    transform: scale(1.1);
}

/* Sidebar expand button (shown when collapsed) */
.sidebar-expand-btn {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bs-primary);
    border: 2px solid var(--bs-dark);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1051;
    transition: all 0.2s ease;
    font-size: 1.25rem;
}

.sidebar-expand-btn:hover {
    background: var(--bs-primary);
    transform: translateX(-50%) scale(1.1);
}

/* Show expand button only when sidebar is collapsed */
.sidebar.collapsed .sidebar-expand-btn {
    display: flex;
}

/* Hide header when collapsed */
.sidebar.collapsed .sidebar-header {
    display: none;
}

/* Collapsed sidebar state */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .dropdown-toggle::after,
.sidebar.collapsed .nav-link .me-2 {
    display: none;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .nav-link i {
    margin: 0;
    font-size: 1.25rem;
}

/* Collapsed sidebar dropdown - slides out to the right */
.sidebar.collapsed .dropdown-menu {
    position: absolute !important;
    left: 70px;
    top: 0;
    min-width: 12rem;
    background-color: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1070;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    display: block !important;
}

.sidebar.collapsed .dropdown:hover .dropdown-menu,
.sidebar.collapsed .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Collapsed sidebar tooltip */
.sidebar.collapsed .nav-link {
    position: relative;
}

.sidebar.collapsed .nav-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 80px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bs-dark);
    color: var(--bs-body-color);
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1070;
    border: 1px solid var(--bs-border-color);
}

/* Adjust main content when sidebar is collapsed */
.main-wrapper.collapsed {
    margin-left: 70px;
    width: calc(100% - 70px);
}

.sidebar-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 1rem;
    position: relative;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--bs-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center; /* "central" sidebar: main actions sit in the middle */
}

.sidebar-footer {
    flex: 0 0 auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(var(--bs-border-color-rgb), 0.65);
}

.sidebar.collapsed .sidebar-footer {
    border-top-color: transparent;
}

.sidebar-nav .nav-item {
    margin-bottom: 0.25rem;
}

.sidebar-nav .nav-link {
    color: var(--bs-body-color);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-primary);
    transform: translateX(4px);
}

/* Active page highlight */
.sidebar-nav .nav-link.active {
    background-color: var(--bs-primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(30, 91, 184, 0.4);
}

.sidebar-nav .nav-link.active:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(30, 91, 184, 0.6);
}

/* Collapsed sidebar active state */
.sidebar.collapsed .nav-link.active {
    background-color: rgba(30, 91, 184, 0.2);
    box-shadow: none;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* Dropdown in sidebar - default styles */
.sidebar .dropdown-menu {
    background-color: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    display: block;
    z-index: 1070;
}

/* Ensure dropdown list items are visible */
.sidebar .dropdown-menu > li {
    display: block;
}

.sidebar .dropdown-menu .dropdown-divider {
    display: block;
    margin: 0.5rem 0;
}

/* Ensure dropdown container has proper positioning context */
.sidebar .dropdown {
    position: relative;
}

/* Expanded desktop sidebar dropdown - slides out to the right */
.sidebar:not(.collapsed) .dropdown-menu,
.sidebar:not(.collapsed) .dropdown-menu.show {
    position: absolute !important;
    left: 100%;
    top: 0;
    margin-left: 0.5rem;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    display: block !important;
}

.sidebar:not(.collapsed) .dropdown.show .dropdown-menu,
.sidebar:not(.collapsed) .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar .dropdown-item {
    color: var(--bs-body-color);
    padding: 0.5rem 1.5rem;
    transition: all 0.2s ease;
    display: block;
    width: 100%;
}

.sidebar .dropdown-item:hover {
    background-color: var(--bs-primary);
    color: white;
}

.sidebar .dropdown-item.active {
    background-color: var(--bs-primary);
    color: white;
    font-weight: 600;
}

.sidebar .dropdown-toggle.active {
    background-color: var(--bs-primary);
    color: white;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - 280px);
    transition: margin-left 0.3s ease, width 0.3s ease;
    overflow-x: hidden;
    /* Prevent horizontal scroll on main content */
}

/* Adjust main content when sidebar is collapsed */
.main-wrapper.collapsed {
    margin-left: 80px;
    width: calc(100% - 80px);
}

/* Top Header - Compact */
.top-header {
    background-color: var(--bs-dark);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--bs-body-color);
    font-size: 1.25rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.hamburger-btn:hover {
    background-color: var(--bs-secondary-bg);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--bs-body-color);
    margin: 0;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Search Styles */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    max-width: 100%;
}

.search-input-wrapper:focus-within {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(30, 91, 184, 0.25);
}

.search-input {
    background: none;
    border: none;
    color: var(--bs-body-color);
    outline: none;
    width: 200px;
    font-size: 0.9rem;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--bs-secondary);
}

.search-select {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.search-btn {
    background: var(--bs-primary);
    border: none;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--bs-primary);
}

.search-icon-btn {
    display: none;
    background: none;
    border: none;
    color: var(--bs-body-color);
    font-size: 1.1rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.search-icon-btn:hover {
    background-color: var(--bs-secondary-bg);
}

/* Theme Toggle */
.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--bs-body-color);
    font-size: 1.1rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--bs-secondary-bg);
}

/* Mobile Off-Canvas Sidebar */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100vh;
    background-color: var(--bs-dark);
    border-right: 1px solid var(--bs-border-color);
    z-index: 1050;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: visible;
}

.mobile-sidebar .sidebar-main {
    justify-content: flex-start;
}

.mobile-sidebar.open {
    transform: translateX(320px);
}

/* Allow dropdowns to overflow visibly when sidebar is open */
.mobile-sidebar.open {
    overflow-x: visible;
}

.mobile-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* Light theme overlay */
:root[data-bs-theme='light'] .mobile-sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.3);
}

.mobile-sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile sidebar dropdown - smooth inline expansion */
.mobile-sidebar .dropdown-menu {
    position: relative;
    left: 0;
    top: 0;
    margin-left: 0;
    margin-top: 0;
    min-width: 100%;
    max-height: 0;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1060;
    background-color: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    padding: 0 0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, visibility 0.3s ease;
    display: block !important;
}

/* Ensure mobile dropdown list items are visible */
.mobile-sidebar .dropdown-menu > li {
    display: block;
}

.mobile-sidebar .dropdown-menu .dropdown-divider {
    display: block;
    margin: 0.5rem 0;
}

/* Expanded state for dropdown - works with Bootstrap's .show class */
.mobile-sidebar .dropdown.show .dropdown-menu,
.mobile-sidebar .dropdown-menu.show {
    max-height: 300px;
    opacity: 1;
    visibility: visible;
    padding: 0.5rem !important;
    margin-top: 0.5rem;
}

/* Ensure dropdowns are visible and clickable on mobile */
.mobile-sidebar .dropdown {
    position: relative;
    z-index: 1060;
}

.mobile-sidebar .dropdown.show {
    z-index: 1061;
}

.mobile-sidebar .dropdown-toggle::after {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.mobile-sidebar .dropdown.show .dropdown-toggle::after {
    transform: rotate(180deg);
}

/* Highlight dropdown toggle when expanded */
.mobile-sidebar .dropdown.show .dropdown-toggle {
    background-color: rgba(30, 91, 184, 0.2);
    border-radius: 0.5rem;
}

/* Mobile sidebar dropdown items - instant display (container handles animation) */
.mobile-sidebar .dropdown-item {
    color: var(--bs-body-color);
    padding: 0.5rem 1rem 0.5rem 2rem;
    transition: all 0.2s ease;
    display: block;
    width: 100%;
}

.mobile-sidebar .dropdown-item:hover {
    background-color: var(--bs-primary);
    color: white;
}

.mobile-sidebar .dropdown-item.active {
    background-color: var(--bs-primary);
    color: white;
    font-weight: 600;
}

/* Mobile Search Expansion */
.mobile-search-expanded {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bs-body-bg);
    z-index: 1051;
    display: none;
    flex-direction: column;
    padding: 1rem;
}

.mobile-search-expanded.show {
    display: flex;
}

.mobile-search-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 1rem;
}

.mobile-search-back {
    background: none;
    border: none;
    color: var(--bs-body-color);
    font-size: 1.25rem;
    padding: 0.5rem;
    cursor: pointer;
}

.mobile-search-input {
    flex: 1;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: var(--bs-body-color);
    font-size: 1rem;
    outline: none;
}

.mobile-search-scope {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.mobile-search-scope .scope-btn {
    flex: 1;
    padding: 0.5rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.25rem;
    color: var(--bs-body-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-search-scope .scope-btn.active {
    background: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

.mobile-search-submit {
    margin-top: 1rem;
    width: 100%;
    padding: 0.75rem;
    background: var(--bs-primary);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mobile-search-submit:hover {
    background: var(--bs-primary);
}

/* Responsive Breakpoints */

/* Large screens (Desktop/Tablet) - Default styles apply */
@media (min-width: 992px) {

    .hamburger-btn,
    .search-icon-btn {
        display: none !important;
    }

    .search-input-wrapper {
        display: flex !important;
    }

    .sidebar-toggle {
        display: flex !important;
    }
}

/* Medium screens (Tablet) */
@media (max-width: 991.98px) and (min-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .hamburger-btn {
        display: block;
    }

    .search-input {
        width: 150px;
    }

    .sidebar-toggle {
        display: none !important;
    }
    
    /* Tablet-specific improvements */
    .card {
        margin-bottom: 1rem;
    }
    
    .container-xl {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Small screens (Mobile) */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .hamburger-btn {
        display: block;
    }

    .search-input-wrapper {
        display: none !important;
    }

    .search-icon-btn {
        display: block;
    }

    .header-title {
        font-size: 1rem;
    }

    .top-header {
        padding: 0.5rem 0.75rem;
    }

    .sidebar-toggle {
        display: none !important;
    }
    
    /* Mobile-specific improvements */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Improve touch targets */
    .nav-link, .dropdown-item {
        padding: 0.75rem 1rem;
        min-height: 44px;
    }
    
    /* Optimize form elements */
    .form-control, .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.625rem 0.75rem;
    }
    
    /* Improve table responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Optimize modal for mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-body {
        padding: 1rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .mobile-sidebar {
        width: 280px;
        left: -280px;
    }

    .mobile-sidebar.open {
        transform: translateX(280px);
    }

    .header-title {
        display: none;
    }

    .header-content {
        justify-content: space-between;
    }
    
    /* Additional mobile optimizations */
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    
    .card {
        border-radius: 0.5rem;
    }
    
    /* Stack buttons vertically on very small screens */
    .btn-group .btn,
    .action-buttons .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .mobile-sidebar {
        width: 260px;
        left: -260px;
    }

    .mobile-sidebar.open {
        transform: translateX(260px);
    }
    
    .top-header {
        padding: 0.4rem 0.5rem;
    }
    
    .search-input {
        width: 80px;
    }
}

/* Landscape orientation optimization for mobile */
@media (max-width: 767.98px) and (orientation: landscape) {
    .mobile-sidebar {
        max-width: 80vh;
    }
    
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }
    
    .modal-content {
        border-radius: 0;
    }
}

/* Tablet landscape optimization */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .sidebar {
        width: 240px;
    }
    
    .main-wrapper {
        margin-left: 240px;
        width: calc(100% - 240px);
    }
}

/* Activity Calendar */
.activity-calendar-container {
    width: 100%;
    font-size: 14px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.calendar-navigation {
    display: flex;
    align-items: center;
    gap: 15px;
}

.calendar-title {
    color: var(--bs-body-color);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    min-width: 150px;
    text-align: center;
}

.calendar-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--bs-body-color);
}

.legend-squares {
    display: flex;
    gap: 2px;
}

.legend-square {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-square.level-0 {
    background-color: #ebedf0;
}

.legend-square.level-1 {
    background-color: #9be9a8;
}

.legend-square.level-2 {
    background-color: #40c463;
}

.legend-square.level-3 {
    background-color: #30a14e;
}

.legend-square.level-4 {
    background-color: #216e39;
}

.calendar-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 5px;
}

.calendar-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--bs-body-color);
    padding: 5px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 35px;
    border: 1px solid transparent;
}

.calendar-day:hover {
    transform: scale(1.05);
    border-color: var(--bs-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-day.empty {
    background: transparent;
    cursor: default;
    border: none;
}

.calendar-day.today {
    border-color: var(--bs-primary);
    border-width: 2px;
    font-weight: bold;
}

.day-number {
    font-size: 11px;
    font-weight: 500;
    color: var(--bs-body-color);
    line-height: 1;
}

.activity-count {
    font-size: 9px;
    font-weight: bold;
    color: white;
    line-height: 1;
    margin-top: 1px;
}

/* Calendar activity levels - GitHub colors */
.calendar-day.level-0 {
    background-color: #ebedf0;
}

.calendar-day.level-1 {
    background-color: #9be9a8;
}

.calendar-day.level-2 {
    background-color: #40c463;
}

.calendar-day.level-3 {
    background-color: #30a14e;
}

.calendar-day.level-4 {
    background-color: #216e39;
}

/* Dark mode adjustments for calendar */
@media (prefers-color-scheme: dark) {
    .calendar-day.level-0 {
        background-color: #161b22;
    }

    .legend-square.level-0 {
        background-color: #161b22;
    }

    .calendar-day.today {
        border-color: var(--bs-primary);
    }
}

/* Responsive adjustments for calendar */
@media (max-width: 576px) {
    .calendar-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .calendar-navigation {
        justify-content: center;
    }

    .calendar-legend {
        justify-content: center;
    }

    .calendar-day {
        min-height: 30px;
    }

    .day-number {
        font-size: 10px;
    }

    .activity-count {
        font-size: 8px;
    }
}

/* Streaming AI Responsive Styles */
.streaming-ai-container {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin: 1rem 0;
}

.streaming-ai-panel {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.streaming-ai-panel .card-body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.streaming-ai-panel .code-output,
.streaming-ai-panel .explanation-output {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.streaming-ai-panel pre {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.streaming-ai-panel .markdown-content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

.streaming-ai-panel .markdown-content * {
    max-width: 100%;
    word-wrap: break-word;
}

.streaming-ai-panel .markdown-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

.streaming-ai-panel .markdown-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
}

.streaming-ai-panel .action-buttons .btn {
    flex: 1;
    min-width: auto;
}

@media (max-width: 576px) {
    .streaming-ai-panel .card-header {
        padding: 0.75rem 1rem;
    }

    .streaming-ai-panel .card-body {
        padding: 1rem;
    }

    .streaming-ai-panel .streaming-controls {
        margin-top: 0.5rem;
    }

    .streaming-ai-panel .action-buttons .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }

    .streaming-ai-panel .markdown-content {
        font-size: 0.9rem;
    }

    .streaming-ai-panel pre {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
}

/* Ensure proper theme colors for streaming content */
:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content {
    background-color: var(--bs-dark) !important;
    color: var(--bs-light) !important;
    border-color: var(--bs-border-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}

/* Markdown dark mode class - explicit styles */
.markdown-dark-mode {
    color: #e6e6e6 !important;
}

.markdown-dark-mode h1,
.markdown-dark-mode h2,
.markdown-dark-mode h3,
.markdown-dark-mode h4,
.markdown-dark-mode h5,
.markdown-dark-mode h6 {
    color: #ffffff !important;
}

.markdown-dark-mode p,
.markdown-dark-mode span,
.markdown-dark-mode div {
    color: #e6e6e6 !important;
}

.markdown-dark-mode li {
    color: #e6e6e6 !important;
}

.markdown-dark-mode a {
    color: #59a3ff !important;
}

.markdown-dark-mode strong,
.markdown-dark-mode b {
    color: #ffffff !important;
}

.markdown-dark-mode code {
    background-color: var(--bs-secondary-bg) !important;
    color: #e6e6e6 !important;
}

.markdown-dark-mode pre {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

.markdown-dark-mode pre code {
    background-color: transparent !important;
    color: #e0e0e0 !important;
}

.markdown-dark-mode blockquote {
    color: #b0b0b0 !important;
    background-color: var(--bs-secondary-bg) !important;
    border-left-color: var(--bs-primary) !important;
}

/* Markdown light mode class - explicit styles */
.markdown-light-mode {
    color: #212529 !important;
}

.markdown-light-mode h1,
.markdown-light-mode h2,
.markdown-light-mode h3,
.markdown-light-mode h4,
.markdown-light-mode h5,
.markdown-light-mode h6 {
    color: #212529 !important;
}

.markdown-light-mode p,
.markdown-light-mode span,
.markdown-light-mode div {
    color: #212529 !important;
}

.markdown-light-mode li {
    color: #212529 !important;
}

.markdown-light-mode a {
    color: #0d6efd !important;
}

.markdown-light-mode strong,
.markdown-light-mode b {
    color: #212529 !important;
}

.markdown-light-mode code {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.markdown-light-mode pre {
    background-color: #f8f9fa !important;
    color: #495057 !important;
}

.markdown-light-mode pre code {
    background-color: transparent !important;
    color: #495057 !important;
}

.markdown-light-mode blockquote {
    color: #6c757d !important;
    background-color: #f8f9fa !important;
    border-left-color: var(--bs-primary) !important;
}

/* Dark mode markdown content fixes for streaming */
:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content h1,
:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content h2,
:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content h3,
:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content h4,
:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content h5,
:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content h6 {
    color: var(--bs-light) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content p {
    color: var(--bs-light) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content li {
    color: var(--bs-light) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content ul,
:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content ol {
    color: var(--bs-light) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content blockquote {
    color: var(--bs-light) !important;
    background-color: var(--bs-secondary-bg) !important;
    border-left-color: var(--bs-primary) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content code {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-light) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content pre {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content pre code {
    background-color: transparent !important;
    color: #e0e0e0 !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content table {
    color: var(--bs-light) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content th {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-light) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content td {
    color: var(--bs-light) !important;
    border-color: var(--bs-border-color) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content a {
    color: var(--bs-primary) !important;
}

:root[data-bs-theme='dark'] .streaming-ai-panel .markdown-content a:hover {
    color: var(--bs-primary) !important;
    opacity: 0.8;
}

/* Light mode markdown content fixes for streaming */
:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content h1,
:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content h2,
:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content h3,
:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content h4,
:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content h5,
:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content h6 {
    color: var(--bs-body-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content p {
    color: var(--bs-body-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content li {
    color: var(--bs-body-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content ul,
:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content ol {
    color: var(--bs-body-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content blockquote {
    color: var(--bs-body-color) !important;
    background-color: var(--bs-secondary-bg) !important;
    border-left-color: var(--bs-primary) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content code {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content pre {
    background-color: #f8f9fa !important;
    color: #495057 !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content pre code {
    background-color: transparent !important;
    color: #495057 !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content table {
    color: var(--bs-body-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content th {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content td {
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content a {
    color: var(--bs-primary) !important;
}

:root[data-bs-theme='light'] .streaming-ai-panel .markdown-content a:hover {
    color: var(--bs-primary) !important;
    opacity: 0.8;
}

/* Additional Dark Mode Text Contrast Fixes */

/* Badge text color fixes for both themes */
:root[data-bs-theme='dark'] .badge.bg-warning {
    color: #212529 !important;
}

:root[data-bs-theme='light'] .badge.bg-warning {
    color: #212529 !important;
}

:root[data-bs-theme='dark'] .badge.bg-info {
    color: white !important;
}

:root[data-bs-theme='light'] .badge.bg-info {
    color: white !important;
}

:root[data-bs-theme='dark'] .badge.bg-success {
    color: white !important;
}

:root[data-bs-theme='light'] .badge.bg-success {
    color: white !important;
}

:root[data-bs-theme='dark'] .badge.bg-danger {
    color: white !important;
}

:root[data-bs-theme='light'] .badge.bg-danger {
    color: white !important;
}

/* Card header text contrast */
:root[data-bs-theme='dark'] .card-header.bg-warning {
    color: #212529 !important;
}

:root[data-bs-theme='light'] .card-header.bg-warning {
    color: #212529 !important;
}

:root[data-bs-theme='dark'] .card-header.bg-info {
    color: white !important;
}

:root[data-bs-theme='light'] .card-header.bg-info {
    color: white !important;
}

/* Alert text contrast */
:root[data-bs-theme='dark'] .alert-warning {
    color: #212529 !important;
}

:root[data-bs-theme='light'] .alert-warning {
    color: #212529 !important;
}

/* Ensure all text elements use proper theme colors */
:root[data-bs-theme='dark'] .text-muted {
    color: rgba(255, 255, 255, 0.75) !important;
}

:root[data-bs-theme='light'] .text-muted {
    color: rgba(0, 0, 0, 0.75) !important;
}

/* Button text contrast for outline buttons */
:root[data-bs-theme='dark'] .btn-outline-warning {
    color: var(--bs-warning) !important;
    border-color: var(--bs-warning) !important;
}

:root[data-bs-theme='dark'] .btn-outline-warning:hover {
    background-color: var(--bs-warning) !important;
    color: #212529 !important;
}

/* Form text color consistency */
:root[data-bs-theme='dark'] .form-text {
    color: rgba(255, 255, 255, 0.75) !important;
}

:root[data-bs-theme='light'] .form-text {
    color: rgba(0, 0, 0, 0.75) !important;
}

/* Table text color consistency */
:root[data-bs-theme='dark'] .table {
    color: var(--bs-body-color);
}

:root[data-bs-theme='dark'] .table th {
    color: var(--bs-body-color);
}

:root[data-bs-theme='dark'] .table td {
    color: var(--bs-body-color);
}

/* Modal text consistency */
:root[data-bs-theme='dark'] .modal-title {
    color: var(--bs-body-color);
}

:root[data-bs-theme='dark'] .modal-body {
    color: var(--bs-body-color);
}

:root[data-bs-theme='dark'] .modal-footer {
    color: var(--bs-body-color);
}

/* Dropdown text consistency */
:root[data-bs-theme='dark'] .dropdown-item {
    color: var(--bs-body-color);
}

/* Toast text consistency */
:root[data-bs-theme='dark'] .toast {
    color: var(--bs-body-color);
}

/* Fix for any hardcoded black text in dark mode */
:root[data-bs-theme='dark'] *[style*="color: black"],
:root[data-bs-theme='dark'] *[style*="color:#000"],
:root[data-bs-theme='dark'] *[style*="color:#000000"] {
    color: var(--bs-body-color) !important;
}

/* Fix for any hardcoded black text in light mode */
:root[data-bs-theme='light'] *[style*="color: black"] {
    color: var(--bs-body-color) !important;
}

/* ============================================
   RESPONSIVE SEARCH FORM STYLES
   ============================================ */

/* Intelligent search form responsive adjustments */
.search-form-card {
    transition: all 0.3s ease;
}

@media (max-width: 767.98px) {
    .search-form-card .card-body {
        padding: 1.25rem;
    }
    
    .search-form-card .input-group-lg .form-control {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    .search-form-card .input-group-lg .btn {
        padding: 0.75rem 1rem;
    }
    
    /* Stack filter labels above inputs on mobile */
    .search-form-card .form-label {
        font-size: 0.875rem;
        margin-bottom: 0.35rem;
    }
    
    /* Full width for filter selects on mobile */
    .search-form-card .form-select {
        font-size: 0.9rem;
        padding: 0.5rem 2rem 0.5rem 0.75rem;
    }
    
    /* Adjust alert padding on mobile */
    .search-form-card .alert {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .search-form-card .alert ul {
        padding-left: 1rem;
    }
}

@media (max-width: 480px) {
    .search-form-card .input-group-lg {
        flex-direction: column;
    }
    
    .search-form-card .input-group-lg .form-control {
        border-radius: 0.5rem !important;
        margin-bottom: 0.5rem;
    }
    
    .search-form-card .input-group-lg .btn {
        width: 100%;
        border-radius: 0.5rem !important;
    }
    
    .search-form-card .input-group-text {
        border-radius: 0.5rem !important;
        margin-bottom: 0.5rem;
        width: 100%;
        justify-content: center;
    }
}

/* Tablet search form optimization */
@media (min-width: 768px) and (max-width: 1024px) {
    .search-form-card .form-select {
        font-size: 0.85rem;
        padding: 0.4rem 1.5rem 0.4rem 0.6rem;
    }
    
    .search-form-card .form-label {
        font-size: 0.8rem;
    }
}

/* ============================================
   RESPONSIVE CONTENT LAYOUT IMPROVEMENTS
   ============================================ */

/* Card grid responsiveness */
@media (max-width: 767.98px) {
    .card-grid .card {
        margin-bottom: 1rem;
    }
    
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
}

/* Code block responsiveness */
@media (max-width: 767.98px) {
    pre {
        border-radius: 0.35rem;
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    
    code {
        font-size: 0.85rem;
    }
}

/* Table responsiveness improvements */
@media (max-width: 767.98px) {
    .table-responsive {
        border-radius: 0.5rem;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
}

/* Modal responsiveness */
@media (max-width: 767.98px) {
    .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-width: calc(50% - 0.25rem);
    }
}

/* Dropdown menu responsiveness */
@media (max-width: 767.98px) {
    .dropdown-menu {
        max-width: 90vw;
        font-size: 0.9rem;
    }
    
    .dropdown-item {
        padding: 0.625rem 1rem;
    }
}

/* Toast notification responsiveness */
@media (max-width: 576px) {
    .toast-container {
        padding: 0.5rem !important;
        max-width: calc(100% - 1rem);
    }
    
    .toast {
        max-width: 100%;
        font-size: 0.85rem;
    }
}

/* Pagination responsiveness */
@media (max-width: 576px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .page-link {
        padding: 0.375rem 0.625rem;
        font-size: 0.85rem;
    }
}
/* Markdown Dark Mode Styles - Optimized for Streaming AI */
.markdown-dark-mode {
    color: #e6e6e6 !important;
}

.markdown-dark-mode h1, 
.markdown-dark-mode h2, 
.markdown-dark-mode h3, 
.markdown-dark-mode h4, 
.markdown-dark-mode h5, 
.markdown-dark-mode h6 {
    color: #ffffff !important;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-dark-mode p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.markdown-dark-mode code {
    background-color: rgba(255, 255, 255, 0.1);
    color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.markdown-dark-mode pre {
    background-color: #1e1e1e;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-dark-mode pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-dark-mode ul, 
.markdown-dark-mode ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-dark-mode li {
    margin-bottom: 0.5rem;
}

.markdown-dark-mode blockquote {
    border-left: 4px solid #4a4a4a;
    padding-left: 1rem;
    margin-bottom: 1rem;
    color: #b0b0b0;
    font-style: italic;
}

.markdown-dark-mode a {
    color: #3d8bfd;
    text-decoration: none;
}

.markdown-dark-mode a:hover {
    text-decoration: underline;
}

.markdown-dark-mode table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.markdown-dark-mode th, 
.markdown-dark-mode td {
    border: 1px solid #4a4a4a;
    padding: 0.75rem;
    text-align: left;
}

.markdown-dark-mode th {
    background-color: rgba(255, 255, 255, 0.05);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   SOPHIA DESIGN SYSTEM
   Clean, Focused, Consistent UI/UX
   ======================================== */

/* --- Design Tokens --- */
:root {
    /* Spacing Scale */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    
    /* Border Radius */
    --radius-sm: 0.375rem;  /* 6px */
    --radius-md: 0.5rem;    /* 8px */
    --radius-lg: 0.75rem;   /* 12px */
    --radius-xl: 1rem;      /* 16px */
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
}

/* --- Typography --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-md);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* --- Global Page Structure --- */
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.page-header {
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--bs-body-color);
}

.page-subtitle {
    font-size: 1rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0;
}

/* --- Cards --- */
.card {
    border-radius: var(--radius-lg);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: var(--bs-secondary-bg);
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 600;
    padding: var(--space-md) var(--space-lg);
}

.card-body {
    padding: var(--space-lg);
}

/* --- Buttons --- */
.btn {
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    font-size: 0.95rem;
    white-space: nowrap;
}

.btn i {
    font-size: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Responsive button sizing */
@media (max-width: 768px) {
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .btn-lg {
        padding: 0.625rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* Primary Button with Micro-interaction */
.btn-primary {
    position: relative;
    overflow: hidden;
    color: #fff;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Outline Buttons */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success,
.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info {
    background: transparent;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover,
.btn-outline-warning:hover,
.btn-outline-info:hover {
    transform: translateY(-2px);
}

/* Icon Buttons */
.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.btn-icon i {
    margin: 0;
}

/* --- Forms --- */
.form-label {
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--bs-body-color);
}

.form-control,
.form-select {
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
    border: 2px solid var(--bs-border-color);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.form-control-lg {
    padding: 0.875rem 1.25rem;
    font-size: 1.125rem;
}

/* --- Help Sections --- */
.help-section {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.help-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-section-title i {
    color: var(--bs-info);
}

.help-section-content {
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    line-height: 1.6;
}

.help-section-content ul {
    margin: var(--space-sm) 0;
    padding-left: var(--space-md);
}

.help-section-content li {
    margin-bottom: var(--space-xs);
}

/* --- Page-Specific Help --- */
.page-help {
    background: rgba(var(--bs-info-rgb), 0.05);
    border-left: 3px solid var(--bs-info);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-lg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.page-help-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--bs-info);
}

.page-help-text {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
    margin: 0;
}

/* --- Empty States --- */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--bs-secondary-color);
    opacity: 0.5;
    margin-bottom: var(--space-md);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.empty-state-text {
    color: var(--bs-secondary-color);
    margin-bottom: var(--space-lg);
}

/* --- Loading States --- */
.loading-skeleton {
    background: linear-gradient(
        90deg,
        var(--bs-secondary-bg) 0%,
        var(--bs-tertiary-bg) 50%,
        var(--bs-secondary-bg) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Micro-interactions --- */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(var(--bs-primary-rgb), 0.3);
}

/* --- Responsive Utilities --- */
@media (max-width: 768px) {
    :root {
        --space-lg: 1.25rem;
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: var(--space-md);
    }
}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for better keyboard navigation */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* ========================================
   SIDEBAR NAVIGATION
   Clean, Organized, Consistent
   ======================================== */

/* Sidebar Base */
.sidebar {
    background-color: var(--bs-dark);
    border-right: 1px solid var(--bs-border-color);
    transition: width var(--transition-slow);
    width: 280px;
    flex-shrink: 0;
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bs-body-color);
    text-decoration: none;
    transition: opacity var(--transition-fast);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-brand:hover {
    opacity: 0.8;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--bs-warning);
    flex-shrink: 0;
}

.sidebar-brand-text {
    transition: opacity var(--transition-fast);
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--bs-secondary-color);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

/* Nav Links */
.sidebar-nav {
    padding: var(--space-md) 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--bs-secondary-color);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    font-size: 1.125rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border-left-color: var(--bs-primary);
}

.sidebar-nav .nav-link.active {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border-left-color: var(--bs-primary);
}

/* Nav Sections */
.sidebar-section {
    margin: var(--space-lg) 0 var(--space-sm);
    padding: 0 var(--space-lg);
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
    margin-bottom: var(--space-sm);
}

/* Dropdown Menu */
.sidebar-nav .dropdown-menu {
    background-color: var(--bs-card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    margin-left: var(--space-lg);
    margin-top: var(--space-xs);
}

.sidebar-nav .dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    color: var(--bs-secondary-color);
    transition: all var(--transition-fast);
}

.sidebar-nav .dropdown-item:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.sidebar-nav .dropdown-divider {
    border-color: var(--bs-border-color);
    margin: var(--space-sm) 0;
}

/* User Profile Section */
.sidebar-user {
    margin-top: auto;
    padding: var(--space-lg);
    border-top: 1px solid var(--bs-border-color);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-user-name {
    font-weight: 600;
    color: var(--bs-body-color);
    font-size: 0.95rem;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}

.sidebar.collapsed .sidebar-brand-text {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    display: none;
}

/* Expand button for collapsed sidebar */
.sidebar-expand-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--bs-body-color);
    cursor: pointer;
    padding: var(--space-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    width: 100%;
    font-size: 1.5rem;
}

.sidebar.collapsed .sidebar-expand-btn {
    display: block;
}

.sidebar-expand-btn:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-primary);
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: var(--space-md);
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar.collapsed .sidebar-section-title {
    display: none;
}

.sidebar.collapsed .dropdown-menu {
    display: none;
}

/* Mobile Sidebar */
.mobile-sidebar {
    background-color: var(--bs-dark);
    border-right: 1px solid var(--bs-border-color);
    overflow-y: auto;
    max-height: 100vh;
}

/* Compact mobile sidebar - fit content without scrolling */
@media (max-height: 700px) {
    .mobile-sidebar .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .mobile-sidebar .sidebar-header {
        padding: 0.75rem 1rem;
    }
    
    .mobile-sidebar .sidebar-brand {
        font-size: 1.1rem;
    }
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
    }

    .sidebar.show {
        transform: translateX(0);
    }
}

/* ========================================
   AI GENERATE PAGE
   Clean with Brilliant Micro-interactions
   ======================================== */

/* Glass Card Effect */
.ai-generate-card {
    background: rgba(var(--bs-card-bg-rgb), 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.5);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.ai-generate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(var(--bs-primary-rgb), 0.03),
        transparent
    );
    transition: left 0.8s ease;
    pointer-events: none;
}

.ai-generate-card:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.3);
    box-shadow: 0 12px 48px rgba(var(--bs-primary-rgb), 0.15);
    transform: translateY(-2px);
}

.ai-generate-card:hover::before {
    left: 100%;
}

/* Input Fields with Glow */
.ai-input {
    background: rgba(var(--bs-secondary-bg-rgb), 0.5);
    border: 2px solid rgba(var(--bs-border-color-rgb), 0.5);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    font-size: 1rem;
    line-height: 1.6;
    transition: all var(--transition-base);
    resize: vertical;
}

.ai-input:focus {
    background: rgba(var(--bs-body-bg-rgb), 0.8);
    border-color: rgba(var(--bs-primary-rgb), 0.5);
    box-shadow: 
        0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.1),
        0 0 20px rgba(var(--bs-primary-rgb), 0.15);
    outline: none;
}

.ai-input:hover:not(:focus) {
    border-color: rgba(var(--bs-primary-rgb), 0.3);
}

/* Generate Button with Advanced Micro-interactions */
.ai-generate-btn {
    background: rgba(var(--bs-primary-rgb), 0.1);
    border: 2px solid rgba(var(--bs-primary-rgb), 0.5);
    color: var(--bs-primary);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.ai-generate-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(var(--bs-primary-rgb), 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.ai-generate-btn:hover::before {
    width: 400px;
    height: 400px;
}

.ai-generate-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 50%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: skewX(-25deg);
    transition: left 0.8s ease;
}

.ai-generate-btn:hover::after {
    left: 150%;
}

.ai-generate-btn:hover {
    background: rgba(var(--bs-primary-rgb), 0.2);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    box-shadow: 
        0 0 30px rgba(var(--bs-primary-rgb), 0.3),
        inset 0 0 20px rgba(var(--bs-primary-rgb), 0.05);
    transform: translateY(-2px);
}

.ai-generate-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 15px rgba(var(--bs-primary-rgb), 0.2);
}

/* Example Buttons with Glass Effect */
.ai-examples-card {
    background: rgba(var(--bs-card-bg-rgb), 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    border-radius: var(--radius-lg);
}

.ai-examples-card .card-header {
    background: rgba(var(--bs-secondary-bg-rgb), 0.5);
    border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    font-weight: 600;
}

.ai-example-btn {
    border-radius: var(--radius-md);
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    background: rgba(var(--bs-secondary-bg-rgb), 0.3);
    border-color: rgba(var(--bs-border-color-rgb), 0.4);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.ai-example-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(var(--bs-primary-rgb), 0.2),
        transparent
    );
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.ai-example-btn:hover::before,
.ai-example-btn.active::before {
    opacity: 1;
}

.ai-example-btn:hover {
    background: rgba(var(--bs-primary-rgb), 0.15);
    border-color: rgba(var(--bs-primary-rgb), 0.5);
    color: var(--bs-primary);
    box-shadow: 
        0 4px 12px rgba(var(--bs-primary-rgb), 0.15),
        inset 0 0 10px rgba(var(--bs-primary-rgb), 0.05);
    transform: translateY(-2px);
}

.ai-example-btn:active {
    transform: translateY(0);
}

.ai-example-btn.active {
    background: rgba(var(--bs-primary-rgb), 0.2);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

/* Input Label Animations */
.form-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: color var(--transition-fast);
}

.form-label i {
    transition: transform var(--transition-fast);
}

.ai-input:focus + .form-label i,
.ai-input:focus ~ .form-label i {
    transform: scale(1.1);
}

/* Ripple Effect on Click */
@keyframes ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

.ai-generate-btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

/* Streaming Container with Glass Effect */
#streaming-container {
    position: relative;
}

.streaming-ai-panel {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: rgba(var(--bs-card-bg-rgb), 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.streaming-ai-panel .card-header {
    background: rgba(var(--bs-secondary-bg-rgb), 0.5);
    border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
}

/* Loading Pulse Animation */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(var(--bs-primary-rgb), 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(var(--bs-primary-rgb), 0.4);
    }
}

.ai-generate-btn:disabled {
    animation: pulse 2s ease-in-out infinite;
}

/* Focus Glow */
.ai-input:focus,
.ai-example-btn:focus {
    outline: none;
}

.ai-input:focus-visible,
.ai-example-btn:focus-visible {
    box-shadow: 
        0 0 0 3px rgba(var(--bs-primary-rgb), 0.2),
        0 0 20px rgba(var(--bs-primary-rgb), 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .ai-generate-card .card-body {
        padding: var(--space-lg) !important;
    }
    
    .ai-generate-btn {
        padding: 0.875rem 1.5rem;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ai-generate-card::before,
    .ai-generate-btn::after,
    .ai-example-btn::before {
        display: none;
    }
    
    .ai-generate-btn,
    .ai-example-btn,
    .ai-generate-card {
        transition: none;
    }
}

/* ========================================
   CREATE SNIPPET PAGE
   ======================================== */

/* AI Alert */
.ai-alert {
    background: rgba(var(--bs-info-rgb), 0.1);
    border: 1px solid rgba(var(--bs-info-rgb), 0.3);
    border-radius: var(--radius-lg);
}

/* Form Card */
.ai-form-card {
    background: rgba(var(--bs-card-bg-rgb), 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
}

/* Refine Card */
.ai-refine-card {
    background: rgba(var(--bs-secondary-bg-rgb), 0.3);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
}

.ai-refine-card .card-header {
    background: rgba(var(--bs-secondary-bg-rgb), 0.5);
    border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    font-weight: 600;
}

/* Form Actions */
.btn-group .btn {
    text-align: center;
}

/* ========================================
   COLLECTIONS PAGE
   ======================================== */

.collections-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* List View (Default) */
.collections-container.list-view .collection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(var(--bs-secondary-bg-rgb), 0.3);
    border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    transition: all var(--transition-fast);
}

.collections-container.list-view .collection-item:hover {
    background: rgba(var(--bs-secondary-bg-rgb), 0.5);
}

.collections-container.list-view .collection-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
    text-decoration: none;
    color: var(--bs-body-color);
}

.collections-container.list-view .collection-icon {
    font-size: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-warning-rgb), 0.1);
    border-radius: var(--radius-md);
}

.collections-container.list-view .collection-info {
    flex-grow: 1;
}

.collections-container.list-view .collection-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--bs-body-color);
}

.collections-container.list-view .collection-count {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

/* Grid View */
.collections-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.collections-container.grid-view .collection-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: rgba(var(--bs-secondary-bg-rgb), 0.3);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    position: relative;
}

.collections-container.grid-view .collection-item:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--bs-primary-rgb), 0.3);
    box-shadow: 0 8px 24px rgba(var(--bs-primary-rgb), 0.15);
}

.collections-container.grid-view .collection-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--bs-body-color);
    width: 100%;
}

.collections-container.grid-view .collection-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-warning-rgb), 0.1);
    border-radius: var(--radius-lg);
    transition: transform var(--transition-base);
}

.collections-container.grid-view .collection-item:hover .collection-icon {
    transform: scale(1.1);
}

.collections-container.grid-view .collection-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.collections-container.grid-view .collection-count {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.collections-container.grid-view .collection-actions {
    margin-top: 1rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-base);
}

.collections-container.grid-view .collection-item:hover .collection-actions {
    opacity: 1;
    transform: translateY(0);
}

/* View Toggle Buttons */
.view-toggle-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.view-toggle-btn.active {
    background: rgba(var(--bs-primary-rgb), 0.2);
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

.collection-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.collection-actions .btn i {
    font-size: 0.875rem;
}

/* ========================================
   VIEW SNIPPET PAGE
   ======================================== */

.ai-snippet-card {
    background: rgba(var(--bs-card-bg-rgb), 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
}

.ai-snippet-card .card-header {
    background: rgba(var(--bs-secondary-bg-rgb), 0.5);
    border-bottom: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    font-weight: 600;
}

/* Code Block Styling */
.ai-snippet-card pre {
    margin: 0;
    border-radius: 0;
    background: rgba(var(--bs-secondary-bg-rgb), 0.3);
}

.ai-snippet-card code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Version History */
.list-group-item {
    background: rgba(var(--bs-secondary-bg-rgb), 0.3);
    border-color: rgba(var(--bs-border-color-rgb), 0.3);
}

/* Markdown Content */
.markdown-content {
    color: var(--bs-body-color);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content code {
    background: rgba(var(--bs-secondary-bg-rgb), 0.5);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', 'Consolas', monospace;
}

.markdown-content pre {
    background: rgba(var(--bs-secondary-bg-rgb), 0.5);
    padding: 1rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.markdown-content blockquote {
    border-left: 4px solid var(--bs-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--bs-secondary-color);
}

/* ---------------------------
   Auth: Password Strength UI
---------------------------- */
.password-strength {
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.45);
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    background: rgba(var(--bs-card-bg-rgb), 0.35);
    backdrop-filter: blur(10px);
}

.strength-bars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.strength-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.35);
    transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.password-strength .strength-text {
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-bottom: 0.15rem;
}

.password-strength .strength-hints {
    font-size: 0.85rem;
    opacity: 0.9;
}

.password-strength .strength-hint {
    display: flex;
    gap: 0.5rem;
}

.password-strength.strength-0 .strength-bar:nth-child(-n + 1),
.password-strength.strength-1 .strength-bar:nth-child(-n + 1) {
    background: rgba(var(--bs-danger-rgb), 0.55);
}

.password-strength.strength-2 .strength-bar:nth-child(-n + 2) {
    background: rgba(var(--bs-warning-rgb), 0.55);
}

.password-strength.strength-3 .strength-bar:nth-child(-n + 3) {
    background: rgba(var(--bs-info-rgb), 0.55);
}

.password-strength.strength-4 .strength-bar:nth-child(-n + 4) {
    background: rgba(var(--bs-success-rgb), 0.55);
}

@media (prefers-reduced-motion: no-preference) {
    .password-strength.strength-3 .strength-bar,
    .password-strength.strength-4 .strength-bar {
        box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 6px 18px rgba(0, 0, 0, 0.20);
    }
}

/* ---------------------------
   Animated Form Errors
---------------------------- */
.invalid-feedback {
    display: block;
}

@media (prefers-reduced-motion: no-preference) {
    .is-invalid {
        animation: fieldShake 300ms ease-out;
    }

    .invalid-feedback {
        animation: errorIn 220ms ease-out;
    }
}

@keyframes errorIn {
    from {
        transform: translateY(-2px);
        opacity: 0;
    }

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

@keyframes fieldShake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-2px);
    }

    50% {
        transform: translateX(2px);
    }

    75% {
        transform: translateX(-1px);
    }

    100% {
        transform: translateX(0);
    }
}

/* ---------------------------
   Snippet Cards (shared)
---------------------------- */
.snippets-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.snippets-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.snippets-container.grid-view .snippet-item {
    display: flex;
    flex-direction: column;
    background: rgba(var(--bs-card-bg-rgb), 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.snippets-container.grid-view .snippet-item:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--bs-primary-rgb), 0.3);
    box-shadow: 0 8px 24px rgba(var(--bs-primary-rgb), 0.15);
}

.snippets-container.grid-view .snippet-link {
    display: flex;
    gap: 1rem;
    text-decoration: none;
    color: var(--bs-body-color);
    margin-bottom: 1rem;
}

.snippets-container.grid-view .snippet-icon {
    font-size: 2.5rem;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-primary-rgb), 0.1);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.snippets-container.grid-view .snippet-title {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
    margin-bottom: 0.35rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.snippets-container.grid-view .snippet-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

.snippets-container.grid-view .snippet-language {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(var(--bs-secondary-bg-rgb), 0.45);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    text-transform: lowercase;
}

.snippets-container.grid-view .snippet-collection {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(var(--bs-primary-rgb), 0.10);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.22);
}

.snippets-container.grid-view .snippet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: auto;
}

.snippets-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.snippets-container.list-view .snippet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(var(--bs-card-bg-rgb), 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    transition: all var(--transition-base);
}

.snippets-container.list-view .snippet-item:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.3);
    box-shadow: 0 8px 24px rgba(var(--bs-primary-rgb), 0.12);
}

.snippets-container.list-view .snippet-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--bs-body-color);
    flex: 1;
}

.snippets-container.list-view .snippet-icon {
    font-size: 1.75rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-primary-rgb), 0.1);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.snippets-container.list-view .snippet-title {
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.snippets-container.list-view .snippet-actions {
    display: flex;
    gap: 0.5rem;
}
