/* EDVC Mapper - VERBESSERTE Canvas Styles - SMOOTH BIDIRECTIONAL ANIMATIONS */

.edvc-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--edvc-bg-map);
    cursor: grab;
}

.edvc-canvas-container:active {
    cursor: grabbing;
}

.edvc-canvas {
    position: absolute;
    top: 0;
    left: 0;
    min-width: 100%;
    min-height: 100%;
    padding: 2rem;
    transform-origin: 0 0;
    /* ENTFERNT: transition hier, da es bei Panning stört */
}

/* Card Rows */
.edvc-card-row {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 6rem;
    position: relative !important;
    min-height: 200px;
    overflow: visible !important;
}

/* Hauptreihe (Row 0) */
.edvc-card-row[data-row="0"] {
    z-index: 2;
}

/* Branch-Reihen */
.edvc-branch-row {
    z-index: 1;
    margin-top: 3rem;
    position: relative;
    transform: translateX(calc(var(--branch-from-card, 0) * (340px)));
}

/* ----- Einfache Pop-Animation für neue Karten Start ----- */
.edvc-card.new-card-entering {
    opacity: 0;
    transform: scale(0.8);
    animation: edvcCardPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes edvcCardPop {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    70% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fallback für reduced motion */
@media (prefers-reduced-motion: reduce) {
    .edvc-card.new-card-entering {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* ----- Einfache Pop-Animation für neue Karten Ende ----- */

/* ==============================================
   KORRIGIERTE BIDIRECTIONAL CARD ANIMATIONS
   Lösung: Initial State definieren und korrekte Transition-Delays
   ============================================== */

.edvc-card {
    padding: 1rem !important;
    background-color: var(--edvc-card-bg);
    border-radius: var(--edvc-border-radius);
    box-shadow: var(--edvc-shadow);
    position: relative;
    cursor: pointer;
    min-width: 280px;
    max-width: 320px;
    overflow: visible;
    z-index: 1;
    margin-bottom: 2rem;
    
    /* KRITISCH: CSS Transition für height UND min-height */
    transition: height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                min-height 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    
    /* STANDARD STATE: Expanded mit FESTER Höhe (nicht auto!) */
    height: 220px;      /* Feste Höhe statt auto */
    min-height: 220px;  /* Konsistent */
}

/* COLLAPSED State - Kleinere feste Höhe */
.edvc-card.collapsed {
    height: 140px;      /* Von 220px zu 140px = CSS kann animieren */
    min-height: 140px;
}

/* EXPANDED State - Explizit für bessere Kontrolle */
.edvc-card.expanded {
    height: 220px;      /* Zurück zur Standard-Höhe */
    min-height: 220px;
}

/* Card Summary mit separater Content-Transition */
.edvc-card-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e1e8ed;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.edvc-card.collapsed .edvc-card-summary {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
	
}

.edvc-card:not(.collapsed) .edvc-card-summary,
.edvc-card.expanded .edvc-card-summary {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s, 
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s !important;
}

/* Card Title */
.edvc-card-title {
    font-size: 16px !important;
    font-weight: 600 !important;
	font-family: inherit !important;
    color: var(--edvc-text-primary) !important;
	border: 2px solid transparent;
    margin: 0 0 1rem 0;
    line-height: 1.3 !important;
    word-wrap: break-word;
    min-height: 1.3em;
    text-align: center;
	transition: none !important;
}

.edvc-card-title:hover {
    background-color: rgba(0, 124, 186, 0.1)
}

.edvc-card-title:focus {
    outline: none;
	border: 2px solid var(--edvc-highlight);
	
}

.edvc-card-title:empty::before {
    content: 'Untitled moment...';
    color: var(--edvc-text-placeholder);
    font-style: italic;
}

/* Evaluation Icons - Container mit fester Höhe und Transition */
.edvc-evaluation-icons {
    display: flex;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    height: 64px;
    min-height: 64px;
    box-sizing: border-box;
    overflow: hidden;
    /* HINZUGEFÜGT: Transition für Icons-Container */
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* OPTIONAL: Icons verhalten bei collapsed (falls gewünscht) */
.edvc-card.collapsed .edvc-evaluation-icons {
    /* Icons bleiben sichtbar in collapsed state */
    opacity: 1;
    transform: none;
}

.edvc-evaluation-icons .icon-cell {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.edvc-evaluation-icons img {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: block;
    transition: all 0.3s ease; /* Transition für Icon-Änderungen */
}

.edvc-evaluation-icons img.unrated {
    width: 24px;
    height: 24px;
    opacity: 0.6;
}

/* Card Content Area */
.edvc-card-content {
    position: relative;
    height: calc(100% - 2rem);
    display: flex;
    flex-direction: column;
}

.edvc-summary-item {
    text-align: center;
}

.edvc-summary-item span:first-child {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--edvc-text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.edvc-count {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--edvc-text-primary);
    line-height: 1;
}

.edvc-count.zero {
    color: var(--edvc-text-secondary, #7f8c8d);
}

/* Card Image - unverändert */
.edvc-card-image {
    position: absolute;
    bottom: calc(95%);
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    border-radius: var(--edvc-border-radius);
    overflow: hidden;
    box-shadow: var(--edvc-shadow);
    background-color: white;
    cursor: pointer;
    transition: var(--edvc-transition);
    z-index: 3;
    margin-bottom: 1rem;
}

.edvc-card-image:hover {
    transform: translateX(-50%) scale(1.05);
}

.edvc-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Branch und Flag Indikatoren */
.edvc-branch-indicator {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
}

.edvc-branch-circle {
    width: 24px;
    height: 24px;
    background-color: var(--edvc-text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.edvc-branch-icon {
    width: 14px;
    height: 14px;
    filter: brightness(0) invert(1);
}

.edvc-flag-indicator {
    position: absolute;
    top: -8px;
    left: -8px;
    z-index: 5;
    pointer-events: none;
}

.edvc-flag-circle {
    width: 24px;
    height: 24px;
    background-color: var(--edvc-highlight, #007CBA);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.edvc-flag-icon {
    width: 14px;
    height: 14px;
    filter: brightness(0) invert(1);
}

/* Mapping Tools (unverändert) */
.edvc-mapping-container {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    height: auto;
    z-index: 1000;
}

.edvc-edit-trigger {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    opacity: 0;
    transition: var(--edvc-transition);
    z-index: 1001;
}

.edvc-card:hover .edvc-edit-trigger {
    opacity: 1;
}

.edvc-edit-trigger-btn {
    background: white;
    border: none;
    padding: 0.5rem;
    border-radius: var(--edvc-border-radius);
    cursor: pointer;
    transition: var(--edvc-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    box-shadow: var(--edvc-shadow);
}

.edvc-edit-trigger-btn:hover {
    background-color: var(--edvc-bg-navbar);
}

.edvc-edit-trigger-btn img {
    width: 20px;
    height: 20px;
    transition: var(--edvc-transition);
}

.edvc-mapping-tools {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    opacity: 0;
    transition: var(--edvc-transition);
    pointer-events: none;
    z-index: 1002;
    white-space: nowrap;
}

.edvc-edit-trigger:hover + .edvc-mapping-tools,
.edvc-mapping-tools:hover {
    opacity: 1;
    pointer-events: all;
}

.edvc-tools-container {
    display: flex;
    gap: 0.25rem;
    background-color: white;
    border-radius: var(--edvc-border-radius);
    box-shadow: var(--edvc-shadow);
    transform: translateX(120px);
    min-width: max-content;
    white-space: nowrap;
}

.edvc-tool-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: calc(var(--edvc-border-radius) - 2px);
    cursor: pointer;
    transition: var(--edvc-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.edvc-tool-btn:focus-visible {
    outline: none;
}

.edvc-tool-btn:hover {
    background-color: rgba(0, 124, 186, 0.1);
}

.edvc-tool-btn.delete:hover {
    background-color: var(--edvc-warning);
}

.edvc-tool-btn.delete:hover img {
    filter: brightness(0) invert(1);
}

.edvc-tool-btn img {
    width: 20px;
    height: 20px;
    transition: var(--edvc-transition);
}

.edvc-tool-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tooltips */
.edvc-tool-btn,
.edvc-edit-trigger-btn {
    position: relative;
}

.edvc-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: #333333;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.edvc-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #333333;
}

.edvc-tool-btn:hover .edvc-tooltip,
.edvc-edit-trigger-btn:hover .edvc-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Move System und andere Styles bleiben unverändert */
.edvc-card-row.move-active {
    cursor: pointer;
    position: relative;
}

.edvc-move-indicator-container {
    position: absolute;
    top: -20px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.edvc-move-indicator-triangle {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--edvc-highlight, #007CBA);
    filter: drop-shadow(0 2px 4px rgba(0, 124, 186, 0.3));
    transition: all 0.2s ease;
    pointer-events: none;
}

.edvc-move-indicator-container:hover {
    background-color: rgba(0, 124, 186, 0.1);
    transform: translateY(-50%) scale(1.05);
}

.edvc-move-indicator-container:hover .edvc-move-indicator-triangle {
    transform: scale(1.3);
    filter: drop-shadow(0 4px 8px rgba(0, 124, 186, 0.6));
    border-top-color: #0056b3;
}

.edvc-card.moving {
    border: 2px solid var(--edvc-highlight, #007CBA);
    transform: translateY(-4px);
    transition: all 0.3s ease;
    z-index: 50;
}

.edvc-card.moving .edvc-edit-trigger,
.edvc-card.moving .edvc-mapping-tools {
    display: none !important;
}

.edvc-card-row.move-active .edvc-card:not(.moving) {
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

/* Move Popup Styles */
.edvc-move-popup {
    position: fixed;
    top: 120px !important;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 10001;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    user-select: none;
    pointer-events: none;
}

.edvc-move-popup-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.edvc-move-text {
    color: white;
    font-size: 14px;
    line-height: 1.4;
}

.edvc-move-indicator-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    position: relative;
}

.edvc-triangle-symbol {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid var(--edvc-highlight, #007CBA);
    filter: drop-shadow(0 1px 2px rgba(0, 124, 186, 0.4));
}

/* Animationen */
@keyframes edvcMovePopupFadeIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes edvcMovePopupFadeOut {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

@keyframes edvcCardPop {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.edvc-card.new {
    animation: edvcCardPop 0.4s ease-out;
}

/* Inline Title Editing */
.edvc-card .edvc-simple-title-input {
    text-align: center;
    width: 100% !important;
    border: 2px solid var(--edvc-highlight) !important;
    background: white !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    font-family: inherit !important;
    padding: 4px !important;
    border-radius: 4px !important;
    outline: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    position: relative !important;
	height: inherit !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .edvc-card-row {
        margin-bottom: 8rem;
    }
    
    .edvc-branch-row {
        transform: none;
        margin-left: 2rem;
    }
    
    .edvc-branch-indicator {
        display: none;
    }
    
    .edvc-evaluation-icons {
        height: 56px;
        min-height: 56px;
    }
    
    .edvc-evaluation-icons img {
        width: 40px;
        height: 40px;
    }
    
    .edvc-evaluation-icons img.unrated {
        width: 20px;
        height: 20px;
    }
    
    .edvc-move-indicator-container {
        width: 48px;
        height: 48px;
    }
    
    /* Mobile: Kleinere Kartenhöhen */
    .edvc-card {
        height: 280px;
        min-height: 280px;
    }
    
    .edvc-card.collapsed {
        height: 160px;
        min-height: 160px;
    }
}

@media (min-width: 1920px) {
    .edvc-card-row {
        gap: 3rem;
        margin-bottom: 8rem;
    }
    
    .edvc-branch-row {
        transform: translateX(calc(var(--branch-from-card, 0) * (380px + 3rem)));
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .edvc-card,
    .edvc-card-summary {
        transition: none !important;
    }
    
    .edvc-card.collapsed .edvc-card-summary {
        display: none !important;
    }
    
    .edvc-card:not(.collapsed) .edvc-card-summary {
        display: grid !important;
    }
}