:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-dark: #1e293b;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --border-radius: 4px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --link-color: #1e3a8a;
    --link-hover: #1e40af;
}

/* Links - Standard content links use neutral dark blue */
a {
    color: var(--link-color);
    text-decoration: none !important;
    transition: color 0.2s;
}

a:hover {
    color: var(--link-hover);
    text-decoration: none !important;
}

/* Buttons and primary UI elements use accent color */
.btn,
a.btn,
a.text-primary,
a.link-primary,
a.btn-link {
    color: var(--primary-color);
}

.btn:hover,
a.btn:hover,
a.text-primary:hover,
a.link-primary:hover,
a.btn-link:hover {
    color: var(--primary-hover);
}

/* Override Bootstrap link colors for UI elements */
a.text-primary,
a.link-primary,
a.btn-link {
    color: var(--primary-color) !important;
}

a.text-primary:hover,
a.link-primary:hover,
a.btn-link:hover {
    color: var(--primary-hover) !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.login-box {
    position: relative;
    z-index: 2;
    background: var(--bg-primary);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(10px);
}

.login-box h1 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white !important;
}

.btn-primary:hover {
    background-color: var(--primary-color);
    filter: brightness(0.85);
    color: white !important;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white !important;
}

.btn-secondary:hover {
    background-color: var(--secondary-color);
    filter: brightness(0.85);
    color: white !important;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white !important;
}

.btn-danger:hover {
    background-color: var(--danger-color);
    filter: brightness(0.85);
    color: white !important;
}

.btn-success {
    background-color: var(--success-color);
    color: white !important;
}

.btn-success:hover {
    background-color: var(--success-color);
    filter: brightness(0.85);
    color: white !important;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white !important;
}

