/*
 * Editor Components CSS
 * Award-winning design for data editing forms
 * Consistent with visualizer-components.css for design harmony
 * Version: 1.0
 */

/* ===== Editor Container ===== */
.editor-container {
    border-radius: 20px;
    overflow: hidden;
    animation: fadeInUp 0.5s ease-out;
    max-width: 1200px;
    max-height: 85vh;
    overflow-y: auto;
    min-width: 800px;
}

.theme-dark .editor-container {
    background: linear-gradient(135deg, rgba(33, 33, 33, 0.95) 0%, rgba(24, 24, 24, 0.98) 100%);
    border: 1px solid rgba(232, 232, 240, 0.08);
}

.theme-light .editor-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.95) 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ===== Editor Content ===== */
.editor-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== Editor Section ===== */
.editor-section {
    border-radius: 16px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: sectionFadeIn 0.5s ease-out forwards;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-dark .editor-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.theme-light .editor-section {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.editor-section:hover {
    transform: translateY(-2px);
}

.theme-dark .editor-section:hover {
    border-color: rgba(var(--section-accent, 0, 150, 255), 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.theme-light .editor-section:hover {
    border-color: rgba(var(--section-accent, 0, 150, 255), 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Section with accent border */
.editor-section[style*="--section-accent"] {
    border-left: 3px solid rgba(var(--section-accent), 0.6);
}

@keyframes sectionFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Section Header ===== */
.editor-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 12px;
    user-select: none;
}

.theme-dark .editor-section-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.theme-light .editor-section-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.editor-section .section-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.editor-section .section-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Section Icon */
.editor-section .section-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--icon-bg, rgba(0, 150, 255, 0.15));
    color: var(--icon-color, rgba(0, 150, 255, 1));
    transition: all 0.3s ease;
}

.editor-section:hover .section-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(var(--section-accent, 0, 150, 255), 0.2);
}

/* Section Title */
.editor-section .section-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.editor-section .section-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.theme-dark .editor-section .section-title {
    color: rgba(255, 255, 255, 0.95);
}

.theme-light .editor-section .section-title {
    color: rgba(0, 0, 0, 0.87);
}

.editor-section .section-subtitle {
    font-size: 0.8rem;
    font-weight: 400;
}

.theme-dark .editor-section .section-subtitle {
    color: rgba(255, 255, 255, 0.5);
}

.theme-light .editor-section .section-subtitle {
    color: rgba(0, 0, 0, 0.5);
}

/* Section Badge */
.editor-section .section-badge {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
}

/* ===== Section Content ===== */
.editor-section-content {
    padding: 20px;
}

/* ===== Form Field Enhancements ===== */
.editor-section .mud-input-filled {
    border-radius: 12px !important;
}

.theme-dark .editor-section .mud-input-filled {
    background: rgba(255, 255, 255, 0.03) !important;
}

.theme-light .editor-section .mud-input-filled {
    background: rgba(0, 0, 0, 0.03) !important;
}

.theme-dark .editor-section .mud-input-filled:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.theme-light .editor-section .mud-input-filled:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

.editor-section .mud-input-filled.mud-input-focused {
    border-color: rgba(var(--section-accent, 0, 150, 255), 0.5) !important;
}

/* ===== Action Bar ===== */
.editor-action-bar {
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    opacity: 0;
    transform: translateY(20px);
    animation: sectionFadeIn 0.5s ease-out forwards;
}

.theme-dark .editor-action-bar {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-light .editor-action-bar {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.editor-action-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-action-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== Premium Buttons ===== */
.editor-btn-primary {
    border-radius: 12px !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 12px rgba(0, 150, 255, 0.2) !important;
}

.editor-btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 150, 255, 0.3) !important;
}

.editor-btn-secondary {
    border-radius: 12px !important;
    padding: 10px 20px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}

.editor-btn-secondary:hover {
    transform: translateY(-1px) !important;
}

.editor-btn-danger {
    border-radius: 12px !important;
    border-width: 2px !important;
    padding: 10px 20px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
}

.editor-btn-danger:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(255, 41, 79, 0.2) !important;
}

/* ===== Validation Switch ===== */
.validation-switch {
    padding: 8px 16px;
    border-radius: 100px;
    transition: all 0.3s ease;
}

.theme-dark .validation-switch {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-light .validation-switch {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.validation-switch.validated {
    border-color: rgba(0, 224, 87, 0.3);
}

.theme-dark .validation-switch.validated {
    background: rgba(0, 224, 87, 0.1);
}

.theme-light .validation-switch.validated {
    background: rgba(0, 224, 87, 0.08);
}

/* ===== Relationship Card Enhancements ===== */
.relationship-card-premium {
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
}

.theme-dark .relationship-card-premium {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.theme-light .relationship-card-premium {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.relationship-card-premium:hover {
    transform: translateY(-4px) scale(1.02);
}

.theme-dark .relationship-card-premium:hover {
    border-color: rgba(0, 150, 255, 0.4);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.theme-light .relationship-card-premium:hover {
    border-color: rgba(0, 150, 255, 0.3);
    background: rgba(0, 0, 0, 0.03);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.relationship-card-premium-content {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.relationship-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.relationship-card-premium:hover .relationship-card-icon {
    transform: scale(1.1);
}

.relationship-card-info {
    flex: 1;
    min-width: 0;
}

.relationship-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.theme-dark .relationship-card-name {
    color: rgba(255, 255, 255, 0.9);
}

.theme-light .relationship-card-name {
    color: rgba(0, 0, 0, 0.87);
}

.relationship-card-type {
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.theme-dark .relationship-card-type {
    color: rgba(255, 255, 255, 0.4);
}

.theme-light .relationship-card-type {
    color: rgba(0, 0, 0, 0.4);
}

.relationship-remove-btn {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.relationship-card-premium:hover .relationship-remove-btn {
    opacity: 0.7;
    transform: scale(1);
}

.relationship-remove-btn:hover {
    opacity: 1 !important;
}

/* Warning state for unknown entities */
.relationship-card-icon-warning {
    background: rgba(var(--mud-palette-warning-rgb, 255, 139, 0), 0.15);
    color: var(--mud-palette-warning);
}

.relationship-card-name-warning {
    color: var(--mud-palette-warning) !important;
}

/* ===== Add Button (Dashed) ===== */
.add-relationship-btn {
    border-radius: 12px !important;
    border-style: dashed !important;
    border-width: 2px !important;
    padding: 16px !important;
    transition: all 0.3s ease !important;
}

.theme-dark .add-relationship-btn {
    background: rgba(255, 255, 255, 0.01) !important;
}

.theme-light .add-relationship-btn {
    background: rgba(0, 0, 0, 0.01) !important;
}

.add-relationship-btn:hover {
    transform: translateY(-2px) !important;
}

.theme-dark .add-relationship-btn:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

.theme-light .add-relationship-btn:hover {
    background: rgba(0, 0, 0, 0.02) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
}

/* ===== Empty State ===== */
.editor-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    gap: 12px;
}

.editor-empty-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 4px;
}

.theme-dark .editor-empty-icon {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.3);
}

.theme-light .editor-empty-icon {
    background: rgba(0, 0, 0, 0.03);
    color: rgba(0, 0, 0, 0.3);
}

.editor-empty-text {
    font-size: 0.9rem;
    font-weight: 400;
    max-width: 280px;
}

.theme-dark .editor-empty-text {
    color: rgba(255, 255, 255, 0.4);
}

.theme-light .editor-empty-text {
    color: rgba(0, 0, 0, 0.4);
}

/* ===== Tag Chip Premium ===== */
.tag-chip-editor {
    padding: 6px 14px;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tag-chip-editor:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ===== Date Picker Enhancements ===== */
.editor-section .mud-picker {
    border-radius: 12px !important;
}

/* ===== Select Field Enhancements ===== */
.editor-section .mud-select {
    border-radius: 12px !important;
}

/* ===== Period Info Alert ===== */
.period-info-alert {
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-dark .period-info-alert {
    background: rgba(56, 182, 255, 0.08);
    border: 1px solid rgba(56, 182, 255, 0.2);
}

.theme-light .period-info-alert {
    background: rgba(56, 182, 255, 0.06);
    border: 1px solid rgba(56, 182, 255, 0.15);
}

.period-info-icon {
    color: rgba(56, 182, 255, 0.8);
}

.period-info-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(56, 182, 255, 0.9);
}

/* ===== Image Preview ===== */
.image-preview-container {
    margin-top: 16px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.theme-dark .image-preview-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.theme-light .image-preview-container {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.image-preview {
    max-height: 200px;
    width: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.image-preview-container:hover .image-preview {
    transform: scale(1.02);
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 900px) {
    .editor-container {
        min-width: auto;
        max-height: 90vh;
    }
    
    .editor-content {
        padding: 16px;
        gap: 16px;
    }
    
    .editor-section-header {
        padding: 12px 16px;
    }
    
    .editor-section-content {
        padding: 16px;
    }
    
    .editor-action-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .editor-action-bar-left,
    .editor-action-bar-right {
        width: 100%;
        justify-content: center;
    }
}

/* ===== Scrollbar Styling ===== */
.editor-container::-webkit-scrollbar {
    width: 8px;
}

.editor-container::-webkit-scrollbar-track {
    background: transparent;
}

.theme-dark .editor-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.theme-light .editor-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.theme-dark .editor-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.theme-light .editor-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ===== Tag Widget Premium Styling ===== */
.tag-widget-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tag-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-chip-premium {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 100px;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tag-chip-premium:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.tag-chip-premium .tag-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-chip-premium .tag-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    cursor: pointer;
}

.tag-chip-premium:hover .tag-remove-btn {
    opacity: 1;
    transform: scale(1);
}

.tag-chip-premium .tag-remove-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.add-tag-btn {
    align-self: flex-start;
    border-radius: 100px !important;
    border-style: dashed !important;
}

/* ===== Tag Overlay Premium ===== */
.tag-overlay-container {
    border-radius: 16px;
    overflow: hidden;
}

.theme-dark .tag-overlay-container {
    background: rgba(33, 33, 33, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-light .tag-overlay-container {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    border-radius: 12px;
}

.theme-dark .tag-grid {
    background: rgba(255, 255, 255, 0.02);
}

.theme-light .tag-grid {
    background: rgba(0, 0, 0, 0.02);
}

.tag-selectable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.tag-selectable:not(.selected):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tag-selectable.selected {
    cursor: default;
    opacity: 0.7;
}

.tag-selectable.selected::after {
    content: "✓";
    margin-left: 4px;
}

/* ===== Tag Dialog Styles ===== */
.tag-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tag-dialog-container {
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background: rgba(30, 30, 30, 0.98);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.25s ease-out;
}

.tag-dialog-container.tag-dialog-small {
    max-width: 480px;
}

.tag-dialog-container.tag-dialog-confirm {
    max-width: 420px;
}

.tag-confirm-overlay {
    z-index: 10050;
}

.tag-dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.tag-dialog-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
}

.tag-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.tag-selection-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.tag-color-section {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.tag-preview-section {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Tag Selection Grid */
.tag-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.tag-selection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.tag-selection-item:hover:not(.already-added) {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: var(--tag-color, rgba(255, 255, 255, 0.2));
}

.tag-selection-item.already-added {
    cursor: default;
    opacity: 0.6;
    background: rgba(var(--tag-color), 0.1);
}

.tag-selection-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Empty search state */
.tag-empty-search {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
}

/* Tag Preview */
.tag-preview-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tag-chip-large {
    padding: 12px 20px !important;
    font-size: 1rem !important;
}

.tag-chip-large .tag-name {
    font-size: 1rem;
}

/* MudDialog overrides for tag dialogs */
::deep .tag-dialog .mud-dialog-title,
::deep .tag-edit-dialog .mud-dialog-title {
    padding: 20px 24px 12px;
}

::deep .tag-dialog .mud-dialog-content,
::deep .tag-edit-dialog .mud-dialog-content {
    padding: 0 24px 16px;
}

::deep .tag-dialog .mud-dialog-actions,
::deep .tag-edit-dialog .mud-dialog-actions {
    padding: 12px 24px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
