/* Digital Garden - Modern Note-Taking App Design */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Root CSS Variables */
:root {
    /* Colors */
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-200: #bfdbfe;
    --blue-300: #93c5fd;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --blue-900: #1e3a8a;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --black: #000000;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border radius */
    --radius-sm: 0.125rem;
    --radius: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -6px rgb(0 0 0 / 0.04);
}

.dark {
    /* Blue colors remain the same in dark mode */
    --blue-50: #1e3a8a;
    --blue-100: #1e40af;
    --blue-200: #1d4ed8;
    --blue-300: #2563eb;
    --blue-400: #3b82f6;
    --blue-500: #60a5fa;
    --blue-600: #93c5fd;
    --blue-700: #bfdbfe;
    --blue-800: #dbeafe;
    --blue-900: #eff6ff;
    
    /* Gray colors inverted for dark mode */
    --gray-50: #1f2937;
    --gray-100: #374151;
    --gray-200: #4b5563;
    --gray-300: #6b7280;
    --gray-400: #9ca3af;
    --gray-500: #d1d5db;
    --gray-600: #e5e7eb;
    --gray-700: #f3f4f6;
    --gray-800: #f9fafb;
    --gray-900: #ffffff;
    --white: #111827;
    --black: #ffffff;
}

/* Utility Classes */
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.block { display: block; }
.hidden { display: none; }
.h-screen { height: 100vh; }
.h-full { height: 100%; }
.w-full { width: 100%; }
.w-80 { width: 20rem; }
.w-10 { width: 2.5rem; }
.w-6 { width: 1.5rem; }
.w-3 { width: 0.75rem; }
.h-6 { height: 1.5rem; }
.h-3 { height: 0.75rem; }
.h-1 { height: 0.25rem; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.fixed { position: fixed; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.inset-y-0 { top: 0; bottom: 0; }
.left-0 { left: 0; }
.top-0 { top: 0; }
.top-4 { top: 1rem; }
.right-4 { right: 1rem; }
.z-10 { z-index: 10; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.max-w-4xl { max-width: 56rem; }
.max-w-7xl { max-width: 80rem; }
.max-w-2xl { max-width: 42rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.transform { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); }
.-translate-x-full { --tw-translate-x: -100%; }
.translate-x-0 { --tw-translate-x: 0px; }
.translate-y-0 { --tw-translate-y: 0px; }
.-translate-y-1 { --tw-translate-y: -0.25rem; }
.-translate-y-2 { --tw-translate-y: -0.5rem; }
.scale-105 { --tw-scale-x: 1.05; --tw-scale-y: 1.05; }
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
.cursor-pointer { cursor: pointer; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.min-w-0 { min-width: 0px; }

/* Padding */
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.pl-10 { padding-left: 2.5rem; }
.pr-4 { padding-right: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }

/* Margin */
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.ml-4 { margin-left: 1rem; }

/* Text */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-6xl { font-size: 3.75rem; line-height: 1; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Colors */
.bg-white { background-color: var(--white); }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }
.bg-gray-200 { background-color: var(--gray-200); }
.bg-gray-800 { background-color: var(--gray-800); }
.bg-gray-900 { background-color: var(--gray-900); }
.bg-blue-500 { background-color: var(--blue-500); }
.bg-blue-600 { background-color: var(--blue-600); }
.bg-black { background-color: var(--black); }
.bg-opacity-50 { --tw-bg-opacity: 0.5; }

.text-gray-300 { color: var(--gray-300); }
.text-gray-400 { color: var(--gray-400); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-gray-900 { color: var(--gray-900); }
.text-white { color: var(--white); }
.text-blue-500 { color: var(--blue-500); }

.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-r { border-right-width: 1px; }
.border-gray-200 { border-color: var(--gray-200); }
.border-gray-300 { border-color: var(--gray-300); }
.border-gray-600 { border-color: var(--gray-600); }
.border-gray-700 { border-color: var(--gray-700); }
.border-blue-500 { border-color: var(--blue-500); }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* Focus */
.focus\:ring-2:focus { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }
.focus\:ring-blue-500:focus { --tw-ring-opacity: 1; --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); }
.focus\:border-blue-500:focus { border-color: var(--blue-500); }

/* Hover */
.hover\:bg-gray-100:hover { background-color: var(--gray-100); }
.hover\:bg-gray-800:hover { background-color: var(--gray-800); }
.hover\:bg-blue-700:hover { background-color: var(--blue-700); }

/* Dark mode */
.dark .dark\:bg-gray-800 { background-color: var(--gray-800); }
.dark .dark\:bg-gray-900 { background-color: var(--gray-900); }
.dark .dark\:border-gray-700 { border-color: var(--gray-700); }
.dark .dark\:text-gray-300 { color: var(--gray-300); }

/* Spacing utilities */
.space-x-3 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(0.75rem * var(--tw-space-x-reverse)); margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse))); }
.space-x-4 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(1rem * var(--tw-space-x-reverse)); margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); }
.space-x-6 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(1.5rem * var(--tw-space-x-reverse)); margin-left: calc(1.5rem * calc(1 - var(--tw-space-x-reverse))); }
.space-y-1 > :not([hidden]) ~ :not([hidden]) { --tw-space-y-reverse: 0; margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { --tw-space-y-reverse: 0; margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))); margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)); }

