/* ============================================
   LinkBink - Premium Dark UI Design System
   ============================================ */

/* CSS Custom Properties */
:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5A4BD1;
    --accent: #FD79A8;
    --accent-light: #FEB8D4;
    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #D63031;
    --info: #0984E3;

    --bg-base: #0A0A1A;
    --bg-surface: #12122A;
    --bg-elevated: #1A1A3E;
    --bg-hover: #222252;
    --bg-glass: rgba(18, 18, 42, 0.65);
    --bg-glass-hover: rgba(26, 26, 62, 0.75);

    --text-primary: #E8E8F0;
    --text-secondary: #9898B8;
    --text-muted: #6868A0;

    --border-color: rgba(108, 92, 231, 0.15);
    --border-glow: rgba(108, 92, 231, 0.4);

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.2);
    --shadow-glow-accent: 0 0 20px rgba(253, 121, 168, 0.2);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ============================================
   Base & Reset
   ============================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent);
}

::selection {
    background: rgba(108, 92, 231, 0.3);
    color: #fff;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   Animated Background
   ============================================ */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}

.bg-orb-1 {
    width: 600px;
    height: 600px;
    background: var(--primary);
    top: -200px;
    right: -100px;
    animation-duration: 25s;
}

.bg-orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    bottom: -100px;
    left: -50px;
    animation-duration: 30s;
    animation-delay: -5s;
}

.bg-orb-3 {
    width: 300px;
    height: 300px;
    background: var(--info);
    top: 50%;
    left: 50%;
    animation-duration: 35s;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -50px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(50px, 30px) scale(1.02);
    }
}

/* ============================================
   App Layout
   ============================================ */
.app-wrapper {
    min-height: 100vh;
    position: relative;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary) !important;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.brand-text {
    font-weight: 700;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

#sidebarClose {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 12px 8px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-fast);
    margin-bottom: 2px;
}

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

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(253, 121, 168, 0.1));
    color: var(--primary-light);
    border: 1px solid var(--border-glow);
}

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

.btn-add-bookmark {
    background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
    color: #fff !important;
    font-weight: 600 !important;
    border: none !important;
    margin-top: 4px;
}

.btn-add-bookmark:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow) !important;
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: auto;
    transition: margin-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Top Bar
   ============================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

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

/* Search */
.search-form {
    flex: 1;
    max-width: 500px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 14px 8px 38px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

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

.search-shortcut {
    position: absolute;
    right: 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    pointer-events: none;
}

/* ============================================
   Buttons
   ============================================ */
.btn-glow {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-glow:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
    color: #fff;
}

.btn-glass {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition);
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.btn-glass:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
    color: var(--text-primary);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 0;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-glow);
}

.btn-icon.active,
.btn-icon.favorited {
    color: var(--warning);
    border-color: rgba(253, 203, 110, 0.3);
}

.btn-icon.danger:hover {
    color: var(--danger);
    border-color: rgba(214, 48, 49, 0.3);
}

/* ============================================
   Glass Cards
   ============================================ */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.glass-card-sm {
    padding: 16px;
}

/* ============================================
   Page Content
   ============================================ */
.page-content {
    padding: 24px;
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: var(--primary-light);
}

/* ============================================
   Stats Cards
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--stat-color, var(--primary)), transparent);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
    border-color: var(--border-glow);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 12px;
    background: linear-gradient(135deg,
            rgba(var(--stat-color-rgb, 108, 92, 231), 0.2),
            rgba(var(--stat-color-rgb, 108, 92, 231), 0.05));
    color: var(--stat-color, var(--primary-light));
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   Bookmark Card
   ============================================ */
.bookmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 16px;
    width: 100%;
}

.bookmark-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.bookmark-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.bookmark-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.bookmark-favicon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.bookmark-favicon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.bookmark-favicon .fallback-icon {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.bookmark-info {
    flex: 1;
    min-width: 0;
}

.bookmark-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-url {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
}

.bookmark-description {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.bookmark-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.bookmark-collection-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
    white-space: nowrap;
}

.bookmark-click-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.bookmark-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.bookmark-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.bookmark-tag:hover {
    color: var(--primary-light);
    border-color: var(--border-glow);
}

.bookmark-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.bookmark-actions .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.bookmark-actions .btn-open {
    margin-left: auto;
}

/* ============================================
   Collection Card
   ============================================ */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 16px;
    width: 100%;
}

.collection-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.collection-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--collection-color, var(--primary));
}

.collection-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.collection-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.collection-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.collection-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.collection-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    flex: 1;
}

.collection-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   Tags Cloud
   ============================================ */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.tag-chip:hover {
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
    border-color: var(--border-glow);
    transform: translateY(-1px);
}

.tag-chip .tag-count {
    background: var(--bg-hover);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================
   Chart Container
   ============================================ */
.chart-container {
    position: relative;
    height: 250px;
}

/* ============================================
   Forms
   ============================================ */
.form-floating label {
    color: var(--text-muted);
}

.form-control,
.form-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-elevated);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.form-check-input {
    background-color: var(--bg-elevated);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ============================================
   Pagination
   ============================================ */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.pagination .page-link {
    background: var(--bg-glass);
    border-color: var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin: 0 2px;
    transition: var(--transition-fast);
}

.pagination .page-link:hover {
    background: var(--bg-hover);
    border-color: var(--border-glow);
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-color: transparent;
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    background: var(--bg-surface);
    color: var(--text-muted);
    opacity: 0.5;
}

/* ============================================
   Alert (Glass)
   ============================================ */
.glass-alert {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    animation: slideDown 0.3s ease;
}

.glass-alert.alert-success {
    border-left: 3px solid var(--success);
}

.glass-alert.alert-danger {
    border-left: 3px solid var(--danger);
}

.glass-alert.alert-info {
    border-left: 3px solid var(--info);
}

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

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

/* ============================================
   Modal Overrides
   ============================================ */
.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.modal-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto 24px;
    line-height: 1.6;
}

