/* Bookmarks Page Styles */

/* Modal Overlay and Base Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: auto;
}

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

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.warning-text {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Form Styles for Modals */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-dark);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-outline {
    background: transparent;
    color: var(--text-dark);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-secondary);
}

.btn-danger {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.bookmarks-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.bookmarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.bookmarks-title h1 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--text-dark);
}

.bookmarks-title p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Layout */
.bookmarks-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
}

/* Mobile Toggle Button (hidden on desktop) */
.mobile-sidebar-toggle {
    display: none;
}

@media (max-width: 900px) {
    .bookmarks-container {
        padding: 1rem;
        overflow-x: hidden;
    }

    .bookmarks-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .bookmarks-title h1 {
        font-size: 1.5rem;
    }

    .bookmarks-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Mobile sidebar toggle button */
    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        background: var(--bg-secondary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        font-size: 0.9rem;
        color: var(--text-dark);
        margin-bottom: 1rem;
        width: 100%;
        justify-content: center;
    }

    .mobile-sidebar-toggle:hover {
        background: var(--primary-light);
    }

    .mobile-sidebar-toggle .toggle-icon {
        transition: transform 0.2s;
    }

    .mobile-sidebar-toggle.open .toggle-icon {
        transform: rotate(180deg);
    }

    /* Sidebar as collapsible section on mobile */
    .bookmarks-sidebar {
        position: static;
        display: none;
        background: var(--bg-secondary);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .bookmarks-sidebar.mobile-open {
        display: block;
    }

    /* Bookmark cards - prevent horizontal overflow */
    .bookmarks-main {
        min-width: 0;
        overflow-x: hidden;
    }

    .bookmark-card {
        max-width: 100%;
        overflow: hidden;
    }

    .bookmark-title {
        word-break: break-word;
    }

    .bookmark-url {
        word-break: break-all;
        font-size: 0.75rem;
    }

    /* Toolbar adjustments */
    .toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .search-input {
        min-width: 0;
        flex: 1;
    }

    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .bookmarks-container {
        padding: 0.75rem;
    }

    .bookmarks-header {
        margin-bottom: 1rem;
    }

    .bookmarks-title h1 {
        font-size: 1.25rem;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
    }

    /* Stack toolbar items vertically */
    .toolbar {
        flex-direction: column;
    }

    .toolbar-right {
        flex-wrap: wrap;
    }

    .sort-select {
        flex: 1;
        min-width: 120px;
    }

    /* Smaller bookmark cards */
    .bookmark-card-body {
        padding: 0.75rem;
    }

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

    .bookmark-actions {
        padding: 0.5rem 0.75rem;
    }

    /* Modal adjustments */
    .modal {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }

    .view-bookmark-modal {
        max-width: calc(100vw - 1rem);
    }

    .modal-footer {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }

    .modal-footer .btn-danger {
        flex: 0;
    }
}

/* Sidebar */
.bookmarks-sidebar {
    position: sticky;
    top: 1rem;
    height: fit-content;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
    padding: 0 0.5rem;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.5rem;
    margin-bottom: 0.75rem;
}

.sidebar-header h3 {
    margin: 0;
}

.sidebar-header .btn-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: none;
    background: var(--bg-secondary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .btn-icon:hover {
    background: var(--border-color);
}

/* Collection List */
.collection-list,
.type-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.collection-item,
.type-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.collection-item:hover,
.type-item:hover {
    background: var(--bg-secondary);
}

.collection-item.active,
.type-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
}

.collection-icon,
.type-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.collection-name,
.type-name {
    flex: 1;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collection-count,
.type-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
}

.collection-menu-btn {
    opacity: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.collection-item:hover .collection-menu-btn {
    opacity: 1;
}

/* Main Content */
.bookmarks-main {
    min-width: 0;
}

.bookmarks-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bookmarks-toolbar .search-box {
    flex: 1;
    min-width: 200px;
}

.bookmarks-toolbar .search-box input {
    width: 100%;
}

.bookmarks-toolbar .filter-group {
    display: flex;
    gap: 0.5rem;
}

/* Active Filter Indicator */
.active-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--primary-light);
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--primary-color);
}

.active-filter .btn-clear {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: 0.875rem;
}

/* Bookmarks Grid */
.bookmarks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* Bookmark Card */
.bookmark-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.15s, border-color 0.15s;
    position: relative;
}

.bookmark-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.bookmark-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.bookmark-checkbox {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
}

.bookmark-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.bookmark-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.75rem 0 2.5rem;
}

.bookmark-icon {
    font-size: 1.25rem;
}

.bookmark-menu {
    position: relative;
}

.bookmark-card .menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    color: var(--text-muted);
    border-radius: 4px;
}

