/* File: wwwroot/css/protaxiq.css */

/* Global Dark Theme Backgrounds and Text */
body.dark,
.dark { /* Apply this to the main container that gets the 'dark' class */
    background-color: #1A1A1D; /* Very dark, almost off-black */
    color: #E0E0E0; /* Soft light grey for general text */
}

    /* Assuming you have a navigation bar, adjust its dark theme styling */
    .dark .navbar {
        background-color: #121212; /* Even darker for the top bar to frame the logo */
        color: #E0E0E0;
    }

    /* Assuming you have a sidebar for the folders panel, adjust its dark theme styling */
    .dark .sidebar {
        background-color: #1F1F22; /* Slightly lighter than navbar, but still very dark */
        color: #E0E0E0;
    }

    .dark input {
        color: #E0E0E0; /* Ensure input text is legible */
        background-color: #2D2D30; /* Darker input background */
        border: 1px solid #4F4F55; /* Subtle border */
    }

/* Custom gutter styles for Split.js */
.gutter.gutter-horizontal {
    background-color: #e5e7eb;
    width:5px !important;
    cursor: ew-resize !important;
}

.dark .gutter.gutter-horizontal {
    background-color: #3C3C40; /* A distinct dark grey to separate panels */
    width: 5px !important;
}

#panel1, #panel2, #panel3 {
    min-width: 0;
}

.folder-header.active {
    background-color: #e0e0e0;
    border-radius: 0.25rem;
}

.dark .folder-header.active {
    background-color: #2D2D30; /* Use a slightly lighter dark grey for active folder background */
    border-left: 3px solid #00B5FF; /* Accent border on active folder */
    padding-left: calc(0.5rem - 3px); /* Adjust padding to account for border */
}

.folder-header.active .folder-name {
    font-weight: bold;
    color: #00B5FF; /* Make the active folder name the accent blue */
}

.subfolders {
    margin-left: 1.5rem;
}

.asset-item {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

    .asset-item:hover {
        background-color: #f0f0f0;
    }

.dark .asset-item:hover {
    background-color: #2D2D30; /* Subtle hover effect */
}

.asset-item.selected {
    background-color: #dbeafe; /* Tailwind blue-100 */
    font-weight: 500;
}

.dark .asset-item.selected {
    background-color: #00B5FF; /* Bright blue for selected items */
    color: #121212; /* Dark text on bright blue for contrast */
    font-weight: bold;
}

.folder-placeholder {
    background-color: #dbeafe;
    border: 1px dashed #60a5fa;
    height: 36px;
    margin: 4px 0;
    border-radius: 0.25rem;
}

.drop-target-hover {
    background-color: #93c5fd !important;
}

.dark .drop-target-hover {
    background-color: #008CFF !important; /* A slightly darker shade of the accent blue for strong visual cue */
    border: 1px dashed #00B5FF !important;
}

.modal-backdrop.hidden .modal-content {
    opacity: 0;
    transform: scale(0.95);
}

.modal-backdrop .modal-content {
    opacity: 1;
    transform: scale(1);
    transition-property: opacity, transform;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal specific dark styles */
.dark .modal-content {
    background-color: #2D2D30; /* Dark background for modal content */
    color: #E0E0E0;
}

.dark .modal-header {
    border-bottom-color: #3C3C40;
}

.dark .modal-footer {
    border-top-color: #3C3C40;
}


.star-rating .fa-star {
    color: #d1d5db;
    cursor: pointer;
    transition: color 150ms ease-in-out;
}

.dark .star-rating .fa-star {
    color: #555555; /* Muted dark grey for unselected stars */
}

.star-rating .fa-star:hover,
.star-rating .fa-star.hovered {
    color: #f59e0b; /* Keep existing orange for selected/hovered stars if desired */
}

.star-rating .fa-star.selected {
    color: #f59e0b;
}

.context-menu-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: #1f2937;
    text-decoration: none;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.dark .context-menu-item {
    color: #E0E0E0; /* Light grey text */
}

.context-menu-item:hover {
    background-color: #f3f4f6;
}

.dark .context-menu-item:hover {
    background-color: #00B5FF; /* Bright blue on hover */
    color: #121212; /* Dark text on bright blue */
}

.context-menu-item.disabled {
    opacity: 0.5;
    color: #9ca3af;
    cursor: not-allowed;
    pointer-events: none;
    background-color: transparent !important;
}

.dark .context-menu-item.disabled {
    color: #777777; /* Slightly darker disabled text */
}

/* Make the right sidebar a flex container */
.right-sidebar {
    display: flex;
    flex-direction: column;
}

/* Allow the Summary section to grow and fill available space */
.summary-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.flex-grow .tox-tinymce {
    flex-grow: 1 !important;
}

.flex-grow {
    min-height: 0;
}

#root-drop-zone-bottom {
    display: flex; /* It needs to be a flex container for alignment */
    opacity: 0;
    visibility: hidden;
    transition: opacity 150ms ease-in-out; /* This creates the smooth animation */
}

/* This is the new rule for when the drag is active. */
.is-dragging #root-drop-zone-bottom {
    opacity: 1;
    visibility: visible;
}