/* ============================================
   Error Page
   ============================================ */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 40px;
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 16px;
}

/* ============================================
   Sidebar Overlay (Mobile)
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   Filter Bar
   ============================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar .form-select {
    max-width: 200px;
    font-size: 0.85rem;
    padding: 6px 12px;
}

.filter-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-pill:hover,
.filter-pill.active {
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
    border-color: var(--border-glow);
}

/* ============================================
   Color Selector
   ============================================ */
.color-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.selected {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.color-option.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ============================================
   Icon Selector
   ============================================ */
.icon-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.icon-option {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.1rem;
}

.icon-option:hover {
    border-color: var(--border-glow);
    color: var(--primary-light);
}

.icon-option.selected {
    background: rgba(108, 92, 231, 0.2);
    border-color: var(--primary);
    color: var(--primary-light);
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--primary-light);
    font-size: 1.1rem;
}

.view-all-link {
    font-size: 0.82rem;
    color: var(--primary-light);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.view-all-link:hover {
    color: var(--accent);
}

/* ============================================
   Popular Bookmarks List
   ============================================ */
.popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

.popular-item:last-child {
    border-bottom: none;
}

.popular-item:hover {
    padding-left: 6px;
}

.popular-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.popular-item:nth-child(1) .popular-rank {
    background: linear-gradient(135deg, #FFD700, #FFA502);
    color: #000;
}

.popular-item:nth-child(2) .popular-rank {
    background: linear-gradient(135deg, #C0C0C0, #95A5A6);
    color: #000;
}

.popular-item:nth-child(3) .popular-rank {
    background: linear-gradient(135deg, #CD7F32, #E17055);
    color: #fff;
}

.popular-title {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popular-clicks {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ============================================
   URL Preview
   ============================================ */
.url-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-top: 8px;
}

.url-preview img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
}

.url-preview-info {
    flex: 1;
    min-width: 0;
}

.url-preview-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.url-preview-domain {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner-glow {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-elevated);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 26, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

/* ============================================
   Animations
   ============================================ */
.fade-in {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Staggered animations */
.bookmark-card:nth-child(1) {
    animation-delay: 0.05s;
}

.bookmark-card:nth-child(2) {
    animation-delay: 0.1s;
}

.bookmark-card:nth-child(3) {
    animation-delay: 0.15s;
}

.bookmark-card:nth-child(4) {
    animation-delay: 0.2s;
}

.bookmark-card:nth-child(5) {
    animation-delay: 0.25s;
}

.bookmark-card:nth-child(6) {
    animation-delay: 0.3s;
}

.bookmark-card:nth-child(7) {
    animation-delay: 0.35s;
}

.bookmark-card:nth-child(8) {
    animation-delay: 0.4s;
}

.bookmark-card:nth-child(9) {
    animation-delay: 0.45s;
}

.bookmark-card:nth-child(10) {
    animation-delay: 0.5s;
}

.bookmark-card:nth-child(11) {
    animation-delay: 0.55s;
}

.bookmark-card:nth-child(12) {
    animation-delay: 0.6s;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1199.98px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .bookmark-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 12px;
    }

    .page-header {
        gap: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .bookmark-grid {
        grid-template-columns: 1fr;
    }

    .collection-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 16px;
        height: auto;
        min-height: var(--topbar-height);
        padding: 8px 16px;
    }

    .topbar-right .btn-glow span {
        display: none;
    }

    .search-shortcut {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 16px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filter-bar .ms-auto {
        margin-left: 0 !important;
        width: 100%;
    }

    .filter-bar .form-select {
        flex: 1;
        max-width: none;
    }

    .glass-card {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .sidebar-brand .brand-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 575.98px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topbar-left {
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .search-form {
        max-width: none;
        flex: 1;
    }

    .search-input {
        padding-left: 32px;
        font-size: 0.85rem;
        width: 100%;
    }

    .search-icon {
        left: 10px;
    }

    .btn-user span {
        display: none !important;
    }

    .btn-user {
        padding: 4px;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    .bg-orb-1 {
        width: 300px;
        height: 300px;
    }

    .bg-orb-2 {
        width: 200px;
        height: 200px;
    }

    .bg-orb-3 {
        width: 150px;
        height: 150px;
    }

    .modal-dialog {
        margin: 10px;
    }

    .modal-content {
        padding: 4px;
    }

    .section-title {
        font-size: 0.95rem;
    }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.border-glow {
    border-color: var(--border-glow) !important;
}

.gap-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.w-full {
    width: 100%;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   User Profile & Dropdowns
   ============================================ */
.btn-user {
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    padding: 4px 12px 4px 4px;
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-user:hover {
    background: var(--bg-hover);
    border-color: var(--border-glow);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.glass-dropdown {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-top: 10px !important;
}

.dropdown-item {
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background: rgba(108, 92, 231, 0.2);
    color: var(--primary-light);
}

.dropdown-item i {
    font-size: 1rem;
    width: 20px;
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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