/**
 * Introductions Creator Styles
 * Styles for the introduction document creator UI
 */

/* Import shared component styles */
@import './svg-preview-shared.css';
@import './content-card-shared.css';

/* Fixed heights for independent scrolling in 3-panel layout */
#content-navigation,
#content-viewer,
#selected-content {
    height: calc(100vh - 240px);
    overflow-y: auto !important;
}

/* Navigation Tree Styles */
.nav-tree {
    font-size: 0.875rem;
}

.nav-node {
    margin-bottom: 0.25rem;
}

.nav-node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.nav-node-header:hover {
    background-color: var(--bg-secondary, #f3f4f6);
}

.nav-toggle {
    width: 12px;
    font-size: 0.75rem;
    color: #6b7280;
}

.nav-icon {
    font-size: 1rem;
}

.nav-label {
    flex: 1;
    font-weight: 500;
}

.nav-badge {
    padding: 0.125rem 0.375rem;
    background: var(--bg-tertiary, #e5e7eb);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.nav-children {
    margin-left: 1.5rem;
    padding-left: 0.5rem;
    border-left: 1px solid #e5e7eb;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin: 0.25rem 0;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: var(--bg-secondary, #f3f4f6);
}

.nav-item.selected {
    background-color: #dbeafe;
    border-left: 3px solid #3b82f6;
}

/* Content Item Styles (Selected Cart) */
.selected-content-header {
    margin-bottom: 1rem;
}

.content-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.content-stats span {
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary, #f3f4f6);
    border-radius: 0.25rem;
}

.selected-content-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.content-item {
    padding: 0.75rem;
    background: var(--bg-secondary, #f9fafb);
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: move;
    transition: all 0.2s;
}

/* Introduction Creator specific overrides (if needed) */

/* Drag over feedback for drop zone */
.selected-content-list.drag-over {
    border: 2px dashed var(--color-primary, #3b82f6);
    background: rgba(59, 130, 246, 0.05);
    border-radius: var(--radius-md, 0.5rem);
}

.content-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-item.dragging {
    opacity: 0.5;
}

.content-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drag-handle {
    cursor: grab;
    color: #9ca3af;
    font-size: 1rem;
}

.drag-handle:active {
    cursor: grabbing;
}

.content-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

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

.content-title {
    flex: 1;
    font-weight: 500;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.25rem 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: #dc2626;
}

.btn-add {
    padding: 0.25rem 0.5rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    margin-left: auto;
}

.btn-add:hover {
    background: #2563eb;
    transform: scale(1.05);
}

.btn-remove {
    margin-left: auto;
    border: none;
    background: transparent;
    color: #dc2626;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.btn-remove:hover {
    color: #991b1b;
    transform: scale(1.2);
}

.content-item-meta {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

.content-item-preview {
    position: relative;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
}

.points-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.points-label .points-input {
    width: 60px;
}

.content-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

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

.content-title {
    flex: 1;
    font-weight: 500;
    color: #1f2937;
}

.points-input {
    padding: 0.25rem 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* Content Viewer Styles */
.content-preview {
    padding: 1rem;
}

.preview-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.preview-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preview-content {
    margin-top: 1rem;
}

.svg-preview svg {
    max-width: 100%;
    height: auto;
}

.latex-preview pre {
    background: var(--bg-secondary, #f9fafb);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

.preview-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary, #e5e7eb);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

/* Empty States */
.empty-state-small {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

.error-small {
    padding: 1rem;
    text-align: center;
    color: #dc2626;
    font-size: 0.875rem;
}

.loading-small {
    padding: 1rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

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

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

/* Filter Buttons - defined in buttons.css */

/* Modal Overlay */
.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;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 90%;
}

.modal-content h2 {
    margin-top: 0;
}

/* Insert Zones */
.insert-zone {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 8px;
    transition: height 0.2s ease;
}

.insert-zone:hover {
    height: 32px;
}

.insert-trigger {
    opacity: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #3b82f6;
    background: white;
    color: #3b82f6;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 10;
}

.insert-zone:hover .insert-trigger {
    opacity: 1;
}

.insert-trigger:hover {
    background: #3b82f6;
    color: white;
    transform: scale(1.1);
}

.insert-menu {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    z-index: 100;
    min-width: 180px;
}

.insert-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.1));
}

.insert-menu-item {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background 0.2s ease;
    font-size: 0.875rem;
}

.insert-menu-item:hover {
    background: #f3f4f6;
}

.insert-menu-item:active {
    background: #e5e7eb;
}

/* SortableJS Drag & Drop States */
.sortable-ghost {
    opacity: 0.4;
    background: #e0e7ff;
}

.sortable-chosen {
    cursor: grabbing !important;
}

.sortable-drag {
    opacity: 1;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .selected-content-list {
        font-size: 0.875rem;
    }

    .content-item {
        padding: 0.5rem;
    }
}