#asset-drop-overlay.dragging {
    display: flex; /* Use flex to show it */
}

/* Form input styles - removed in favor of inline Tailwind classes */

/* Button styles - removed in favor of inline Tailwind classes */

/* Button styles - using Tailwind classes inline instead */

/* Topic Toolbar styles - removed in favor of inline Tailwind classes */

/* Metadata card styles */
.metadata-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    background-color: #f3f4f6;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    transition: all 0.15s ease-in-out;
}

.dark .metadata-card {
    background-color: #374151;
    border-color: #4b5563;
}

.metadata-card:hover {
    border-color: #0095D5;
    background-color: #e5e7eb;
}

.dark .metadata-card:hover {
    border-color: #0095D5;
    background-color: #4b5563;
}

.metadata-card a {
    color: #0095D5;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    flex: 1;
    margin-right: 0.5rem;
}

.metadata-card a:hover {
    text-decoration: underline;
}

.metadata-card i {
    font-size: 0.875rem;
}

/* Content accordion styles */

.content-preview {
    max-height: 5em; /* Adjust as needed */
    overflow: hidden;
}

.view-more-btn {
    background: none;
    border: none;
    color: #007BFF; /* Adjust to match your theme */
    cursor: pointer;
    text-decoration: underline;
    margin-top: 0.5em;
}

/* Accordion-based content cards */
.Content-accordion {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    background-color: #ffffff;
    transition: all 0.2s ease-in-out;
}

.dark .Content-accordion {
    background-color: #1f2937;
    border-color: #374151;
}

.Content-accordion:hover {
    border-color: #0095D5;
    box-shadow: 0 2px 4px rgba(0, 149, 213, 0.1);
}

.dark .Content-accordion:hover {
    border-color: #0095D5;
    box-shadow: 0 2px 4px rgba(0, 149, 213, 0.2);
}

.Content-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    background-color: #f8fafc;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    user-select: none;
    min-height: 4rem;
}

    .Content-accordion-header > .flex-grow {
        flex: 1 1 0; /* A shorthand for grow, shrink, and basis */
        min-width: 0; /* THIS IS THE CRITICAL FIX */
        overflow: hidden; /* Hide anything that still overflows */
    }

.dark .Content-accordion-header {
    background-color: #111827;
    color: #E0E0E0;
}

.Content-accordion-header:hover {
    background-color: #f1f5f9;
}

.dark .Content-accordion-header:hover {
    background-color: #1e293b;
}

.Content-accordion-header.expanded {
    border-bottom-color: #e5e7eb;
    background-color: #ffffff;
}

.dark .Content-accordion-header.expanded {
    border-bottom-color: #374151;
    background-color: #1f2937;
}

.Content-accordion-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1f2937;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.dark .Content-accordion-title {
    color: #E0E0E0;
}

.Content-accordion-preview {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block; /* Ensures overflow rules apply correctly */
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.dark .Content-accordion-preview {
    color: #9ca3af;
}

.Content-accordion-header.expanded .Content-accordion-preview {
    display: none;
}

.Content-accordion-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.dark .Content-accordion-stats {
    color: #9ca3af;
}

.Content-accordion-header.expanded .Content-accordion-stats {
    display: none;
}

.Content-accordion-stats span {
    display: flex;
    align-items: center;
    padding: 0.125rem 0.375rem;
    background-color: #f1f5f9;
    border-radius: 0.25rem;
    white-space: nowrap;
}

.dark .Content-accordion-stats span {
    background-color: #334155;
}

.Content-accordion-stats i {
    opacity: 0.8;
    font-size: 0.5rem;
}

.Content-accordion-icon {
    color: #6b7280;
    font-size: 0.75rem;
    transition: transform 0.2s ease-in-out;
    flex-shrink: 0;
    margin-left: 0.5rem;
    margin-top: 0.125rem;

}

.dark .Content-accordion-icon {
    color: #9ca3af;
}

.Content-accordion-header.expanded .Content-accordion-icon {
    transform: rotate(180deg);
}

.Content-accordion-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0; /* This correctly keeps the controls from shrinking */
}