/* Grid */
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }

/* Responsive Design */

/* Mobile First: Base styles for mobile devices */
.notes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
}

.empty-state-icon {
    font-size: 2.5rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.125rem;
}

/* Sidebar mobile styles */
#sidebar {
    width: 100%;
    max-width: 320px;
}

/* Sidebar open state - must override Tailwind classes */
#sidebar.open {
    transform: translateX(0) !important;
}

/* Ensure sidebar stays closed when not open on mobile */
@media (max-width: 1023px) {
    #sidebar:not(.open) {
        transform: translateX(-100%) !important;
    }
    
    /* Ensure main content is visible and properly positioned */
    main {
        background-color: var(--gray-50);
        z-index: 1;
        position: relative;
    }
    
    .dark main {
        background-color: var(--gray-900);
    }
}

/* Mobile-specific welcome view */
#welcome-view .max-w-6xl {
    max-width: none;
    padding: 1rem;
}

/* Mobile button adjustments */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

/* Mobile navigation items */
.nav-item {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

/* Tag cloud mobile */
.tag-cloud {
    justify-content: center;
}

.tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Tablet: 640px and up */
@media (min-width: 640px) {
    .sm\:flex-row { flex-direction: row; }
    
    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.25rem;
        padding: 1.5rem;
    }
    
    .empty-state {
        padding: 3rem 2rem;
    }
    
    .empty-state-icon {
        font-size: 3rem;
        margin-bottom: 1.25rem;
    }
    
    .empty-state-title {
        font-size: 1.25rem;
    }
    
    #welcome-view .max-w-6xl {
        padding: 2rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
    
    .tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }
}

/* Large tablets: 768px and up */
@media (min-width: 768px) {
    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
        padding: 2rem;
    }
    
    .empty-state {
        padding: 4rem;
    }
    
    .empty-state-icon {
        font-size: 3.75rem;
        margin-bottom: 1.5rem;
    }
    
    .empty-state-title {
        font-size: 1.25rem;
    }
    
    #welcome-view .max-w-6xl {
        max-width: 4xl;
        padding: 3rem;
    }
    
    /* Welcome page grid improvements */
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Desktop: 1024px and up */
@media (min-width: 1024px) {
    .lg\:hidden { display: none; }
    .lg\:relative { position: relative; }
    .lg\:translate-x-0 { --tw-translate-x: 0px; }
    .lg\:transform-none { transform: none; }
    
    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 2rem;
        padding: 2rem;
    }
    
    #welcome-view .max-w-6xl {
        max-width: 72rem;
        padding: 4rem;
    }
    
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Large desktop: 1280px and up */
@media (min-width: 1280px) {
    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2rem;
        padding: 3rem;
    }
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Loading spinner improvements */
#loading .animate-spin {
    border-top-color: transparent;
    border-right-color: transparent;
    border-left-color: transparent;
    border-bottom-color: var(--blue-500);
    border-width: 3px;
}

/* Custom Components */
body {
    background-color: var(--gray-50);
    color: var(--gray-900);
}

.dark body {
    background-color: var(--gray-900);
    color: var(--gray-100);
}

/* Search Input */
.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.875rem;
}

/* Navigation Items */
.nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    background-color: transparent;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.dark .nav-item {
    color: var(--gray-300);
}

.nav-item:hover {
    background-color: var(--gray-100);
    color: var(--gray-900);
    transform: translateX(2px);
}