.bookmark-card .menu-btn:hover {
    background: var(--bg-secondary);
}

.bookmark-card .menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 140px;
    z-index: 100;
    display: none;
}

.bookmark-card .menu-dropdown.open {
    display: block;
}

.bookmark-card .menu-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
}

.bookmark-card .menu-item:hover {
    background: var(--bg-secondary);
}

.bookmark-card .menu-item.danger {
    color: var(--error-color);
}

/* Card body - can be a div or anchor */
.bookmark-card-body {
    display: block;
    padding: 0.75rem 1rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

a.bookmark-card-body:hover {
    text-decoration: none;
}

a.bookmark-card-body:visited {
    color: inherit;
}

.bookmark-title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-subtitle {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-notes {
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.bookmark-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.bookmark-tags .tag {
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 4px;
}

.bookmark-date {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-light);
}

.bookmark-card-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* Selection Action Bar */
.selection-action-bar {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: bottom 0.3s ease;
    z-index: 1000;
}

.selection-action-bar.visible {
    bottom: 2rem;
}

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

.select-all-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.selection-bar-actions {
    display: flex;
    gap: 0.5rem;
}

.selection-cancel {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    opacity: 0.7;
}

.selection-cancel:hover {
    opacity: 1;
}

/* Selection bar button overrides for dark background */
.selection-action-bar .btn-outline {
    background: #4b5563;
    border-color: #6b7280;
    color: white;
}

.selection-action-bar .btn-outline:hover {
    background: #6b7280;
    border-color: #9ca3af;
}

.selection-action-bar .btn-danger {
    background: var(--danger, #ef4444);
    border-color: var(--danger, #ef4444);
}

.selection-action-bar .btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* Checkbox styling in selection bar */
.selection-action-bar input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin: -1rem -1.5rem 1rem;
    padding: 0 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Add Bookmark Modal */
.add-bookmark-modal {
    max-width: 600px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
}

.help-text {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-left: 1.75rem;
}

/* Cairo Search Results */
.search-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 0.5rem;
}

.search-hint {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    margin: 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

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

.search-result-item:hover {
    background: var(--bg-secondary);
}

.result-icon {
    font-size: 1.25rem;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-title {
    display: block;
    font-weight: 500;
    color: var(--text-dark);
}

.result-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Icon/Color Pickers */
.icon-picker,
.color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.icon-option {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-option.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.color-option {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
}

.color-option.selected {
    border-color: var(--text-dark);
    box-shadow: 0 0 0 2px white inset;
}

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

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin: 0 0 0.5rem;
    color: var(--text-dark);
}

.empty-state p {
    margin: 0 0 1.5rem;
    color: var(--text-muted);
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1rem;
    background: var(--text-dark);
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    animation: slideIn 0.3s ease;
}

.toast.error {
    background: var(--error-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
}

.login-card h2 {
    margin: 0 0 0.5rem;
}

.login-card p {
    margin: 0 0 1.5rem;
    color: var(--text-muted);
}

/* View Bookmark Modal */
.view-bookmark-modal {
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.view-bookmark-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.view-url-section {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.view-url-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    word-break: break-all;
}

.view-url-link:hover {
    text-decoration: underline;
}

.view-url-icon {
    font-size: 0.8rem;
    opacity: 0.7;
}

.view-meta {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.view-tags-section {
    margin-bottom: 1rem;
}

.view-tags {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.view-tags .tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 4px;
}

.view-section {
    margin-bottom: 1.25rem;
}

.view-section h4 {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.view-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.view-section-header h4 {
    margin: 0;
}

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

.view-notes-text {
    margin: 0;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-dark);
    font-style: italic;
    line-height: 1.5;
}

.view-description-text {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-dark);
    line-height: 1.5;
}

.view-content {
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-dark);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.view-no-content {
    text-align: center;
    padding: 2rem 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.view-no-content p {
    margin: 0 0 1rem;
    color: var(--text-muted);
}

/* Inline Edit Styles for View Modal */
.view-title-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.view-title-display {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-dark);
}

.view-title-input {
    flex: 1;
    padding: 0.25rem 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
}

.inline-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.875rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.inline-edit-btn:hover {
    opacity: 1;
}

.inline-save-btn,
.inline-cancel-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}

.inline-save-btn {
    background: var(--primary-color);
    color: white;
}

.inline-cancel-btn {
    background: var(--bg-secondary);
    color: var(--text-dark);
}

.view-section-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.view-section-header-inline h4 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.view-section-header-inline .section-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.inline-edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.no-tags-hint,
.no-notes-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.hidden {
    display: none !important;
}

/* Standards Alignment Styles */
.view-standards-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.no-standards-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.linked-standard {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.linked-standard-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.linked-standard-notation {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary-color);
}

.linked-standard-desc {
    font-size: 0.8rem;
    color: var(--text-dark);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.linked-standard-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.25rem;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s, color 0.15s;
}

.linked-standard-remove:hover {
    opacity: 1;
    color: var(--error-color);
}

.standards-search-container {
    position: relative;
    margin-bottom: 0.5rem;
}

.standards-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.standards-result-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

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

.standards-result-item:hover {
    background: var(--bg-secondary);
}

.standards-result-notation {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary-color);
}

.standards-result-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Expandable Cards */
.bookmark-card.has-expandable .bookmark-card-header {
    justify-content: flex-start;
    gap: 0.5rem;
}

.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s, color 0.15s;
    margin-left: auto;
    margin-right: 0.5rem;
}

.expand-btn:hover {
    color: var(--text-dark);
}

.bookmark-card.expanded .expand-btn {
    transform: rotate(180deg);
}

.bookmark-expandable {
    display: none;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: #f9fafb;
}

.bookmark-card.expanded .bookmark-expandable {
    display: block;
}

.expandable-section {
    margin-bottom: 0.75rem;
}

.expandable-section:last-child {
    margin-bottom: 0;
}

.expandable-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.expandable-standards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.expandable-standard {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 4px;
    cursor: help;
}

.expandable-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.expandable-preview {
    font-size: 0.8rem;
    color: var(--text-dark);
    line-height: 1.5;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    max-height: 120px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Modern Custom Dropdown */
.custom-dropdown {
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-dark);
    transition: border-color 0.15s;
}

.dropdown-trigger:hover {
    border-color: var(--text-muted);
}

.dropdown-trigger:focus,
.custom-dropdown.open .dropdown-trigger {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.dropdown-trigger-text {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-trigger-text.placeholder {
    color: var(--text-muted);
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.custom-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-dark);
    transition: background 0.1s;
}

.dropdown-option:hover {
    background: var(--bg-secondary);
}

.dropdown-option.selected {
    background: var(--primary-light);
    color: var(--primary-color);
}

.dropdown-option.create-new {
    border-top: 1px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 500;
}

.dropdown-option.create-new:hover {
    background: var(--primary-light);
}

.dropdown-option-icon {
    font-size: 1rem;
}

/* Imported Content Fullscreen & Editable */
.view-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.view-content-header h4 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.view-content-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.content-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.content-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-dark);
}

.view-content-wrapper {
    position: relative;
}

.view-content-textarea {
    width: 100%;
    min-height: 200px;
    max-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-dark);
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.view-content-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.view-content-textarea::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Content footer with import button */
.view-content-footer {
    margin-top: 0.5rem;
    display: flex;
    justify-content: flex-start;
}

.view-content-footer .btn-icon {
    margin-right: 0.25rem;
}

/* Notes textarea in view modal */
.view-notes-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-dark);
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.view-notes-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Sharing Section */
.view-sharing-section {
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.sharing-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sharing-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.sharing-toggle input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.sharing-toggle input:checked + .toggle-slider {
    background: var(--primary-color);
}

.sharing-toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-dark);
}

.sharing-link-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.sharing-link-input {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.375rem 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* Slug editing in modals */
.slug-edit-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-label-inline {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.slug-input {
    flex: 1;
    font-family: monospace;
    font-size: 0.85rem;
    padding: 0.375rem 0.5rem;
}

.slug-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: none;
}

.content-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Fullscreen Content Modal */
.fullscreen-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
}

.fullscreen-modal-overlay.hidden {
    display: none;
}

.fullscreen-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.fullscreen-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.fullscreen-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-dark);
}