.Content-accordion-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
}

.dark .Content-accordion-content {
    background-color: #1f2937;
}

.Content-accordion-content.expanded {
    max-height: 2000px; /* Large enough to accommodate most content */
    padding: 1rem;
}

/* Smooth scrolling for long content */
.Content-accordion-content.expanded {
    overflow-y: auto;
    max-height: 400px; /* Limit height and add scroll for very long content */
}

.Content-accordion-body {
    font-size: 0.875rem;
    line-height: 1.6;
    color: #374151;
    max-width: none;
}

.dark .Content-accordion-body {
    color: #d1d5db;
}

/* Status indicators */
.Content-accordion-status {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.Content-accordion-status.published {
    background-color: #dcfce7;
    color: #166534;
}

.dark .Content-accordion-status.published {
    background-color: #14532d;
    color: #bbf7d0;
}

.Content-accordion-status.draft {
    background-color: #fef3c7;
    color: #92400e;
}

.dark .Content-accordion-status.draft {
    background-color: #451a03;
    color: #fcd34d;
}

/* Content metadata */
.Content-accordion-meta {
    font-size: 0.625rem;
    color: #9ca3af;
    margin-left: 0.5rem;
    padding: 0.125rem 0.375rem;
    background-color: #f3f4f6;
    border-radius: 0.25rem;
}

.dark .Content-accordion-meta {
    color: #6b7280;
    background-color: #374151;
}

/* Legacy card styles for backward compatibility */
.Content-card {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.dark .Content-card {
    background-color: #1f2937;
    border-color: #374151;
}

.Content-card-header {
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.875rem;
    background-color: #ffffff;
}

.dark .Content-card-header {
    border-bottom-color: #374151;
    color: #E0E0E0;
    background-color: #111827;
}

.Content-card-content {
    padding: 1rem;
    max-width: none;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Prose content styling within cards */
#Content-view-container.prose {
    font-size: 0.875rem;
    line-height: 1.6;
}

#Content-view-container.prose p {
    margin-bottom: 0.75rem;
}

#Content-view-container.prose h1,
#Content-view-container.prose h2,
#Content-view-container.prose h3,
#Content-view-container.prose h4 {
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

.prose {
    max-width: none;
}

.dark .prose {
    color: #d1d5db;
}

/* Panel 3 (Asset Details) specific styles */
#panel3 {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #f3f4f6;
}

.dark #panel3 {
    background-color: #111827;
}

/* Content editor container */
#Content-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flex children */
}

/* Ensure TinyMCE fills its container */
#Content-editor-container .tox-tinymce {
    flex: 1;
    height: 100% !important;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.dark #Content-editor-container .tox-tinymce {
    border-color: #374151;
}

/* Ensure the editor content area fills available space */
#Content-editor-container .tox-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#Content-editor-container .tox-edit-area {
    flex: 1;
    overflow-y: auto !important;
}

/* Ensure the iframe inside TinyMCE is scrollable */
#Content-editor-container .tox-edit-area iframe {
    height: 100% !important;
}

/* Fix for the editor body to be scrollable */
.tox .tox-edit-area__iframe {
    overflow-y: auto !important;
}

/* Asset details panel specific improvements */
#panel3 .tox .tox-toolbar__primary {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.dark #panel3 .tox .tox-toolbar__primary {
    background-color: #1f2937;
    border-bottom: 1px solid #374151;
}

/* Remove default TinyMCE button backgrounds */
#panel3 .tox .tox-tbtn {
    background-color: transparent !important;
}

#panel3 .tox .tox-tbtn:hover {
    background-color: #e5e7eb !important;
}

.dark #panel3 .tox .tox-tbtn:hover {
    background-color: #374151 !important;
}

/* Handle active/pressed state */
#panel3 .tox .tox-tbtn--enabled,
#panel3 .tox .tox-tbtn:active {
    background-color: #d1d5db !important;
}

.dark #panel3 .tox .tox-tbtn--enabled,
.dark #panel3 .tox .tox-tbtn:active {
    background-color: #4b5563 !important;
}

/* Card styling for sections */
#panel3 .bg-white {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.dark #panel3 .bg-gray-800 {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

