/* ========================================
   Notes App — Custom Stylesheet
   ======================================== */

/* ---- CSS Variables (Dark Theme — default) ---- */
:root,
[data-theme="dark"] {
    --bg-body: #0b0e14;
    --bg-surface: #121720;
    --bg-surface-hover: #1a2130;
    --bg-glass: rgba(18, 23, 32, 0.75);
    --bg-glass-hover: rgba(26, 33, 48, 0.85);
    --accent-primary: #6c63ff;
    --accent-primary-light: #8b83ff;
    --accent-secondary: #00d4aa;
    --accent-gradient: linear-gradient(135deg, #6c63ff 0%, #00d4aa 100%);
    --accent-gradient-hover: linear-gradient(135deg, #8b83ff 0%, #33e0bf 100%);
    --text-primary: #e6e9f0;
    --text-secondary: #8892a4;
    --text-muted: #5a6478;
    --border-color: rgba(108, 99, 255, 0.12);
    --border-glow: rgba(108, 99, 255, 0.35);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.18);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.28);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.35);
    --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.15);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 50px;
    --transition-fast: 0.18s cubic-bezier(.4,0,.2,1);
    --transition-default: 0.3s cubic-bezier(.4,0,.2,1);
    --transition-slow: 0.5s cubic-bezier(.4,0,.2,1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mesh-color-1: rgba(108, 99, 255, 0.07);
    --mesh-color-2: rgba(0, 212, 170, 0.05);
    --scrollbar-bg: #0b0e14;
}

/* ---- Light Theme ---- */
[data-theme="light"] {
    --bg-body: #f4f6fb;
    --bg-surface: #ffffff;
    --bg-surface-hover: #eef1f8;
    --bg-glass: rgba(255, 255, 255, 0.82);
    --bg-glass-hover: rgba(238, 241, 248, 0.92);
    --accent-primary: #5b52e0;
    --accent-primary-light: #6c63ff;
    --accent-secondary: #00b894;
    --accent-gradient: linear-gradient(135deg, #6c63ff 0%, #00d4aa 100%);
    --accent-gradient-hover: linear-gradient(135deg, #8b83ff 0%, #33e0bf 100%);
    --text-primary: #1a1d26;
    --text-secondary: #555e70;
    --text-muted: #8892a4;
    --border-color: rgba(108, 99, 255, 0.12);
    --border-glow: rgba(108, 99, 255, 0.25);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.1);
    --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.08);
    --mesh-color-1: rgba(108, 99, 255, 0.04);
    --mesh-color-2: rgba(0, 212, 170, 0.03);
    --scrollbar-bg: #f4f6fb;
}

/* Light theme alert overrides */
[data-theme="light"] .alert-danger {
    background: rgba(220, 53, 69, 0.08);
    color: #c62828;
    border-color: rgba(220, 53, 69, 0.15);
}

[data-theme="light"] .alert-success {
    background: rgba(0, 184, 148, 0.08);
    color: #00795c;
    border-color: rgba(0, 184, 148, 0.15);
}

[data-theme="light"] .alert-warning {
    background: rgba(255, 152, 0, 0.08);
    color: #e65100;
    border-color: rgba(255, 152, 0, 0.15);
}

[data-theme="light"] ::selection {
    background: rgba(108, 99, 255, 0.18);
    color: #1a1d26;
}

/* ---- Base ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    transition: background var(--transition-default), color var(--transition-default);
}

/* Animated gradient mesh background */
body::before {
    content: '';
    position: fixed;
    top: -40%;
    left: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse at center, var(--mesh-color-1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 12s ease-in-out infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    right: -15%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse at center, var(--mesh-color-2) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 15s ease-in-out infinite alternate-reverse;
}

@keyframes bgPulse {
    0% { opacity: 0.5; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.15); }
}

/* ---- Glassmorphism Navbar ---- */
.glass-navbar {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 1030;
    transition: background var(--transition-default);
}

.glass-navbar .navbar-brand {
    color: var(--text-primary) !important;
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.brand-icon {
    font-size: 1.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 6px rgba(108, 99, 255, 0.4));
}

.brand-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-navbar .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color var(--transition-fast), transform var(--transition-fast);
    padding: 0.5rem 0.8rem !important;
    border-radius: var(--radius-sm);
}

.glass-navbar .nav-link:hover {
    color: var(--accent-primary-light) !important;
    transform: translateY(-1px);
}

.avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.glass-dropdown {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.glass-dropdown .dropdown-item {
    color: var(--text-secondary);
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.glass-dropdown .dropdown-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* ---- Theme Toggle ---- */
.theme-toggle-btn {
    background: none !important;
    border: none !important;
    padding: 0.4rem 0.5rem !important;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-secondary) !important;
    transition: all var(--transition-fast);
    line-height: 1;
    text-decoration: none !important;
}

.theme-toggle-btn:hover {
    color: var(--accent-primary-light) !important;
    transform: scale(1.15) rotate(15deg);
}

/* ---- Main Content ---- */
.main-content {
    position: relative;
    z-index: 1;
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* ---- App Layout & Sidebar ---- */
.app-layout {
    display: flex;
    flex: 1;
}

.app-sidebar {
    width: 250px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

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

.sidebar-link.active {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    font-weight: 600;
    position: relative;
    border: 1px solid var(--border-glow);
    box-shadow: var(--shadow-sm);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 50%;
    background: var(--accent-gradient);
    border-radius: 0 4px 4px 0;
}

.app-content {
    flex: 1;
    min-width: 0; 
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    .app-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 0.8rem;
        flex-direction: row;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .app-sidebar::-webkit-scrollbar {
        display: none;
    }
    .sidebar-link {
        white-space: nowrap;
        padding: 0.6rem 1rem;
    }
    .sidebar-link.active::before {
        display: none;
    }
}

/* ---- Hero Section (Landing) ---- */
.hero-section {
    padding: 6rem 0 4rem;
    text-align: center;
    position: relative;
}

.hero-section h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.2rem;
}

.hero-section h1 .gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-section .lead {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

.hero-cta {
    display: inline-flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ---- Buttons ---- */
.btn-gradient {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.7rem 1.8rem;
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    transition: all var(--transition-default);
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; right: 0; bottom: 0;
    background: var(--accent-gradient-hover);
    transition: left var(--transition-default);
    z-index: 0;
}

.btn-gradient:hover::before {
    left: 0;
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(108, 99, 255, 0.45);
    color: #fff;
}

.btn-gradient span,
.btn-gradient i {
    position: relative;
    z-index: 1;
}

.btn-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
    padding: 0.7rem 1.8rem;
    border-radius: var(--radius-pill);
    font-size: 0.95rem;
    transition: all var(--transition-default);
}

.btn-glass:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glow);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* ---- Feature Cards (Landing) ---- */
.features-section {
    padding: 3rem 0 5rem;
}

.feature-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: all var(--transition-default);
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--accent-gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    margin-bottom: 1.2rem;
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.25);
}

.feature-card h5 {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.6rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 0;
}

/* ---- Glass Card (Generic) ---- */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-default);
}

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

/* ---- Auth Forms ---- */
.auth-wrapper {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-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: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.auth-card h2 {
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.3rem;
}

.auth-card .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.8rem;
}

/* ---- Form Styling ---- */
.form-floating > .form-control,
.form-floating > .form-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 0.92rem;
}

.form-floating > .form-control:focus,
.form-floating > .form-select:focus {
    background: var(--bg-surface-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
    color: var(--text-primary);
}

.form-floating > label {
    color: var(--text-muted);
    font-size: 0.88rem;
}

textarea.form-control {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

textarea.form-control:focus {
    background: var(--bg-surface-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
    color: var(--text-primary);
}

/* ---- Dashboard ---- */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.dashboard-header h1 .gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.stat-chip {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.stat-chip .stat-value {
    color: var(--accent-primary-light);
    font-weight: 700;
}

/* ---- Tags Horizontal Scroll Bar ---- */
.tags-bar-wrapper {
    margin-bottom: 1.5rem;
}

.tags-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE/Edge */
    padding: 0.3rem 0;
    align-items: center;
}

.tags-bar::-webkit-scrollbar {
    display: none;                  /* Chrome/Safari */
}

.tag-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--tag-color, var(--border-color));
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

.tag-chip:hover {
    border-color: var(--tag-color, var(--border-glow));
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Active state for system chips (All, Pinned, Untagged — no --tag-color) */
.tag-chip.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 3px 12px rgba(108, 99, 255, 0.3);
}

/* Active state for user tags — solid tag color background */
.tag-chip[data-tag-id].active[style*="--tag-color"] {
    background: var(--tag-color) !important;
    border-color: var(--tag-color) !important;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 3px 12px color-mix(in srgb, var(--tag-color) 40%, transparent);
}

/* Hide the dot when tag is active (chip is already that color) */
.tag-chip.active .tag-dot {
    background: #fff !important;
}

.tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-add-btn,
.tag-manage-btn {
    border-style: dashed;
    color: var(--text-muted);
    padding: 0.4rem 0.7rem;
}

.tag-add-btn:hover,
.tag-manage-btn:hover {
    color: var(--accent-primary-light);
    border-color: var(--accent-primary);
}

/* ---- Tag Selection in Forms ---- */
.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-select-chip {
    cursor: pointer;
    margin: 0;
}

.tag-select-chip input[type="checkbox"] {
    display: none;
}

.tag-select-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.tag-select-chip:hover .tag-select-label {
    border-color: var(--border-glow);
    color: var(--text-primary);
}

.tag-select-chip input:checked + .tag-select-label {
    background: var(--tag-color, var(--accent-primary));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(108, 99, 255, 0.25);
}

.tag-select-chip input:checked + .tag-select-label .tag-dot {
    background: #fff !important;
}

/* ---- Note Tag Badges (on note cards) ---- */
.note-tag-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.note-tag-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--tag-color, var(--accent-primary));
    color: #fff;
    opacity: 0.85;
    letter-spacing: 0.01em;
}