.btn-warning:hover {
    background-color: var(--warning-color);
    filter: brightness(0.85);
    color: white !important;
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-color, var(--bg-dark));
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%) !important;
        width: 280px !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 1000 !important;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .content-area {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .card {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
    }
    
    .card-header {
        flex-direction: row;
        gap: 1rem;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .card-header .card-title {
        flex: 1;
        min-width: 0;
        margin-bottom: 0;
    }
    
    .card-header .btn,
    .card-header .d-flex {
        flex-shrink: 0;
        margin-top: 0;
    }
    
    .card-header .d-flex {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
    
    @media (min-width: 480px) {
        .card-header .d-flex {
            width: auto;
            margin-top: 0;
        }
    }
    
    .file-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    
    .file-item {
        padding: 1rem;
    }
    
    .file-icon {
        font-size: 2.5rem;
    }
    
    .navbar {
        padding: 0.75rem 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .navbar-left {
        flex: 1;
        min-width: 0;
    }
    
    .navbar-brand h4 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .navbar-user {
        flex-direction: row;
        gap: 0.5rem;
        align-items: center;
        flex-wrap: wrap;
        flex-shrink: 0;
    }
    
    .user-info {
        font-size: 0.875rem;
        white-space: nowrap;
    }
    
    .btn-logout {
        font-size: 0.875rem;
        padding: 0.4rem 0.8rem;
        white-space: nowrap;
    }
    
    .wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        position: relative;
    }
    
    body {
        overflow-x: hidden;
    }
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
}

.sidebar-menu li {
    margin-bottom: 0.25rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-radius: var(--border-radius);
    margin: 0 0.5rem;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-menu a.active {
    background: var(--primary-color);
    color: white;
}

/* Don't highlight parent link when only child is active */
.has-submenu.active > a:not(.active) {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
}

.has-submenu.active > a:not(.active):hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Sidebar logout link - same style as other sidebar links */
.sidebar-logout {
    color: rgba(255, 255, 255, 0.8) !important;
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.sidebar-menu a i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-menu a {
    position: relative;
}

.submenu-toggle {
    margin-left: auto !important;
    margin-right: 0 !important;
    width: auto !important;
    transition: transform 0.3s;
}

.has-submenu.active .submenu-toggle {
    transform: rotate(180deg);
}

.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.has-submenu.active .submenu {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
}

.submenu li {
    margin: 0;
}

.submenu a {
    padding-left: 3rem !important;
    font-size: 0.9rem;
}

.menu-divider {
    margin: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
}

/* Sidebar search - transparent with same colors as menu items */
.sidebar-search-input {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    transition: all 0.2s !important;
}

.sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.sidebar-search-input:focus {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    outline: none !important;
}

.sidebar-search-btn {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    transition: all 0.2s !important;
}

.sidebar-search-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.navbar {
    background: var(--bg-primary);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
}

.navbar-brand h4 {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.navbar-brand-short {
    display: none;
}

@media (max-width: 768px) {
    .navbar-brand-full {
        display: none;
    }
    
    .navbar-brand-short {
        display: block;
    }
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.badge-role {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    font-weight: 500;
}

.btn-logout {
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    color: white !important;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: filter 0.2s;
}

.btn-logout:hover {
    background: var(--danger-color);
    filter: brightness(0.85);
    color: white !important;
}

.content-area {
    padding: 2rem;
    flex: 1;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    margin-left: 0;
    margin-right: 0;
    padding-bottom: 1rem;
    padding-left: 0;
    padding-right: 0;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

/* Notes/Dashboard */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

/* Pinboard - Full width cards on desktop */
#pinsGrid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

#pinsGrid .pin-card {
    width: 100%;
    max-width: 100%;
}

.note-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    cursor: move;
}

.note-card.dragging {
    opacity: 0.5;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.note-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.note-card[data-color]::before {
    background: var(--note-color);
}

.note-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.note-content {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.note-link {
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.note-link:hover {
    color: var(--link-hover);
    text-decoration: none;
}

.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: var(--border-radius);
    z-index: 10;
    pointer-events: none;
}

.note-card.active .note-actions {
    opacity: 1;
    pointer-events: auto;
}

.note-card {
    position: relative;
    overflow: hidden;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: white;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table thead {
    background: var(--bg-secondary);
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

/* File Browser */
.file-browser {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--link-color);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    transition: background 0.2s, color 0.2s;
}

.breadcrumb a:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--link-hover);
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--text-secondary);
}

.file-browser-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.file-search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.search-input-group input {
    flex: 1;
}

@media (min-width: 768px) {
    .file-browser-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .file-search-form {
        max-width: 400px;
    }
}

.file-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .file-list {
        display: table;
        width: 100%;
        border-collapse: collapse;
        margin-top: 0.5rem;
    }
}

/* Default: Grid view (desktop) */
.file-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    text-align: center;
}

.file-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    text-decoration: none;
}

/* List view - Windows Explorer style */
.file-list.list-view {
    display: block;
    grid-template-columns: none;
}

.file-list.list-view .file-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    padding: 0.5rem 1rem;
    margin-bottom: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

.file-list.list-view .file-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 0.75rem;
    text-decoration: none;
}

.file-list.list-view .file-icon {
    font-size: 1.25rem;
    margin-bottom: 0;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
    line-height: 1;
}

.file-list.list-view .file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: normal;
    color: var(--text-primary);
}

.file-list.list-view .file-meta {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    margin-top: 0;
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-right: 1rem;
}

.file-list.list-view .file-actions {
    display: flex;
    flex-direction: row;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    align-items: center;
}

.file-list.list-view .file-link {
    flex-direction: row;
    align-items: center;
    flex: 1;
    gap: 0.75rem;
    min-width: 0;
}

.file-list.list-view .file-icon {
    font-size: 1.5rem;
    margin-bottom: 0;
    flex-shrink: 0;
}

.file-list.list-view .file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0;
    font-size: 0.9rem;
}