/* Dropzone styling improvements */
#dropzone {
    transition: all 0.2s ease-in-out;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dropzone:hover {
    border-color: #0095D5;
    background-color: rgba(0, 149, 213, 0.05);
}

.dark #dropzone:hover {
    background-color: rgba(0, 149, 213, 0.1);
    border-color: #0095D5;
}

#dropzone.border-pta-blue {
    border-color: #0095D5;
    background-color: rgba(0, 149, 213, 0.1);
}

.dark #dropzone.border-pta-blue {
    background-color: rgba(0, 149, 213, 0.15);
    border-color: #0095D5;
}

/* Metadata cards within the new layout */
#metadata-cards-container {
    min-height: 60px;
}

/* Ensure proper spacing in the contents section */
#Content-view-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* Style adjustments for edit mode */
#panel3 input[type="text"],
#panel3 input[type="url"],
#panel3 select {
    font-size: 0.875rem;
}

/* Ensure buttons in the panel have consistent sizing */
#panel3 button {
    font-size: 0.875rem;
}

/* TinyMCE AI Assistant button */
.tox .tox-tbtn--select[aria-label="IQ Assistant"] {
    width: auto !important;
}

.tox .tox-tbtn__select-label i {
    font-size: 16px;
    line-height: 1;
}

/* Secondary button styles - removed in favor of inline Tailwind classes */

/* Target the Content dropdown button specifically */
.tox .content-dropdown-button,
.tox-toolbar__primary button.tox-mbtn--select {
    min-width: 200px !important;
    width: 200px !important;
}

/* Ensure text inside button doesn't overflow */
.tox .content-dropdown-button .tox-mbtn__select-label,
.tox-toolbar__primary button.tox-mbtn--select .tox-mbtn__select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    text-align: left;
    max-width: 170px;
}

/* Force ALL TinyMCE dropdown menus in toolbar to be wider */
.tox .tox-menu.tox-collection--toolbar,
.tox .tox-collection.tox-collection--toolbar,
.tox-tinymce .tox-menu,
div[role="application"].tox .tox-menu {
    min-width: 300px !important;
    width: auto !important;
}

/* Ensure menu items have enough space */
.tox .tox-collection__item {
    min-width: 280px !important;
}

.tox .tox-collection__item-label {
    max-width: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 20px !important;
}

/* Fix TinyMCE scrolling for long content like transcriptions */
#Content-editor-container {
    height: 100%;
    overflow: hidden;
}

#Content-editor-container .tox {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#Content-editor-container .tox-editor-header {
    flex-shrink: 0;
}

#Content-editor-container .tox-editor-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#Content-editor-container .tox-edit-area {
    flex: 1;
    overflow: hidden;
}

#Content-editor-container .tox-edit-area__iframe {
    height: 100% !important;
    width: 100% !important;
}

#Content-editor-container .tox-edit-area {
    flex: 1;
    overflow-y: auto !important;
}

    /* Ensure the iframe inside TinyMCE is scrollable */
    #Content-editor-container .tox-edit-area iframe {
        height: 100% !important;
    }

/* Fix for the editor body to be scrollable */
.tox .tox-edit-area__iframe {
    overflow-y: auto !important;
}

.Content-accordion h1 {
    font-size: 2em;
    font-weight: bold;
}

.Content-accordion h2 {
    font-size: 1.5em;
    font-weight: bold;
}

.Content-accordion h3 {
    font-size: 1.17em;
    font-weight: bold;
}

.Content-accordion h4 {
    font-size: 1em;
    font-weight: bold;
}

.Content-accordion h5 {
    font-size: 0.83em;
    font-weight: bold;
}

.Content-accordion h6 {
    font-size: 0.67em;
    font-weight: bold;
}

/* Paper airplane animation for share modal */
@keyframes flyLoop {
    0% {
        transform: translateX(-100px) translateY(0) rotate(-10deg);
    }
    25% {
        transform: translateX(0) translateY(-20px) rotate(0deg);
    }
    50% {
        transform: translateX(100px) translateY(0) rotate(10deg);
    }
    75% {
        transform: translateX(0) translateY(20px) rotate(0deg);
    }
    100% {
        transform: translateX(-100px) translateY(0) rotate(-10deg);
    }
}

.paper-airplane {
    animation: flyLoop 3s ease-in-out infinite;
    transform-origin: center;
}

#paperAirplaneAnimation {
    transition: opacity 0.3s ease-in-out;
}

#paperAirplaneAnimation.hidden {
    opacity: 0;
}

#paperAirplaneAnimation:not(.hidden) {
    opacity: 1;
}