/* ---- Note Cards ---- */
.note-card {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-default);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.note-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-default);
}

.note-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.note-card:hover::before {
    opacity: 1;
}

.note-card .note-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card .note-preview {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.note-card .note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-card .note-actions {
    display: flex;
    gap: 0.4rem;
}

.note-card .note-actions .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

/* Theme-adaptive note action buttons (fixes light-theme visibility) */
.btn-note-action {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-note-action:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary-light);
}

/* ---- Quick Pin Toggle ---- */
.pin-toggle-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--bg-glass);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 2;
    padding: 0;
}

.pin-toggle-btn:hover {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 212, 170, 0.2);
}

.pin-toggle-btn.pinned {
    color: var(--accent-secondary);
    border-color: var(--accent-secondary);
    background: rgba(0, 212, 170, 0.1);
}

.pin-toggle-btn.pinned:hover {
    background: rgba(0, 212, 170, 0.2);
}

@keyframes pinBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.3) rotate(-10deg); }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.pin-toggle-btn.just-toggled {
    animation: pinBounce 0.4s ease;
}

/* ---- Note View ---- */
.note-view-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
}

.note-view-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent-gradient);
}

.note-view-card h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.note-view-card .note-body {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.85;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.note-view-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* ---- Search Bar ---- */
.search-bar {
    position: relative;
    max-width: 360px;
}

.search-bar .form-control {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-pill);
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    font-size: 0.88rem;
    transition: all var(--transition-fast);
}

.search-bar .form-control:focus {
    background: var(--bg-surface-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.search-bar .search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

/* ---- Alert Enhancements ---- */
.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.88rem;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.12);
    color: #ff6b7a;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.alert-success {
    background: rgba(0, 212, 170, 0.1);
    color: var(--accent-secondary);
    border: 1px solid rgba(0, 212, 170, 0.2);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #ffd54f;
    border: 1px solid rgba(255, 193, 7, 0.2);
}

/* ---- Footer ---- */
.app-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 1.2rem;
}

.empty-state h4 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.5s var(--transition-default) both;
}

.animate-fade-in-delay-1 { animation-delay: 0.1s; }
.animate-fade-in-delay-2 { animation-delay: 0.2s; }
.animate-fade-in-delay-3 { animation-delay: 0.3s; }
.animate-fade-in-delay-4 { animation-delay: 0.4s; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .hero-section {
        padding: 3.5rem 0 2rem;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .auth-card {
        padding: 1.8rem;
    }

    .note-view-card {
        padding: 1.5rem;
    }

    .dashboard-header h1 {
        font-size: 1.4rem;
    }

    .tags-bar {
        padding-bottom: 0.5rem;
    }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-bg);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ---- Selection ---- */
::selection {
    background: rgba(108, 99, 255, 0.3);
    color: #fff;
}

/* ---- Checkbox custom ---- */
.form-check-input:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

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

/* ---- Add Tag Inline ---- */
.add-tag-inline .form-control {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
}

.add-tag-inline .form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.12);
}

/* ---- Tag Manager Modal ---- */
.glass-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

.glass-modal .modal-header {
    padding: 1.2rem 1.5rem 0.6rem;
}

.glass-modal .modal-body {
    padding: 0.8rem 1.5rem 1.5rem;
}

.glass-modal .btn-close {
    filter: var(--bs-btn-close-white-filter, none);
}

[data-theme="dark"] .glass-modal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.tag-manager-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.7rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
    background: var(--bg-glass);
    transition: all var(--transition-fast);
}

.tag-manager-row:hover {
    border-color: var(--border-glow);
}

.tag-manager-row .tag-mgr-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.tag-manager-row .tag-mgr-dot:hover {
    transform: scale(1.3);
    border-color: var(--text-muted);
}

.tag-manager-row .tag-mgr-name {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-manager-row .tag-mgr-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.tag-manager-row .tag-mgr-actions .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-tag-edit {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-tag-edit:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary-light);
    background: var(--bg-surface-hover);
}

.btn-tag-delete {
    background: transparent;
    border: 1px solid rgba(220, 53, 69, 0.2);
    color: var(--text-muted);
}

.btn-tag-delete:hover {
    border-color: rgba(220, 53, 69, 0.5);
    color: #ff6b7a;
    background: rgba(220, 53, 69, 0.06);
}

/* Inline edit mode */
.tag-manager-row.editing {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.1);
}

.tag-manager-row .tag-mgr-edit-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    min-width: 0;
}

.tag-manager-row .tag-mgr-edit-input:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.1);
}
