/* ==========================================================================
   USV Stromfluss-Animation Component Styles (Unified Card & Integrated Tabs)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Source+Code+Pro:wght@400;500&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

.usv-animation-wrapper {
    /* Color Variables */
    --usv-bg-main: #f8fafc;
    --usv-bg-card: #ffffff;
    --usv-border: #cbd5e1;
    --usv-text-primary: #0f172a;
    --usv-text-secondary: #475569;
    --usv-text-muted: #94a3b8;

    /* Path & Signal Colors */
    --usv-color-ac: #004B87;
    /* Truvion Brand Blue */
    --usv-color-dc: #d9534f;
    /* Red */
    --usv-color-bypass: #f0ad4e;
    /* Orange */
    --usv-color-success: #2e7d32;
    /* Green */
    --usv-color-warning: #ed6c02;
    /* Warning Orange */

    --usv-node-border: #1e293b;
    --usv-node-fill: #ffffff;
    --usv-node-text: #1e293b;
    --usv-node-text-sub: #64748b;

    --usv-active-opacity: 1;
    --usv-inactive-opacity: 0.18;

    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--usv-text-primary);
    width: 100%;
    margin: 1.5rem auto 2.5rem auto;
    box-sizing: border-box;
}

.usv-animation-wrapper h5 {
    line-height: 18px;
}

.usv-animation-wrapper * {
    box-sizing: border-box;
}

/* Single Unified Container */
.usv-animation-wrapper .usv-unified-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

/* Integrated Tab Navigation Header */
.usv-animation-wrapper .tab-header-bar {
    display: flex;
    background: transparent;
    border-bottom: 2px solid #004B87;
    padding: 0;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-items: stretch;
}

.usv-animation-wrapper .tab-header-bar::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.usv-animation-wrapper .tab-header-bar .tab-btn {
    flex: 1 1 0;
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    color: #004B87;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    top: 2px;
    white-space: nowrap;
}

.usv-animation-wrapper .tab-header-bar .tab-btn:hover {
    background: #f0f7ff;
    color: #004B87;
}

.usv-animation-wrapper .tab-header-bar .tab-btn.active {
    background: #004B87;
    color: #ffffff;
    border-color: #004B87;
    border-bottom-color: #004B87;
    box-shadow: none;
}

.tab-label-short {
    display: none;
}

/* Inner Body Content */
.usv-animation-wrapper .usv-card-body {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    padding: 2rem 2rem 1.75rem 2rem;
}

/* Card Section Divider */
.usv-animation-wrapper .usv-card-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 1.25rem 0 0.75rem 0;
}

/* Tab Description Styling (Inside unified card) */
.usv-animation-wrapper .tab-description-container {
    width: 100%;
    text-anchor: left;
    font-family: 'Arial Nova', 'Arimo', Arial, sans-serif;
    color: #181818;
}

.usv-animation-wrapper .tab-description {
    display: none !important;
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
}

.usv-animation-wrapper .tab-description.active {
    display: block !important;
}

/* Main Schematic View Panel (Inside unified card) */
.usv-animation-wrapper .schematic-view-panel {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.usv-animation-wrapper .schematic-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
}

.usv-animation-wrapper .diagram-container {
    display: none;
    width: 100%;
    justify-content: center;
}

.usv-animation-wrapper .diagram-container.active {
    display: flex;
}

.usv-animation-wrapper svg {
    width: 100%;
    max-width: 1050px;
    height: auto;
}

.usv-animation-wrapper svg text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    user-select: none;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "clig" 0;
}

/* SVG Line & Path Styling */
.usv-animation-wrapper .flow-bg-lines path {
    stroke: var(--usv-border);
    stroke-width: 2.5;
}

.usv-animation-wrapper .flow-line {
    stroke-width: 3.2;
    opacity: var(--usv-inactive-opacity);
    transition: stroke-width 0.3s, opacity 0.3s;
    fill: none;
}

.usv-animation-wrapper .ac-line {
    stroke: var(--usv-color-ac);
}

.usv-animation-wrapper .dc-line {
    stroke: var(--usv-color-dc);
}

.usv-animation-wrapper .bypass-line {
    stroke: var(--usv-color-bypass);
}

.usv-animation-wrapper .path-group.active .flow-line {
    opacity: var(--usv-active-opacity);
    stroke-width: 4;
    stroke-dasharray: 10, 10;
    animation: usvFlowMovement 1.5s linear infinite;
}

.usv-animation-wrapper .path-group.active-reverse .flow-line {
    opacity: var(--usv-active-opacity);
    stroke-width: 4;
    stroke-dasharray: 10, 10;
    animation: usvFlowMovementReverse 1.5s linear infinite;
}

.usv-animation-wrapper .path-group.static-active .flow-line {
    opacity: 1 !important;
    stroke-width: 3.5 !important;
    animation: none !important;
    stroke-dasharray: none !important;
}

.usv-animation-wrapper .flow-line.static-active-line {
    opacity: 1 !important;
    stroke-width: 3.5 !important;
    animation: none !important;
}

@keyframes usvFlowMovement {
    to {
        stroke-dashoffset: -20;
    }
}

@keyframes usvFlowMovementReverse {
    to {
        stroke-dashoffset: 20;
    }
}

/* Components & Nodes */
.usv-animation-wrapper .node-shape {
    fill: var(--usv-node-fill);
    stroke: var(--usv-node-border);
    stroke-width: 2.2;
}

.usv-animation-wrapper .symbol-line {
    stroke: var(--usv-node-border);
}

