/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Fixed navbar padding compensation */
body {
    padding-top: 56px;
}

/* Custom Dark Mode Styles */
[data-bs-theme="dark"] {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #ffffff;
    --bs-emphasis-color: #ffffff;
    --bs-secondary-color: rgba(255, 255, 255, 0.75);
    --bs-tertiary-color: rgba(255, 255, 255, 0.5);
    --bs-border-color: #404040;
    --bs-secondary-bg: #2d2d2d;
    --bs-tertiary-bg: #404040;
}

[data-bs-theme="dark"] .bg-light {
    background-color: #2d2d2d !important;
}

[data-bs-theme="dark"] .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* External Link Styles */
.external-link {
    color: #e65100;
    text-decoration: none;
    border-bottom: 1px dotted #e65100;
    font-weight: 500;
}

.external-link:hover {
    color: #f57c00;
    border-bottom-color: #f57c00;
    text-decoration: none;
}

.external-link::after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.7;
    margin-left: 2px;
}

/* Wiki Link Styles */
.wiki-link {
    color: #1976d2;
    text-decoration: none;
    border-bottom: 1px solid rgba(25, 118, 210, 0.3);
    font-weight: 500;
}

.wiki-link:hover {
    color: #0d47a1;
    border-bottom-color: #0d47a1;
    text-decoration: none;
}

.wiki-link-missing {
    color: #d32f2f;
    border-bottom: 1px dashed #d32f2f;
    cursor: help;
}

/* Dark mode adjustments for links */
[data-bs-theme="dark"] .external-link {
    color: #ff9800;
    border-bottom-color: #ff9800;
}

[data-bs-theme="dark"] .external-link:hover {
    color: #ffb74d;
    border-bottom-color: #ffb74d;
}

[data-bs-theme="dark"] .wiki-link {
    color: #64b5f6;
    border-bottom-color: rgba(100, 181, 246, 0.3);
}

[data-bs-theme="dark"] .wiki-link:hover {
    color: #90caf9;
    border-bottom-color: #90caf9;
}

[data-bs-theme="dark"] .wiki-link-missing {
    color: #f48fb1;
    border-bottom-color: #f48fb1;
}

[data-bs-theme="dark"] .card {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .dropdown-item {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-emphasis-color);
}

[data-bs-theme="dark"] .alert-success {
    background-color: #0f4229;
    border-color: #0a3622;
    color: #75dd99;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: #4b1113;
    border-color: #3c0d0f;
    color: #ea9ca0;
}