.fullscreen-modal-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.fullscreen-content {
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-dark);
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 100%;
}

.fullscreen-content-textarea {
    width: 100%;
    min-height: calc(90vh - 150px);
    padding: 1.5rem;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-dark);
    font-family: inherit;
    resize: none;
    box-sizing: border-box;
}

.fullscreen-content-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.fullscreen-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* =====================================================
   SPEED READ (RSVP) MODAL
   ===================================================== */

.speed-read-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.speed-read-overlay.hidden {
    display: none;
}

.speed-read-modal {
    background: #1a1a1a;
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.speed-read-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #333;
}

.speed-read-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #ccc;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.speed-read-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.speed-read-close:hover {
    color: #fff;
}

/* Word Display Area */
.speed-read-display {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    user-select: none;
}

/* Word container - fixed height box where the word displays */
.speed-read-word-container {
    position: relative;
    width: 100%;
    height: 100px;
}

/* Fixed center marker - vertical line with tick marks */
.speed-read-center-marker {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    transform: translateX(-50%);
    width: 2px;
    pointer-events: none;
    z-index: 1;
}

/* Top tick mark */
.speed-read-center-marker::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 0;
    width: 2px;
    height: 15px;
    background: var(--primary-color);
    opacity: 0.5;
}

/* Bottom tick mark */
.speed-read-center-marker::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 2px;
    height: 15px;
    background: var(--primary-color);
    opacity: 0.5;
}