.file-list.list-view .file-meta {
    flex-direction: row;
    gap: 1rem;
    margin-top: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.file-list.list-view .file-actions {
    flex-direction: row;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.file-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-item.folder {
    border-color: #fbbf24;
}

.file-item.folder:hover {
    border-color: #f59e0b;
}

.file-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.file-item.folder .file-icon {
    color: #fbbf24;
}

.file-item:hover .file-icon {
    color: var(--primary-color);
}

.file-item.folder:hover .file-icon {
    color: #f59e0b;
}

.file-name {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    word-break: break-word;
    width: 100%;
    color: var(--text-primary);
    line-height: 1.3;
}

.file-name a {
    color: var(--link-color);
    text-decoration: none !important;
}

.file-name a:hover {
    color: var(--link-hover);
    text-decoration: none !important;
}

.file-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    margin-top: auto;
}

.file-size {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.file-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.file-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.file-actions a,
.file-actions button {
    padding: 0.25rem 0.5rem;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 32px;
    justify-content: center;
}

.file-actions button[type="submit"],
.file-actions form button {
    padding: 0.25rem 0.4rem;
    min-width: 28px;
}

.file-actions form {
    display: inline;
}

/* Page Title */
.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Page Content Links */
.page-content a,
.content-area a:not(.btn):not(.btn-link):not(.nav-link):not(.sidebar-menu a):not(.note-actions a) {
    color: var(--link-color);
    text-decoration: underline;
}

.page-content a:hover,
.content-area a:not(.btn):not(.btn-link):not(.nav-link):not(.sidebar-menu a):not(.note-actions a):hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* WYSIWYG Editor */
.ql-container {
    font-family: inherit;
    font-size: 1rem;
    border-radius: var(--border-radius);
}

.ql-toolbar {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-color: var(--border-color);
}

.ql-container {
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    border-color: var(--border-color);
}

.ql-editor {
    min-height: 300px;
}

.ql-editor.ql-blank::before {
    font-style: normal;
    color: var(--text-secondary);
}

/* Reduce line spacing in Quill editor */
.ql-editor p,
.ql-editor ol,
.ql-editor ul,
.ql-editor pre,
.ql-editor blockquote,
.ql-editor h1,
.ql-editor h2,
.ql-editor h3 {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.ql-editor p:first-child,
.ql-editor h1:first-child,
.ql-editor h2:first-child,
.ql-editor h3:first-child {
    margin-top: 0;
}

.ql-editor p:last-child,
.ql-editor h1:last-child,
.ql-editor h2:last-child,
.ql-editor h3:last-child {
    margin-bottom: 0;
}

/* Editor toggle buttons */
.editor-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.editor-toggle button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.editor-toggle button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.editor-toggle button:hover:not(.active) {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

#htmlSourceEditor {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    min-height: 300px;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.d-flex {
    display: flex;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #2563eb;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--text-primary);
    border-width: 3px;
}

/* Badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-warning {
    background: var(--warning-color);
    color: white;
}

.badge-info {
    background: var(--primary-color);
    color: white;
}

/* ============================================
   MOBILE APP-LIKE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Safe area for mobile devices */
    body {
        padding-bottom: env(safe-area-inset-bottom);
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Bottom Navigation Bar (Mobile App Style) */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        padding: 0.5rem 0;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        justify-content: space-around;
        align-items: center;
    }
    
    .mobile-bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        padding: 0.5rem;
        text-decoration: none;
        color: var(--text-secondary);
        transition: all 0.2s;
        min-height: 60px;
        position: relative;
    }
    
    .mobile-bottom-nav-item i {
        font-size: 1.75rem;
        margin-bottom: 0;
        transition: all 0.2s;
    }
    
    .mobile-bottom-nav-item span {
        display: none;
    }
    
    .mobile-bottom-nav-item.active {
        color: var(--primary-color);
    }
    
    .mobile-bottom-nav-item.active i {
        transform: scale(1.1);
    }
    
    .mobile-bottom-nav-item:active {
        transform: scale(0.95);
        background: var(--bg-secondary);
        border-radius: var(--border-radius);
    }
    
    /* Content padding for bottom nav */
    .content-area {
        padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
    }
    
    /* Touch-friendly buttons */
    .btn, button, a.btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    .btn-sm {
        min-height: 40px;
        min-width: 40px;
        padding: 0.5rem 1rem;
    }
    
    /* Card improvements for mobile */
    .card {
        border-radius: 12px;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .card-header {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Notes grid mobile */
    .notes-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .note-card {
        border-radius: 12px;
        padding: 1rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .note-actions {
        opacity: 0 !important;
        display: flex;
        gap: 0.5rem;
        pointer-events: none;
    }
    
    .note-card.active .note-actions {
        opacity: 1 !important;
        pointer-events: auto;
    }
    
    /* Pinboard mobile - also full width */
    #pinsGrid {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    #pinsGrid .pin-card {
        width: 100%;
    }
    
    /* File list mobile - Table view (Windows List style) */
    .file-list {
        display: table;
        width: 100%;
        border-collapse: collapse;
        margin-top: 0.5rem;
    }
    
    /* Mobile: Always use list view - Windows Explorer style */
    .file-list {
        display: block !important;
        grid-template-columns: none !important;
    }
    
    .file-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        padding: 0.5rem 1rem !important;
        margin-bottom: 0.25rem !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 4px !important;
        gap: 0.75rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .file-item:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }
    
    .file-item:hover {
        background: var(--bg-secondary);
    }
    
    .file-item .file-link {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex: 1 !important;
        min-width: 0 !important;
        gap: 0.75rem !important;
        text-decoration: none !important;
    }
    
    .file-item .file-icon {
        font-size: 1.25rem !important;
        margin-bottom: 0 !important;
        flex-shrink: 0 !important;
        width: 1.5rem !important;
        text-align: center !important;
        line-height: 1 !important;
    }
    
    .file-item .file-name {
        flex: 1 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        margin-bottom: 0 !important;
        font-size: 0.9rem !important;
        font-weight: normal !important;
        color: var(--text-primary) !important;
        padding: 0 !important;
    }
    
    .file-item .file-name a {
        display: block;
        color: var(--text-primary);
        text-decoration: none;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .file-item .file-meta {
        display: flex !important;
        flex-direction: row !important;
        gap: 1rem !important;
        margin-top: 0 !important;
        margin-left: auto !important;
        font-size: 0.85rem !important;
        color: var(--text-secondary) !important;
        flex-shrink: 0 !important;
        margin-right: 1rem !important;
    }
    
    .file-item .file-actions {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.25rem !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 1 !important;
        position: static !important;
        background: transparent !important;
        backdrop-filter: none !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        align-items: center !important;
    }
    
    .file-item .file-actions a,
    .file-item .file-actions button {
        padding: 0.25rem 0.4rem;
        min-width: 28px;
        font-size: 0.75rem;
    }
    
    .file-item.folder .file-icon {
        color: #fbbf24;
    }
    
    /* Form improvements */
    .form-control, .form-select {
        min-height: 48px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.875rem 1rem;
        border-radius: 8px;
    }
    
    /* Modal mobile */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        padding: 1.5rem;
        margin: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    /* Navbar mobile */
    .navbar {
        padding: 0.875rem 1rem;
        position: sticky;
        top: 0;
        z-index: 100;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
    }
    
    /* Sidebar mobile improvements */
    .sidebar {
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-menu a {
        padding: 1rem 1.5rem;
        min-height: 48px;
        font-size: 1rem;
    }
    
    /* Table mobile - make scrollable */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    /* Swipe gestures hint */
    .swipe-hint {
        display: block;
        text-align: center;
        color: var(--text-secondary);
        font-size: 0.875rem;
        padding: 0.5rem;
        margin-top: 0.5rem;
    }
    
    /* Pull to refresh area */
    .pull-refresh {
        text-align: center;
        padding: 1rem;
        color: var(--text-secondary);
        font-size: 0.875rem;
    }
    
    /* Better spacing */
    .content-area > * {
        margin-bottom: 1rem;
    }
    
    /* Touch feedback */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    }
    
    /* Improved scrollbars */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 4px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-secondary);
    }
}

/* Desktop: Hide bottom nav */
@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none;
    }
    
    .content-area {
        padding-bottom: 2rem !important;
    }
}