.dark .nav-item:hover {
    background-color: var(--gray-800);
    color: var(--gray-100);
}

.nav-item.active {
    background-color: var(--blue-600);
    color: white;
    box-shadow: var(--shadow-sm);
}

.nav-item i {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Notes List */
.notes-list-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem 0;
}

.note-item {
    display: block;
    width: 100%;
    padding: 1rem;
    text-align: left;
    background-color: transparent;
    border: none;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.dark .note-item {
    border-bottom-color: var(--gray-700);
}

.note-item:hover {
    background-color: var(--gray-100);
}

.dark .note-item:hover {
    background-color: var(--gray-800);
}

.note-item.active {
    background-color: var(--blue-600);
    color: white;
}

.note-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.5rem 0;
    line-height: 1.25;
}

.dark .note-item-title {
    color: var(--gray-100);
}

.note-item.active .note-item-title {
    color: white;
}

.note-item-preview {
    font-size: 0.875rem;
    color: var(--gray-500);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .note-item-preview {
    color: var(--gray-400);
}

.note-item.active .note-item-preview {
    color: rgba(255, 255, 255, 0.8);
}

/* Buttons */
.btn-primary {
    background-color: var(--blue-600);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background-color: var(--blue-700);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dark .btn-secondary {
    background-color: var(--gray-700);
    color: var(--gray-200);
    border-color: var(--gray-600);
}

.btn-secondary:hover {
    background-color: var(--gray-200);
    border-color: var(--gray-400);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.dark .btn-secondary:hover {
    background-color: var(--gray-600);
    border-color: var(--gray-500);
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.dark .tag {
    background-color: var(--gray-800);
    color: var(--gray-300);
    border-color: var(--gray-700);
}

.tag:hover {
    background-color: var(--blue-600);
    color: white;
    border-color: var(--blue-600);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Tag Cloud Sizes */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tag-size-1 {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.tag-size-2 {
    font-size: 0.875rem;
    padding: 0.375rem 0.625rem;
}

.tag-size-3 {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
}

.tag-size-4 {
    font-size: 1.125rem;
    padding: 0.625rem 0.875rem;
    font-weight: 600;
}

.tag-size-5 {
    font-size: 1.25rem;
    padding: 0.75rem 1rem;
    font-weight: 700;
    background-color: var(--blue-100);
    color: var(--blue-800);
    border-color: var(--blue-300);
}

.dark .tag-size-5 {
    background-color: var(--blue-900);
    color: var(--blue-200);
    border-color: var(--blue-700);
}

/* Graph Container */
/* Graph container - Mobile responsive */
#graph-container {
    min-height: 400px;
    height: calc(100vh - 120px);
    width: 100%;
    border-radius: var(--radius-lg);
    background-color: var(--gray-50);
    position: relative;
}

.dark #graph-container {
    background-color: var(--gray-900);
}

/* Ensure SVG elements are visible */
#graph-container svg {
    width: 100%;
    height: 100%;
}

#graph-container svg line {
    vector-effect: non-scaling-stroke;
}

#graph-view {
    height: 100vh;
    overflow: hidden;
    padding: 0.5rem;
}

#graph-view .h-full {
    height: calc(100% - 1rem);
}

/* Graph mobile improvements */
@media (min-width: 640px) {
    #graph-container {
        min-height: 500px;
        height: calc(100vh - 160px);
        border-radius: var(--radius-xl);
    }
    
    #graph-view {
        padding: 1rem;
    }
    
    #graph-view .h-full {
        height: calc(100% - 2rem);
    }
}

@media (min-width: 768px) {
    #graph-container {
        min-height: 600px;
        height: calc(100vh - 200px);
    }
    
    #graph-view {
        padding: 1.5rem;
    }
}

/* Prose - Mobile First */
.prose {
    max-width: none;
    color: var(--gray-900);
    line-height: 1.625;
    font-size: 0.875rem;
    padding: 1rem;
}

.dark .prose {
    color: var(--gray-100);
}

/* Article mobile optimization */
#note-article {
    padding: 1rem !important;
}

/* Note view mobile header */
.note-view header {
    padding: 1rem;
}

.note-view .note-header .flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

