/* ==========================================================================
   MORPH ANIMATION: Excel Chaos -> i-doit CMDB
   Page-specific styles for /it-dokumentation-komplett-strategie
   ========================================================================== */

/* --- Scroll Container & Sticky Viewport --- */

.morph-section {
    padding-bottom: 0;
}

.morph-scroll-container {
    height: 250vh;
    position: relative;
}

.morph-viewport {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.morph-viewport-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- Animation Stage --- */

.morph-stage {
    position: relative;
    width: 100%;
    max-width: 1280px;
    height: 640px;
    margin: 0 auto;
}

/* --- Phase Text --- */

.morph-phase-text {
    position: absolute;
    top: var(--donamic-space-xl, 2rem);
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.morph-phase {
    position: absolute;
    width: 100%;
    opacity: 0;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--donamic-text-muted, #888);
    font-family: var(--font-family-sans, 'Instrument Sans', system-ui, sans-serif);
    margin: 0;
    padding: 0 var(--donamic-space-lg, 1.5rem);
    transition: opacity 0.3s ease;
}

.morph-phase.active {
    opacity: 1;
}

/* ==========================================================================
   EXCEL CARD (Windows 11 style)
   ========================================================================== */

.morph-excel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 500px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    will-change: transform, opacity;
    font-family: 'Segoe UI', system-ui, sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Excel green toolbar (Windows 11 style) */
.morph-excel-toolbar {
    background: #217346;
    padding: 0;
    display: flex;
    align-items: center;
    height: 32px;
}

/* Small Excel "X" icon on the left */
.morph-excel-toolbar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-weight: 700;
    font-family: 'Segoe UI', sans-serif;
    flex-shrink: 0;
}

/* File name: left-aligned, clearly readable */
.morph-excel-title {
    color: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    padding-right: 8px;
}

/* Windows title bar buttons (minimize, maximize, close) */
.morph-excel-toolbar-btns {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: auto;
}

.morph-excel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 100%;
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    line-height: 1;
}

.morph-excel-btn-close {
    background: transparent;
}

/* Ribbon bar hint (thin strip below toolbar) */
.morph-excel::after {
    content: '';
    display: block;
    height: 0;
}

/* Column headers (A, B, C, D) */
.morph-excel-header-row {
    display: grid;
    grid-template-columns: 36px repeat(4, 1fr);
    background: #f3f3f3;
    border-bottom: 1px solid #d4d4d4;
}

.morph-excel-col-header {
    text-align: center;
    padding: 4px 6px;
    font-size: 12px;
    color: #666;
    border-right: 1px solid #d4d4d4;
}

.morph-excel-row-num {
    text-align: center;
    padding: 5px 6px;
    font-size: 11px;
    color: #888;
    background: #f3f3f3;
    border-right: 1px solid #d4d4d4;
}

/* Data rows */
.morph-excel-row {
    display: grid;
    grid-template-columns: 36px repeat(4, 1fr);
    border-bottom: 1px solid #e5e5e5;
}

.morph-excel-cell {
    padding: 6px 10px;
    font-size: 13px;
    color: #333;
    border-right: 1px solid #e5e5e5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.morph-excel-cell-header {
    font-weight: 600;
    background: #f8f8f8;
}

/* Problematic data rows */
.morph-excel-row-faded {
    background: #fff5f5;
}

.morph-excel-row-faded .morph-excel-cell {
    color: #cc4444;
}

/* Bottom sheet tabs */
.morph-excel-tabs {
    display: flex;
    background: #f3f3f3;
    border-top: 1px solid #d4d4d4;
}

.morph-excel-tab {
    padding: 5px 14px;
    font-size: 11px;
    color: #666;
    border-right: 1px solid #d4d4d4;
}

.morph-excel-tab-active {
    background: #ffffff;
    color: #217346;
    font-weight: 600;
    border-bottom: 2px solid #217346;
}