.usv-animation-wrapper .node-label {
    font-size: 14px;
    fill: var(--usv-node-text);
    text-anchor: middle;
}

.usv-animation-wrapper .node-label.font-bold {
    font-weight: 700;
}

.usv-animation-wrapper .node-label-sub {
    font-size: 10px;
    fill: var(--usv-node-text-sub);
    text-anchor: middle;
}

.usv-animation-wrapper .battery-sign {
    font-size: 13px;
    font-weight: bold;
    fill: var(--usv-node-text-sub);
    text-anchor: middle;
}

.usv-animation-wrapper .node-terminal {
    fill: var(--usv-bg-main);
    stroke: var(--usv-node-border);
    stroke-width: 1.5;
}

.usv-animation-wrapper .marker-blue {
    fill: var(--usv-color-ac);
}

.usv-animation-wrapper .marker-red {
    fill: var(--usv-color-dc);
}

.usv-animation-wrapper .marker-orange {
    fill: var(--usv-color-bypass);
}

.usv-animation-wrapper .legend-border {
    fill: var(--usv-node-fill);
    stroke: var(--usv-border);
    stroke-width: 1.5;
}

.usv-animation-wrapper .legend-text {
    font-size: 13px;
    font-weight: 600;
    fill: var(--usv-node-text);
}

.usv-animation-wrapper .legend-line.ac {
    stroke: var(--usv-color-ac);
}

.usv-animation-wrapper .legend-line.dc {
    stroke: var(--usv-color-dc);
}

.usv-animation-wrapper .legend-line.bypass {
    stroke: var(--usv-color-bypass);
}

.usv-animation-wrapper .junction-dots circle {
    fill: var(--usv-node-border);
    stroke: var(--usv-node-fill);
    stroke-width: 1.5;
}

.usv-animation-wrapper .switch-dot {
    fill: var(--usv-node-fill);
    stroke: var(--usv-node-border);
    stroke-width: 2.2;
}

.usv-animation-wrapper .switch-lever {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-linecap: round;
}

.usv-animation-wrapper .switch-lever.bypass {
    stroke: var(--usv-color-bypass);
    transform-origin: 520px 80px;
}

.usv-animation-wrapper .switch-lever.eue {
    stroke: var(--usv-node-text);
    transform-origin: 550px 210px;
}

.usv-animation-wrapper .switch-text {
    font-size: 13px;
    font-weight: 600;
    fill: var(--usv-node-text);
    text-anchor: middle;
}

.usv-animation-wrapper .switch-clickable {
    cursor: pointer;
}

.usv-animation-wrapper .switch-clickable:hover .switch-dot {
    fill: var(--usv-bg-main);
    r: 5.5;
}

.usv-animation-wrapper .led-dot.green {
    fill: var(--usv-color-success);
}

.usv-animation-wrapper .led-dot.red {
    fill: var(--usv-color-dc);
}

.usv-animation-wrapper .flow-line.ac-direct-line {
    stroke: var(--usv-color-ac);
}

.usv-animation-wrapper .flow-line.charge-dc-line {
    stroke: #e65100;
}

.usv-animation-wrapper .flow-line.batt-inv-line {
    stroke: #2e7d32;
}

/* Classic Control Bar */
.usv-animation-wrapper .classic-control-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    max-width: 1050px;
    margin-top: 1.5rem;
    padding: 0.85rem 1.25rem;
    background: #F9FAFB;
    border: 1px solid var(--usv-border);
    border-radius: 10px;
    flex-wrap: wrap;
    transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1), transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Scroll Reveal Initial & Visible State */
.usv-animation-wrapper .classic-control-bar.scroll-reveal {
    opacity: 0;
    transform: scaleX(0.2);
    transform-origin: center center;
}

.usv-animation-wrapper .classic-control-bar.scroll-reveal.is-visible {
    opacity: 1;
    transform: scaleX(1);
}

.usv-animation-wrapper .bar-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    width: 100%;
}

.usv-animation-wrapper .bar-buttons {
    display: flex;
    justify-content: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.usv-animation-wrapper .bar-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid var(--usv-border);
    border-radius: 6px;
    color: var(--usv-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.usv-animation-wrapper .bar-btn:hover {
    background: #e2e8f0;
    color: var(--usv-text-primary);
}

.usv-animation-wrapper .bar-btn.active {
    background: var(--usv-color-ac);
    border-color: var(--usv-color-ac);
    color: white;
}

.usv-animation-wrapper .bar-separator {
    width: 1px;
    height: 28px;
    background: var(--usv-border);
}

@media (max-width: 768px) {
    .usv-animation-wrapper .tab-header-bar {
        padding: 0.35rem 0.35rem 0 0.35rem;
        gap: 0.25rem;
    }

    .usv-animation-wrapper .tab-header-bar .tab-btn {
        padding: 0.65rem 0.25rem;
        font-size: 0.82rem;
        border-top-left-radius: 6px;
        border-top-right-radius: 6px;
        white-space: normal;
        line-height: 1.25;
    }

    .tab-label-full {
        display: none;
    }

    .tab-label-short {
        display: inline;
    }
}

@media (max-width: 900px) {
    .usv-animation-wrapper .usv-card-body {
        padding: 1.25rem 1rem;
    }

    .usv-animation-wrapper .classic-control-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
    }

    .usv-animation-wrapper .bar-separator {
        width: 100%;
        height: 1px;
    }

    .usv-animation-wrapper .bar-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .usv-animation-wrapper .bar-buttons {
        width: 100%;
    }

    .usv-animation-wrapper .bar-btn {
        flex-grow: 1;
        justify-content: center;
    }
}