/* Prose responsive improvements */
@media (min-width: 640px) {
    .prose {
        font-size: 1rem;
        padding: 1.5rem;
    }
    
    #note-article {
        padding: 1.5rem !important;
    }
    
    .note-view header {
        padding: 1.5rem;
    }
    
    .note-view .note-header .flex {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

@media (min-width: 768px) {
    .prose {
        font-size: 1.125rem;
        padding: 2rem;
    }
    
    #note-article {
        padding: 2rem !important;
    }
    
    .note-view header {
        padding: 2rem;
    }
}

.prose h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 4rem 0 2rem 0;
    line-height: 1.25;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 1rem;
}

.dark .prose h1 {
    color: var(--gray-100);
    border-bottom-color: var(--gray-700);
}

.prose h2 {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 3rem 0 1.5rem 0;
    line-height: 1.25;
}

.dark .prose h2 {
    color: var(--gray-100);
}

.prose h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 2.5rem 0 1.25rem 0;
    line-height: 1.25;
}

.dark .prose h3 {
    color: var(--gray-100);
}

.prose p {
    font-size: 1rem;
    color: var(--gray-700);
    margin: 0 0 1.5rem 0;
    line-height: 1.625;
}

.dark .prose p {
    color: var(--gray-300);
}

.prose ul, .prose ol {
    margin: 0 0 1.5rem 0;
    padding-left: 1.5rem;
}

.prose li {
    margin: 0 0 0.5rem 0;
    color: var(--gray-700);
    line-height: 1.625;
}

.dark .prose li {
    color: var(--gray-300);
}

.prose strong {
    font-weight: 600;
    color: var(--gray-900);
}

.dark .prose strong {
    color: var(--gray-100);
}

.prose code {
    background-color: var(--gray-100);
    color: var(--gray-900);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
}

.dark .prose code {
    background-color: var(--gray-800);
    color: var(--gray-100);
}

/* Empty State - Base styles (responsive versions in media queries above) */
.dark .empty-state-icon {
    color: var(--gray-600);
}

.empty-state-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 1rem;
}

.dark .empty-state-title {
    color: var(--gray-100);
}

.empty-state-description {
    font-size: 1rem;
    color: var(--gray-600);
    line-height: 1.625;
}

.dark .empty-state-description {
    color: var(--gray-400);
}

/* Loading */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Loading overlay */
#loading {
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#loading > div {
    animation: fadeIn 0.3s ease-out;
}

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

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

/* Line clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Max width utilities */
.prose-lg {
    font-size: 1.125rem;
    line-height: 1.7777778;
}

.max-w-none {
    max-width: none;
} 

/* Sidebar - Mobile First Design */
#sidebar {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#sidebar .overflow-y-auto {
    flex: 1;
    overflow-y: auto;
}

/* Sidebar header responsive */
.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.dark .sidebar-header {
    border-bottom-color: var(--gray-700);
}

.sidebar-header h1 {
    color: var(--gray-900);
}

.dark .sidebar-header h1 {
    color: var(--gray-100);
}

/* Search input mobile optimization */
.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

#search-input {
    font-size: 16px; /* Prevents zoom on iOS */
}

/* Notes list mobile optimization */
.notes-list-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.dark .notes-list-header {
    border-bottom-color: var(--gray-700);
}

.notes-list-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dark .notes-list-title {
    color: var(--gray-400);
}

/* Note item mobile styles */
.note-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    border-bottom: 1px solid var(--gray-100);
}

.dark .note-item {
    border-bottom-color: var(--gray-800);
}

.note-item:hover {
    background-color: var(--gray-50);
}

.dark .note-item:hover {
    background-color: var(--gray-800);
}

.note-item.active {
    background-color: var(--blue-50);
    border-left: 3px solid var(--blue-500);
}

.dark .note-item.active {
    background-color: var(--blue-900);
}

.note-item.active .note-item-title {
    color: var(--blue-900);
    font-weight: 600;
}

.dark .note-item.active .note-item-title {
    color: var(--blue-100);
}

.note-item.active .note-item-preview {
    color: var(--blue-700);
}

.dark .note-item.active .note-item-preview {
    color: var(--blue-200);
}

.note-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    line-height: 1.25;
}

.dark .note-item-title {
    color: var(--gray-100);
}