/* Word area - absolutely positioned, vertically centered */
.speed-read-word-area {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    white-space: nowrap;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    z-index: 2;
    /* left position set dynamically by JS to align ORP at center */
}

/* Before part - flows right, text aligned right so it ends at ORP */
.speed-read-word-area .orp-before {
    color: #666;
    text-align: right;
    display: inline-block;
}

/* ORP letter - highlighted, this is the fixed point */
.speed-read-word-area .orp-letter {
    color: var(--primary-color);
    font-weight: 600;
    display: inline-block;
}

/* After part - flows left from ORP */
.speed-read-word-area .orp-after {
    color: #fff;
    display: inline-block;
}

/* Focus guides - subtle lines to center the eye */
.speed-read-focus-guides {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin-bottom: 0.5rem;
}

.speed-read-focus-guides::before,
.speed-read-focus-guides::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30px;
    height: 2px;
    background: #333;
}

.speed-read-focus-guides::before {
    left: 0;
}

.speed-read-focus-guides::after {
    right: 0;
}

/* Sentence Preview - fixed 3 lines, current word starts line 3 */
.speed-read-preview {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: #222;
    border-radius: 8px;
    max-width: 600px;
    text-align: center;
    width: 100%;
    height: 6em;
    overflow: hidden;
}

.speed-read-preview-text {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

.speed-read-preview-text .current-word {
    color: #888;
    font-weight: 500;
}

/* Controls Section */
.speed-read-controls {
    padding: 1.5rem;
    border-top: 1px solid #333;
    background: #151515;
    border-radius: 0 0 16px 16px;
}

/* Playback Controls */
.speed-read-playback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.speed-read-btn {
    background: #333;
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}

.speed-read-btn:hover {
    background: #444;
}

.speed-read-btn:active {
    transform: scale(0.95);
}

.speed-read-btn.play-pause {
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    font-size: 1.25rem;
}

.speed-read-btn.play-pause:hover {
    background: var(--primary-hover);
}

/* Speed Control */
.speed-read-speed-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.speed-read-speed-label {
    color: #888;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.speed-read-wpm {
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

.speed-read-slider {
    width: 200px;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
}

.speed-read-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.speed-read-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.speed-read-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Progress Slider */
.speed-read-progress {
    margin-bottom: 0.75rem;
}

.speed-read-progress-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 12px;
    background: #333;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}

.speed-read-progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}

.speed-read-progress-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.speed-read-progress-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.speed-read-progress-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: grab;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.speed-read-progress-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
}

.speed-read-progress-slider::-moz-range-track {
    height: 12px;
    background: #333;
    border-radius: 6px;
}

.speed-read-progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #666;
}

/* Settings Row */
.speed-read-settings {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #333;
}

.speed-read-setting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
}

.speed-read-setting input[type="checkbox"] {
    accent-color: var(--primary-color);
}

.speed-read-font-size {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.speed-read-font-size button {
    background: #333;
    border: none;
    color: #888;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.speed-read-font-size button:hover {
    background: #444;
    color: #fff;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .speed-read-modal {
        max-width: 100%;
        border-radius: 12px;
        margin: 0.5rem;
    }

    .speed-read-display {
        padding: 3rem 1rem;
    }

    .speed-read-word-area {
        font-size: 2rem;
    }

    .speed-read-controls {
        padding: 1rem;
    }

    .speed-read-speed-control {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .speed-read-slider {
        width: 100%;
        order: 3;
    }

    .speed-read-settings {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .speed-read-btn {
        width: 40px;
        height: 40px;
    }

    .speed-read-btn.play-pause {
        width: 50px;
        height: 50px;
    }
}

/* Speed Read Button on Cards */
.btn-speed-read {
    background: linear-gradient(135deg, #f0a030 0%, #f0a030 100%);
    color: white;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-speed-read:hover {
    background: linear-gradient(135deg, #f0a030 0%, #d08520 100%);
}

/* =====================================================
   COLLECTION SHARING SECTION
   ===================================================== */

.collection-share-section {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #fef3c7);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.collection-share-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.collection-share-link-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
}

.collection-share-link-group .sharing-link-input {
    flex: 1;
    background: white;
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .collection-share-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .collection-share-link-group {
        min-width: 0;
        width: 100%;
    }
}