/* ==========================================================================
   BROWSER CHROME (Windows 11 style, wraps i-doit CMDB)
   ========================================================================== */

.morph-cmdb {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: 920px;
    max-width: 94vw;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3), 0 0 80px rgba(99, 229, 38, 0.12);
    overflow: hidden;
    opacity: 0;
    will-change: transform, opacity;
    font-family: 'Segoe UI', system-ui, sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Browser title bar with tab */
.morph-browser-titlebar {
    background: #202020;
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0;
}

.morph-browser-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #333;
    height: 28px;
    margin: 8px 0 0 8px;
    padding: 0 14px;
    border-radius: 8px 8px 0 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.morph-browser-tab-favicon {
    flex-shrink: 0;
}

.morph-browser-titlebar-btns {
    display: flex;
    align-items: center;
    height: 100%;
    margin-left: auto;
}

.morph-browser-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 100%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    line-height: 1;
}

.morph-browser-btn-close {
    background: transparent;
}

/* Browser navigation bar (address bar) */
.morph-browser-navbar {
    background: #333;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px 8px;
    height: 36px;
}

.morph-browser-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    flex-shrink: 0;
}

.morph-browser-address {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 4px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    overflow: hidden;
    white-space: nowrap;
}

.morph-browser-lock {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   i-doit APPLICATION (inside browser)
   ========================================================================== */

/* i-doit top navigation bar */
.morph-cmdb-topbar {
    background: #3c3c3c;
    padding: 0 12px;
    display: flex;
    align-items: center;
    height: 40px;
    gap: 0;
}

.morph-cmdb-logo {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    margin-right: 20px;
}

.morph-cmdb-logo-icon {
    font-size: 22px;
    font-weight: 700;
    font-style: italic;
    font-family: 'Arial', sans-serif;
    letter-spacing: -0.5px;
}

/* "i-do" in white/light, "it" in i-doit red */
.morph-cmdb-logo-ido {
    color: rgba(255, 255, 255, 0.95);
}

.morph-cmdb-logo-it {
    color: #e8573a;
}

.morph-cmdb-nav-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    height: 100%;
}

.morph-cmdb-nav-tab {
    padding: 0 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.morph-cmdb-nav-tab-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    font-weight: 500;
}

.morph-cmdb-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.morph-cmdb-search {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    width: 130px;
}

.morph-cmdb-user {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    white-space: nowrap;
}