.note-item-preview {
    font-size: 0.75rem;
    color: var(--gray-600);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .note-item-preview {
    color: var(--gray-400);
}

@media (min-width: 640px) {
    .sidebar-header {
        padding: 1.5rem;
    }
    
    .notes-list-header {
        padding: 1rem 1.5rem;
    }
    
    .note-item {
        padding: 1rem 1.5rem;
    }
}

/* Note Cards - Mobile First Design */
.note-card {
    background-color: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.dark .note-card {
    background-color: var(--gray-800);
    border-color: var(--gray-700);
}

.note-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.dark .note-card:hover {
    border-color: var(--gray-600);
}

.note-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.5rem 0;
    line-height: 1.25;
}

.dark .note-card-title {
    color: var(--gray-100);
}

.note-card-excerpt {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin: 0 0 0.75rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .note-card-excerpt {
    color: var(--gray-400);
}

.note-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.dark .note-card-meta {
    color: var(--gray-400);
}

/* Note card responsive improvements */
@media (min-width: 640px) {
    .note-card {
        padding: 1.25rem;
        margin-bottom: 0;
    }
    
    .note-card-title {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    .note-card-excerpt {
        -webkit-line-clamp: 3;
        margin-bottom: 1rem;
    }
    
    .note-card-meta {
        flex-wrap: nowrap;
    }
}

@media (min-width: 768px) {
    .note-card {
        padding: 1.5rem;
    }
}

/* Notes Grid - Now defined in responsive section above */

/* Graph styles */
.graph-node {
    cursor: pointer;
    fill: var(--blue-500);
    stroke: var(--blue-600);
    stroke-width: 2px;
    transition: all 0.2s ease-in-out;
}

.graph-node:hover, .graph-node.selected {
    fill: var(--blue-600);
    stroke: var(--blue-700);
    stroke-width: 3px;
}

.graph-link {
    stroke: var(--gray-700) !important;
    stroke-opacity: 1 !important;
    stroke-width: 2px !important;
    fill: none !important;
    stroke-linecap: round !important;
}

.dark .graph-link {
    stroke: var(--gray-300) !important;
    stroke-opacity: 1 !important;
}

.graph-node-label {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.75rem;
    fill: var(--gray-700);
    text-anchor: middle;
    pointer-events: none;
    font-weight: 500;
}

.dark .graph-node-label {
    fill: var(--gray-300);
}

/* Internal Links (Wiki Links) - Mobile friendly */
.internal-link {
    color: var(--blue-600);
    text-decoration: none;
    border-bottom: 1px solid var(--blue-300);
    padding-bottom: 1px;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    /* Increase touch target on mobile */
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: 2px;
    min-height: 44px; /* iOS accessibility guideline */
    display: inline-block;
}

.dark .internal-link {
    color: var(--blue-400);
    border-bottom-color: var(--blue-600);
}

.internal-link:hover, .internal-link:active {
    color: var(--blue-700);
    border-bottom-color: var(--blue-700);
    background-color: var(--blue-50);
}

.dark .internal-link:hover, .dark .internal-link:active {
    color: var(--blue-300);
    border-bottom-color: var(--blue-300);
    background-color: var(--blue-900);
}

/* Chat Interface Styles - Rasa-like Design */
#chat-interface {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 9999 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#chat-toggle {
    position: relative !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4), 0 4px 8px rgba(0, 0, 0, 0.1) !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
}

#chat-toggle:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6), 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

#chat-toggle.chat-open {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    transform: rotate(180deg) !important;
}

/* Notification badge */
#chat-toggle::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    border: 2px solid white;
    opacity: 0;
    animation: pulse 2s infinite;
}

#chat-toggle.has-notification::after {
    opacity: 1;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

#chat-window {
    position: absolute !important;
    bottom: 80px !important;
    right: 0 !important;
    width: 380px !important;
    height: 500px !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 32px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    overflow: hidden !important;
    transform-origin: bottom right !important;
    animation: chatWindowSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.dark #chat-window {
    background: #1f2937 !important;
    border-color: #374151 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 8px 32px rgba(0, 0, 0, 0.2) !important;
}

#chat-window.minimized {
    height: 60px !important;
    animation: chatWindowMinimize 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@keyframes chatWindowSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes chatWindowMinimize {
    0% {
        height: 500px;
    }
    100% {
        height: 60px;
    }
}

/* Chat Header Styles */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    padding: 16px !important;
    color: white !important;
    border-radius: 16px 16px 0 0 !important;
    position: relative !important;
}