/* Smooth theme transition */
body {
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

.card,
.dropdown-menu,
.alert {
    transition:
        background-color 0.3s ease,
        border-color 0.3s ease,
        color 0.3s ease;
}

/* Theme toggle button in dropdown */
.dropdown-menu .btn.dropdown-item {
    padding: 0.375rem 1rem;
    display: flex;
    align-items: center;
}

.dropdown-menu .btn.dropdown-item:hover,
.dropdown-menu .btn.dropdown-item:focus {
    background-color: var(--bs-dropdown-link-hover-bg);
    color: var(--bs-dropdown-link-hover-color);
}

.dropdown-menu .btn.dropdown-item:focus {
    outline: none;
    box-shadow: none;
}

/* Quill.js Dark Mode Styles */
[data-bs-theme="dark"] .ql-toolbar {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .ql-container {
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .ql-editor {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .ql-toolbar .ql-stroke {
    stroke: #ffffff;
}

[data-bs-theme="dark"] .ql-toolbar .ql-fill {
    fill: #ffffff;
}

[data-bs-theme="dark"] .ql-toolbar .ql-picker-label {
    color: #ffffff;
}

[data-bs-theme="dark"] .ql-toolbar .ql-picker-options {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .ql-toolbar .ql-picker-item {
    color: #ffffff;
}

[data-bs-theme="dark"] .ql-toolbar .ql-picker-item:hover {
    background-color: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .ql-toolbar button:hover,
[data-bs-theme="dark"] .ql-toolbar button.ql-active {
    background-color: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .ql-toolbar button:hover .ql-stroke,
[data-bs-theme="dark"] .ql-toolbar button.ql-active .ql-stroke {
    stroke: #ffffff;
}

[data-bs-theme="dark"] .ql-toolbar button:hover .ql-fill,
[data-bs-theme="dark"] .ql-toolbar button.ql-active .ql-fill {
    fill: #ffffff;
}

/* Search highlighting */
mark {
    background-color: #fff3cd;
    color: #856404;
    padding: 0.1em 0.2em;
    border-radius: 0.25rem;
}

[data-bs-theme="dark"] mark {
    background-color: #664d03;
    color: #fff3cd;
}

/* Note content image styling */
.note-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0.5rem 0;
    display: block;
}

/* Uploaded images in Quill editor */
.ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0.5rem 0;
}

[data-bs-theme="dark"] .note-content img,
[data-bs-theme="dark"] .ql-editor img {
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

/* Auto-save status indicator */
.auto-save-status {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.auto-save-status.saving {
    color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
}

.auto-save-status.saved {
    color: #198754;
    background-color: rgba(25, 135, 84, 0.1);
}

.auto-save-status.error {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

[data-bs-theme="dark"] .auto-save-status.saving {
    color: #6ea8fe;
    background-color: rgba(110, 168, 254, 0.2);
}

[data-bs-theme="dark"] .auto-save-status.saved {
    color: #75dd99;
    background-color: rgba(117, 221, 153, 0.2);
}

[data-bs-theme="dark"] .auto-save-status.error {
    color: #ea9ca0;
    background-color: rgba(234, 156, 160, 0.2);
}

/* Wiki-style links */
.wiki-link {
    color: #0d6efd;
    text-decoration: none;
    background-color: rgba(13, 110, 253, 0.1);
    padding: 0.1em 0.3em;
    border-radius: 0.25rem;
    border: 1px solid rgba(13, 110, 253, 0.2);
    transition: all 0.2s ease;
}

.wiki-link:hover {
    color: #0a58ca;
    background-color: rgba(13, 110, 253, 0.15);
    border-color: rgba(13, 110, 253, 0.3);
    text-decoration: none;
}

.wiki-link-missing {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    padding: 0.1em 0.3em;
    border-radius: 0.25rem;
    border: 1px dashed rgba(220, 53, 69, 0.3);
    cursor: help;
}

[data-bs-theme="dark"] .wiki-link {
    color: #6ea8fe;
    background-color: rgba(110, 168, 254, 0.15);
    border-color: rgba(110, 168, 254, 0.3);
}

[data-bs-theme="dark"] .wiki-link:hover {
    color: #9ec5fe;
    background-color: rgba(110, 168, 254, 0.25);
    border-color: rgba(110, 168, 254, 0.4);
}

[data-bs-theme="dark"] .wiki-link-missing {
    color: #ea9ca0;
    background-color: rgba(234, 156, 160, 0.15);
    border-color: rgba(234, 156, 160, 0.3);
}

/* Wiki-link autocomplete dropdown */
.wiki-autocomplete {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    max-width: 300px;
    max-height: 200px;
    overflow-y: auto;
}

.wiki-autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.15s ease;
}

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

.wiki-autocomplete-item:hover {
    background-color: #f8f9fa;
}

[data-bs-theme="dark"] .wiki-autocomplete {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .wiki-autocomplete-item {
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .wiki-autocomplete-item:hover {
    background-color: var(--bs-tertiary-bg);
}

/* Media resize controls (for both images and videos) */
.media-resize-controls {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
}

.media-resize-btn {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    color: #495057;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.15s ease;
}

.media-resize-btn:hover {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

[data-bs-theme="dark"] .media-resize-controls {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .media-resize-btn {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .media-resize-btn:hover {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

/* Legacy class names for backward compatibility */
.image-resize-controls {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
}

.image-resize-btn {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    color: #495057;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    transition: all 0.15s ease;
}

.image-resize-btn:hover {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

[data-bs-theme="dark"] .image-resize-controls {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .image-resize-btn {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .image-resize-btn:hover {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

/* Image size classes */
.ql-editor img.img-small,
.note-content img.img-small {
    max-width: 25% !important;
    width: 25% !important;
    height: auto !important;
}

.ql-editor img.img-medium,
.note-content img.img-medium {
    max-width: 50% !important;
    width: 50% !important;
    height: auto !important;
}

.ql-editor img.img-large,
.note-content img.img-large {
    max-width: 75% !important;
    width: 75% !important;
    height: auto !important;
}

.ql-editor img.img-full,
.note-content img.img-full {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
}

/* Add cursor pointer to images in editor to indicate they're clickable */
.ql-editor img {
    cursor: pointer;
}

/* Add subtle hover effect to images in editor */
.ql-editor img:hover {
    opacity: 0.9;
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Quill list styling - handle data-list attributes properly in note display */
.note-content ol[data-list="bullet"] {
    list-style-type: disc;
}

.note-content ol[data-list="ordered"] {
    list-style-type: decimal;
}

.note-content li[data-list="bullet"] {
    list-style-type: disc;
}

.note-content li[data-list="ordered"] {
    list-style-type: decimal;
}

/* Custom checkbox button in Quill toolbar */
.ql-toolbar button.ql-checkbox {
    width: 28px !important;
    height: 28px !important;
}

.ql-toolbar button.ql-checkbox::before {
    content: "☐";
    font-size: 16px;
    line-height: 1;
    display: inline-block;
    width: 100%;
    text-align: center;
}

.ql-toolbar button.ql-checkbox:hover::before,
.ql-toolbar button.ql-checkbox.ql-active::before {
    content: "☑";
}

/* Checkbox styling in editor and note content */
.note-checkbox {
    cursor: pointer !important;
    margin: 0 0.5rem 0 0 !important;
    transform: scale(1.2) !important;
    vertical-align: middle !important;
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    height: auto !important;
    position: relative !important;
}

.ql-editor .note-checkbox {
    cursor: pointer !important;
    margin: 0 0.5rem 0 0 !important;
    transform: scale(1.2) !important;
    vertical-align: middle !important;
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    height: auto !important;
    position: relative !important;
}

.note-content .note-checkbox {
    cursor: pointer !important;
    margin: 0 0.5rem 0 0 !important;
    transform: scale(1.2) !important;
    vertical-align: middle !important;
    display: inline-block !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    height: auto !important;
    position: relative !important;
}

/* Dark mode checkbox styling */
[data-bs-theme="dark"] .ql-toolbar button.ql-checkbox::before {
    color: #ffffff;
}

/* Tag badges - improve contrast in dark mode */
.badge.bg-light.text-dark {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    border: 1px solid #dee2e6;
}

[data-bs-theme="dark"] .badge.bg-light.text-dark {
    background-color: #495057 !important;
    color: #f8f9fa !important;
    border: 1px solid #6c757d;
}

/* General tag badge styling for better visibility */
.badge.tag-badge {
    background-color: #e9ecef !important;
    color: #495057 !important;
    border: 1px solid #ced4da;
    font-weight: 500;
}

[data-bs-theme="dark"] .badge.tag-badge {
    background-color: #495057 !important;
    color: #e9ecef !important;
    border: 1px solid #6c757d;
}

/* YouTube button in Quill toolbar */
.ql-toolbar .ql-youtube {
    width: 28px !important;
    height: 28px !important;
}

.ql-toolbar .ql-youtube::before {
    content: "▶";
    font-size: 16px;
    line-height: 1;
    display: inline-block;
    width: 100%;
    text-align: center;
    color: #dc3545;
    font-weight: bold;
}

[data-bs-theme="dark"] .ql-toolbar .ql-youtube::before {
    color: #ff6b6b;
}

.ql-toolbar .ql-youtube:hover::before {
    color: #b02a37;
}

[data-bs-theme="dark"] .ql-toolbar .ql-youtube:hover::before {
    color: #ff5252;
}

/* YouTube video styling in editor and content */
.ql-editor iframe.youtube-video,
.ql-editor iframe.ql-video,
.note-content iframe.youtube-video,
.note-content iframe.ql-video {
    max-width: 100% !important;
    width: 100% !important;
    height: 315px !important;
    aspect-ratio: 16 / 9 !important;
    border-radius: 0.375rem;
    border: none;
    margin: 0.5rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: block !important;
}

/* Only show pointer cursor on YouTube videos in editor, not in show view */
.ql-editor iframe.youtube-video {
    cursor: pointer;
}

/* Ensure iframes are visible */
.ql-editor iframe {
    max-width: 100%;
    width: 100%;
    min-height: 315px;
    height: auto;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Override any Quill styling that might hide iframes */
.ql-editor .ql-video {
    display: block !important;
}

.ql-editor iframe[src*="youtube.com"] {
    min-height: 315px !important;
    height: 315px !important;
    display: block !important;
}

[data-bs-theme="dark"] .ql-editor iframe.youtube-video,
[data-bs-theme="dark"] .ql-editor iframe.ql-video,
[data-bs-theme="dark"] .note-content iframe.youtube-video,
[data-bs-theme="dark"] .note-content iframe.ql-video {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Add hover effect to YouTube videos in editor via wrapper */
.ql-editor .video-wrapper:hover iframe.youtube-video,
.ql-editor .video-wrapper:hover iframe.ql-video {
    opacity: 0.9;
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Fallback for videos without wrapper */
.ql-editor iframe.youtube-video:hover,
.ql-editor iframe.ql-video:hover {
    opacity: 0.9;
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Video wrapper for click overlay */
.ql-editor .video-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 100%;
}

/* Video click overlay */
.video-click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    cursor: pointer;
    z-index: 1;
    transition: background-color 0.2s ease;
}

.video-click-overlay:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

/* YouTube embed container size classes */
.ql-editor .youtube-embed.video-small,
.note-content .youtube-embed.video-small {
    max-width: 25% !important;
    width: 25% !important;
}

.ql-editor .youtube-embed.video-medium,
.note-content .youtube-embed.video-medium {
    max-width: 50% !important;
    width: 50% !important;
}

.ql-editor .youtube-embed.video-large,
.note-content .youtube-embed.video-large {
    max-width: 75% !important;
    width: 75% !important;
}

.ql-editor .youtube-embed.video-full,
.note-content .youtube-embed.video-full {
    max-width: 100% !important;
    width: 100% !important;
}

/* Remove any cursor pointer from the entire note content */
.note-content {
    cursor: default;
}

/* YouTube embeds should not make everything clickable */
.youtube-embed {
    cursor: default;
}

/* Only the unloaded placeholder should have pointer cursor */
.youtube-embed:not(.loaded) {
    cursor: pointer;
}

/* Ensure YouTube embed containers maintain aspect ratio */
.ql-editor .youtube-embed,
.note-content .youtube-embed {
    height: 315px !important;
    max-width: 100%;
    margin: 0.5rem 0;
}

/* Loaded YouTube embeds should have clean styling */
.ql-editor .youtube-embed.loaded,
.note-content .youtube-embed.loaded {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    display: block !important;
    align-items: unset !important;
    justify-content: unset !important;
}

/* Legacy video size classes for backward compatibility */
.ql-editor iframe.video-small,
.note-content iframe.video-small {
    max-width: 25% !important;
    width: 25% !important;
    aspect-ratio: 16 / 9 !important;
}

.ql-editor iframe.video-medium,
.note-content iframe.video-medium {
    max-width: 50% !important;
    width: 50% !important;
    aspect-ratio: 16 / 9 !important;
}

.ql-editor iframe.video-large,
.note-content iframe.video-large {
    max-width: 75% !important;
    width: 75% !important;
    aspect-ratio: 16 / 9 !important;
}

.ql-editor iframe.video-full,
.note-content iframe.video-full {
    max-width: 100% !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
}

/* Make wrapper match the iframe size */
.ql-editor .video-wrapper {
    max-width: inherit;
    width: inherit;
}


/* Multi-tag filter styling */
.tag-filter-row {
    min-height: 38px;
}

.tag-filter-row .form-select {
    transition:
        border-color 0.15s ease-in-out,
        box-shadow 0.15s ease-in-out;
}

.tag-filter-row .remove-filter {
    min-width: 38px;
    transition: all 0.15s ease-in-out;
}

.tag-filter-row .remove-filter:hover {
    transform: scale(1.05);
}

/* Dark mode support for filter cards */
[data-bs-theme="dark"] .card.border-light {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color) !important;
}

[data-bs-theme="dark"] .card-header.bg-light {
    background-color: var(--bs-tertiary-bg) !important;
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

/* File attachment styling */
.attachment-item {
    transition: all 0.2s ease;
    background-color: rgba(13, 110, 253, 0.02);
    border-color: rgba(13, 110, 253, 0.1) !important;
}

.attachment-item:hover {
    background-color: rgba(13, 110, 253, 0.05);
    border-color: rgba(13, 110, 253, 0.2) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .attachment-item {
    background-color: rgba(110, 168, 254, 0.08);
    border-color: rgba(110, 168, 254, 0.2) !important;
}

[data-bs-theme="dark"] .attachment-item:hover {
    background-color: rgba(110, 168, 254, 0.15);
    border-color: rgba(110, 168, 254, 0.3) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Attachment button in Quill toolbar */
.ql-toolbar .ql-attachment {
    width: 28px !important;
    height: 28px !important;
}

.ql-toolbar .ql-attachment::before {
    content: "📎";
    font-size: 16px;
    line-height: 1;
    display: inline-block;
    width: 100%;
    text-align: center;
}

.ql-toolbar .ql-attachment:hover::before,
.ql-toolbar .ql-attachment.ql-active::before {
    opacity: 0.8;
}

/* File links in note content (inserted by attachment feature) */
.note-content a[href*="rails/active_storage"],
.ql-editor a[href*="rails/active_storage"] {
    color: #0d6efd;
    text-decoration: none;
    background-color: rgba(13, 110, 253, 0.08);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    border: 1px solid rgba(13, 110, 253, 0.15);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.note-content a[href*="rails/active_storage"]:hover,
.ql-editor a[href*="rails/active_storage"]:hover {
    background-color: rgba(13, 110, 253, 0.12);
    border-color: rgba(13, 110, 253, 0.25);
    transform: translateY(-1px);
    text-decoration: none;
}

[data-bs-theme="dark"] .note-content a[href*="rails/active_storage"],
[data-bs-theme="dark"] .ql-editor a[href*="rails/active_storage"] {
    color: #6ea8fe;
    background-color: rgba(110, 168, 254, 0.12);
    border-color: rgba(110, 168, 254, 0.2);
}

[data-bs-theme="dark"] .note-content a[href*="rails/active_storage"]:hover,
[data-bs-theme="dark"] .ql-editor a[href*="rails/active_storage"]:hover {
    background-color: rgba(110, 168, 254, 0.18);
    border-color: rgba(110, 168, 254, 0.3);
}

/* Quill text alignment classes for both editor and note content display */
.ql-align-center,
.ql-editor .ql-align-center,
.note-content .ql-align-center {
    text-align: center !important;
}

.ql-align-right,
.ql-editor .ql-align-right,
.note-content .ql-align-right {
    text-align: right !important;
}

.ql-align-justify,
.ql-editor .ql-align-justify,
.note-content .ql-align-justify {
    text-align: justify !important;
}

/* Default left alignment (no class needed, but included for completeness) */
.ql-align-left,
.ql-editor .ql-align-left,
.note-content .ql-align-left {
    text-align: left !important;
}

/* Mastodon invisible class - hide without taking up space */
.mastodon-content .invisible {
    display: none !important;
}

/* Mastodon custom emoji styling */
.mastodon-emoji {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
    display: inline-block;
    margin: 0 0.1em;
}

/* Slightly larger emojis in display names */
.card-title .mastodon-emoji {
    height: 1.3em;
}

/* Ensure emojis don't break line height */
.mastodon-content .mastodon-emoji {
    max-height: 1.5em;
}

/* Mastodon video and GIFV styling */
.mastodon-video,
.mastodon-gifv {
    background-color: #000;
    max-width: 100%;
    max-height: 80vh; /* Limit height to 80% of viewport */
    display: block;
}

.mastodon-gifv {
    cursor: pointer;
    position: relative;
}

/* Add a subtle indicator for GIFVs that they can be clicked to unmute */
.mastodon-gifv::after {
    content: '🔇';
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mastodon-gifv:hover::after {
    opacity: 1;
}

.mastodon-gifv.unmuted::after {
    content: '🔊';
}

/* Audio player styling */
.mastodon-audio {
    border-radius: 0.375rem;
    background-color: #f8f9fa;
}

[data-bs-theme="dark"] .mastodon-audio {
    background-color: var(--bs-secondary-bg);
}

/* Video controls styling for better visibility */
.mastodon-video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Ensure videos maintain aspect ratio */
.mastodon-video,
.mastodon-gifv {
    object-fit: contain;
}

/* Limit image height to fit viewport */
.mastodon-content + div .img-fluid {
    max-height: 80vh; /* Limit height to 80% of viewport */
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Mastodon notification toast styling */
.mastodon-notification-toast {
    min-width: 300px;
    max-width: 400px;
}

.mastodon-notification-toast .toast-header img {
    object-fit: cover;
}

.mastodon-notification-toast .toast-body {
    max-height: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Notification badge on bell icon */
.btn .badge {
    font-size: 0.65rem;
    padding: 0.25em 0.4em;
}

/* Mastodon notifications dropdown */
.mastodon-notifications-dropdown {
    min-width: 350px;
    max-width: 400px;
    z-index: 1050;
}

.mastodon-notifications-dropdown .notification-item {
    cursor: default;
    white-space: normal;
}

.mastodon-notifications-dropdown .notification-item:hover {
    background-color: var(--bs-dropdown-link-hover-bg);
}

.mastodon-notifications-dropdown .notification-items {
    min-height: 60px;
}

[data-bs-theme="dark"] .mastodon-notifications-dropdown {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .mastodon-notifications-dropdown .dropdown-item:hover {
    background-color: var(--bs-tertiary-bg);
}

/* Ensure dropdown button is above sticky notifications */
.dropdown .btn {
    z-index: 1050;
    position: relative;
}

/* Mastodon link preview cards */
.link-preview-card {
    transition: all 0.2s ease;
    border-color: rgba(0, 0, 0, 0.125) !important;
    overflow: hidden;
}

.link-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(13, 110, 253, 0.3) !important;
}

.link-preview-card .card-body {
    background-color: #f8f9fa;
}

.link-preview-card .card-title {
    color: #212529;
    font-weight: 600;
}

.link-preview-card .card-text {
    color: #6c757d;
}

/* Dark mode link preview cards */
[data-bs-theme="dark"] .link-preview-card {
    border-color: var(--bs-border-color) !important;
}

[data-bs-theme="dark"] .link-preview-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-color: rgba(110, 168, 254, 0.4) !important;
}

[data-bs-theme="dark"] .link-preview-card .card-body {
    background-color: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .link-preview-card .card-title {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .link-preview-card .card-text {
    color: var(--bs-secondary-color);
}

/* Mastodon stream virtual window - use CSS overflow-anchor for smooth scroll preservation */
body {
    overflow-anchor: auto;
}

#posts-container {
    overflow-anchor: auto;
}

/* Ensure posts act as anchors */
[data-post-id] {
    overflow-anchor: auto;
}

/* Mastodon Poll Styling */
.poll-container {
    background-color: #f8f9fa;
    transition: all 0.2s ease;
}

[data-bs-theme="dark"] .poll-container {
    background-color: var(--bs-secondary-bg);
}

.poll-option {
    margin-bottom: 0.75rem;
}

.poll-option:last-child {
    margin-bottom: 0;
}

/* Poll voting state - interactive options */
.poll-option-votable {
    transition: all 0.15s ease;
    border-color: #dee2e6 !important;
}

.poll-option-votable:hover {
    background-color: #e9ecef !important;
    border-color: #0d6efd !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .poll-option-votable {
    background-color: var(--bs-tertiary-bg) !important;
    border-color: var(--bs-border-color) !important;
}

[data-bs-theme="dark"] .poll-option-votable:hover {
    background-color: var(--bs-secondary-bg) !important;
    border-color: #6ea8fe !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Poll results state */
.poll-result {
    position: relative;
}

.poll-result .progress {
    background-color: #e9ecef;
}

[data-bs-theme="dark"] .poll-result .progress {
    background-color: var(--bs-tertiary-bg);
}

/* User's voted option highlight */
.poll-option-voted .progress-bar {
    background-color: #198754 !important;
}

/* Poll form controls styling */
.poll-option .form-check-input {
    cursor: pointer;
    margin-top: 0.25em;
}

.poll-option .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .poll-option .form-check-input:checked {
    background-color: #6ea8fe;
    border-color: #6ea8fe;
}

/* Poll header icon */
.poll-container .bi-bar-chart-fill {
    font-size: 1.1em;
}

/* Poll stats and footer */
.poll-container .text-muted {
    font-size: 0.875rem;
}

/* Poll button styling */
.poll-container .btn {
    transition: all 0.15s ease;
}

/* Mastodon Replies Styling */
.replies-thread {
    border-top: 1px solid #dee2e6;
    padding-top: 0.75rem;
}

[data-bs-theme="dark"] .replies-thread {
    border-top-color: var(--bs-border-color);
}

.reply-item {
    border-left-color: #0d6efd !important;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
}

[data-bs-theme="dark"] .reply-item {
    border-left-color: #6ea8fe !important;
}

.reply-post {
    padding: 0.5rem 0;
}

/* Smooth icon rotation for expand/collapse */
[data-mastodon-replies-target="icon"] {
    transition: transform 0.2s ease;
    display: inline-block;
}

/* Nested reply depth styling */
.reply-item .reply-item {
    margin-left: 0.25rem;
    border-left-width: 1px;
}

.reply-item .reply-item .reply-item {
    border-left-color: #6c757d !important;
}

[data-bs-theme="dark"] .reply-item .reply-item .reply-item {
    border-left-color: #adb5bd !important;
}

/* Compact mastodon content in replies */
.reply-post .mastodon-content {
    line-height: 1.4;
}

/* Replies container transition */
[data-mastodon-replies-target="container"] {
    transition: opacity 0.2s ease;
}

/* Loading state for replies */
[data-mastodon-replies-target="container"] .spinner-border {
    vertical-align: middle;
}

/* Feed item seen state - visual indicator for already-read items */
.feed-item-seen {
    background-color: rgba(108, 117, 125, 0.05) !important;
    border-color: rgba(108, 117, 125, 0.15) !important;
    opacity: 0.7;
}

.feed-item-seen .card-title a {
    color: #6c757d !important;
}

[data-bs-theme="dark"] .feed-item-seen {
    background-color: rgba(108, 117, 125, 0.15) !important;
    border-color: rgba(108, 117, 125, 0.25) !important;
    opacity: 0.6;
}

[data-bs-theme="dark"] .feed-item-seen .card-title a {
    color: #adb5bd !important;
}