/* Breadcrumb bar */
.morph-cmdb-breadcrumb-bar {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.morph-cmdb-breadcrumb {
    font-size: 12px;
    color: #666;
}

.morph-cmdb-breadcrumb a {
    color: #2980b9;
    text-decoration: none;
}

/* Layout: Sidebar + Main */
.morph-cmdb-layout {
    display: flex;
    min-height: 320px;
}

/* Sidebar - tree navigation */
.morph-cmdb-sidebar {
    width: 180px;
    background: #fff;
    border-right: 1px solid #ddd;
    padding: 6px 0;
    flex-shrink: 0;
    overflow: hidden;
}

.morph-cmdb-sidebar-header {
    padding: 4px 10px 6px;
    border-bottom: 1px solid #eee;
    margin-bottom: 4px;
}

.morph-cmdb-sidebar-select {
    font-size: 11px;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px 6px;
    width: 100%;
}

.morph-cmdb-tree-item {
    padding: 4px 10px 4px 20px;
    font-size: 12px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    overflow: hidden;
}

.morph-cmdb-tree-item-active {
    background: #e8f4e8;
    color: #217346;
    font-weight: 600;
}

.morph-cmdb-tree-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.morph-cmdb-tree-dot-green { background: #4caf50; }
.morph-cmdb-tree-dot-blue { background: #2196f3; }
.morph-cmdb-tree-dot-gray { background: #9e9e9e; }
.morph-cmdb-tree-dot-orange { background: #ff9800; }
.morph-cmdb-tree-dot-purple { background: #9c27b0; }

.morph-cmdb-tree-count {
    color: #999;
    font-weight: 400;
    margin-left: 2px;
}

/* Main content area */
.morph-cmdb-main {
    flex: 1;
    background: #fff;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Title bar with actions */
.morph-cmdb-title-bar {
    padding: 10px 14px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.morph-cmdb-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.morph-cmdb-action-btn {
    font-size: 10px;
    padding: 3px 8px;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 3px;
}

.morph-cmdb-action-btn-primary {
    background: #4a90d9;
    border-color: #4a90d9;
    color: #fff;
}

.morph-cmdb-view-select {
    margin-left: auto;
    font-size: 10px;
    padding: 3px 8px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    color: #555;
}

/* Object table */
.morph-cmdb-table-wrap {
    flex: 1;
    padding: 0;
}

.morph-cmdb-table {
    width: 100%;
    border-collapse: collapse;
}

.morph-cmdb-table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 2.5fr 1.2fr 1fr;
    background: #fafafa;
    padding: 7px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #ddd;
}

.morph-cmdb-table-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 2.5fr 1.2fr 1fr;
    padding: 6px 12px;
    font-size: 11px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
}

.morph-cmdb-table-row:nth-child(even) {
    background: #fafcff;
}

.morph-cmdb-table-row:last-child {
    border-bottom: none;
}

.morph-cmdb-obj-link {
    color: #2980b9;
    font-weight: 500;
}

.morph-cmdb-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 400;
    color: #555;
}

.morph-cmdb-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.morph-cmdb-status-dot-green { background: #4caf50; }
.morph-cmdb-status-dot-orange { background: #ff9800; }

.morph-cmdb-location {
    color: #666;
    font-size: 10px;
}

/* Footer bar */
.morph-cmdb-footer {
    font-size: 10px;
    color: #888;
    padding: 6px 12px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

/* --- Progress Indicator --- */

.morph-progress {
    position: absolute;
    bottom: var(--donamic-space-xl, 2rem);
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.morph-progress-bar {
    height: 100%;
    background: var(--donamic-primary, #63E526);
    border-radius: 2px;
    width: 0%;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1200px) {
    .morph-excel {
        width: 440px;
    }

    .morph-stage {
        max-width: 1100px;
    }
}

@media (max-width: 1024px) {
    .morph-excel {
        width: 380px;
    }

    .morph-stage {
        max-width: 900px;
        height: 560px;
    }

    .morph-cmdb {
        width: 800px;
    }
}

@media (max-width: 900px) {
    .morph-scroll-container {
        height: 220vh;
    }

    .morph-stage {
        max-width: 740px;
        height: 500px;
    }

    .morph-excel {
        width: 320px;
    }

    .morph-cmdb {
        width: 700px;
    }

    .morph-cmdb-sidebar {
        width: 140px;
    }

    .morph-cmdb-nav-tab {
        font-size: 10px;
        padding: 0 6px;
    }

    .morph-cmdb-search {
        width: 80px;
    }

    .morph-cmdb-user {
        display: none;
    }
}

/* Mobile: hide the entire morph animation */
@media (max-width: 768px) {
    .morph-section .morph-scroll-container {
        display: none;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .morph-scroll-container {
        height: auto;
    }

    .morph-viewport {
        position: relative;
        height: auto;
        padding: var(--donamic-space-xl, 2rem) 0;
    }

    .morph-stage {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--donamic-space-md, 1rem);
        height: auto;
    }

    .morph-excel {
        position: relative;
        width: 100%;
        max-width: 500px;
    }

    .morph-cmdb {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        opacity: 1;
        width: 100%;
        max-width: 920px;
        margin-top: var(--donamic-space-lg, 1.5rem);
    }

    .morph-phase-text {
        display: none;
    }

    .morph-progress {
        display: none;
    }
}