.chat-header-content {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.chat-status-indicator {
    display: inline-flex !important;
    align-items: center !important;
    font-size: 11px !important;
    opacity: 0.9 !important;
}

.chat-status-indicator::before {
    content: '' !important;
    width: 6px !important;
    height: 6px !important;
    background: #10b981 !important;
    border-radius: 50% !important;
    margin-right: 6px !important;
    animation: pulse 2s infinite !important;
}

.chat-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.chat-action-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05) !important;
}

/* Chat Messages Styles */
#chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 16px !important;
    background: #f8fafc !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent !important;
}

.dark #chat-messages {
    background: #111827 !important;
}

#chat-messages::-webkit-scrollbar {
    width: 4px !important;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent !important;
}

#chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1) !important;
    border-radius: 2px !important;
}

.dark #chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Message Bubbles */
.chat-message {
    margin-bottom: 16px !important;
    animation: messageSlideIn 0.3s ease-out !important;
}

.chat-message-user {
    display: flex !important;
    justify-content: flex-end !important;
}

.chat-message-bot {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
}

.message-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
}

.message-bubble {
    max-width: 75% !important;
    padding: 12px 16px !important;
    border-radius: 18px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    position: relative !important;
}

.message-bubble-user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-bottom-right-radius: 4px !important;
}

.message-bubble-bot {
    background: white !important;
    color: #374151 !important;
    border: 1px solid #e5e7eb !important;
    border-bottom-left-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.dark .message-bubble-bot {
    background: #374151 !important;
    color: #f3f4f6 !important;
    border-color: #4b5563 !important;
}

.message-timestamp {
    font-size: 10px !important;
    opacity: 0.6 !important;
    margin-top: 4px !important;
    text-align: right !important;
}

.message-bubble-user .message-timestamp {
    text-align: left !important;
}

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

/* Chat Input Area */
.chat-input-area {
    padding: 16px !important;
    border-top: 1px solid #e5e7eb !important;
    background: white !important;
    border-radius: 0 0 16px 16px !important;
}

.dark .chat-input-area {
    border-color: #374151 !important;
    background: #1f2937 !important;
}

.chat-input-container {
    display: flex !important;
    align-items: flex-end !important;
    gap: 8px !important;
    position: relative !important;
}

.chat-input-field {
    flex: 1 !important;
    min-height: 20px !important;
    max-height: 100px !important;
    padding: 10px 12px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 20px !important;
    resize: none !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    background: #f9fafb !important;
    transition: all 0.2s ease !important;
    font-family: inherit !important;
}

.dark .chat-input-field {
    background: #374151 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
}

.chat-input-field:focus {
    outline: none !important;
    border-color: #667eea !important;
    background: white !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.dark .chat-input-field:focus {
    background: #4b5563 !important;
}

.chat-send-btn {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

.chat-send-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.chat-input-meta {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 8px !important;
    font-size: 11px !important;
    color: #6b7280 !important;
}

.dark .chat-input-meta {
    color: #9ca3af !important;
}

/* Typing Indicator */
.typing-indicator {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 8px 0 !important;
}

.typing-dot {
    width: 6px !important;
    height: 6px !important;
    background: #6b7280 !important;
    border-radius: 50% !important;
    animation: typingBounce 1.4s infinite ease-in-out both !important;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s !important; }
.typing-dot:nth-child(2) { animation-delay: -0.16s !important; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile touch improvements */
@media (max-width: 768px) {
    #chat-interface {
        bottom: 16px !important;
        right: 16px !important;
    }
    
    /* Chat mobile adjustments */
    #chat-window {
        width: calc(100vw - 32px) !important;
        max-width: 360px !important;
        height: 70vh !important;
        max-height: 500px !important;
        right: -8px !important;
        bottom: 70px !important;
    }
    
    #chat-toggle {
        width: 56px !important;
        height: 56px !important;
    }
    
    /* Larger touch targets for mobile */
    .btn-primary, .btn-secondary {
        min-height: 44px;
        padding: 0.75rem 1.25rem;
    }
    
    .nav-item {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }
    
    .tag {
        min-height: 32px;
        padding: 0.375rem 0.75rem;
    }
    
    /* Prevent text selection on mobile interactive elements */
    .note-card, .nav-item, .btn-primary, .btn-secondary, .tag {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Better mobile scroll behavior */
    #sidebar, .prose, #graph-container, #chat-messages {
        -webkit-overflow-scrolling: touch;
    }
} 