@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --font-main: 'Inter', system-ui, sans-serif;
    --color-primary: #6b7280;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-border: #e5e7eb;
    --color-bg-header: #f9fafb;
    --color-tab-active: #2563eb;
    --color-success: #059669;
    --color-danger: #dc2626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: #f9fafb;
    line-height: 1.6;
    color: var(--color-text);
}

.header {
    background: white;
    border-bottom: 1px solid var(--color-border);
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-light);
    transition: all 0.2s ease;
}

.tab:hover {
    border-color: var(--color-tab-active);
    color: var(--color-tab-active);
}

.tab.active {
    background: var(--color-tab-active);
    border-color: var(--color-tab-active);
    color: white;
}

/* Content */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Table Styles */
/*
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 8px;
    background: white;
}
*/


/* 1. DER WRAPPER: Er bestimmt, wie groß der scrollbare Bereich ist */
.table-wrapper {
	  display: flex;
    flex-direction: column; /* Stapelt den Inhalt vertikal */
    max-height: 1200px;     /* Begrenzt die Höhe des sichtbaren Bereichs */
    overflow: auto;         /* Reicht aus für beide Richtungen */
    border: 1px solid #ccc;
    border-radius: 8px;
    /*margin-top: 0; */     /* nicht erforderlich */
    /*position: relative;*/   /* Hilft bei der Positionierung */
}

/* 2. DIE TABELLE: Muss "separate" sein für sauberes Sticky */
table {
    margin-top: 0 !important;
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
    background: white;
    font-size: 0.9rem;
}

/* 3. DIE TH-ELEMENTE: Nur hier gehört position: sticky hin */
.table-wrapper th {
    position: sticky;
    top: -1px;               /* Klebt direkt am oberen Rand des Wrappers */
    z-index: 10;
    background-color: white; /* WICHTIG: damit Zeilen dahinter verschwinden */
    
    /* Design-Vorgaben */
    font-weight: 600;
    text-align: left;
    padding: 12px 10px;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text);
    font-size: 0.85rem;
    white-space: nowrap;
    
    /* Schatten für den Effekt beim Scrollen */
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

.table-wrapper table {
    margin: 0;
}


/* 4. DIE ZELLEN: Normales Design */
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

tbody tr:hover {
    background: #f0f9ff;
}

.company-main {
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.company-sub {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.9rem;
    padding-left: 12px;
    margin-top: 4px;
}

.company-group {
    border-left: 3px solid var(--color-primary);
    padding-left: 8px;
}

.cell-comment {
    font-weight: 600;
    color: var(--color-primary);
}

.number {
    font-weight: 700;
    color: var(--color-text);
    font-size: 1rem;
}

.number-large {
    font-size: 1.1rem;
    color: var(--color-primary);
}

.date {
    font-weight: 600;
    white-space: nowrap;
    color: var(--color-text-light);
}

.card-date {
    font-size: 0.90rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--color-text);
}

.currency {
    font-weight: 600;
    color: var(--color-text);
}

.measures {
    font-size: 0.85rem;
    line-height: 1.6;
}

.program-name {
    font-weight: 600;
    color: var(--color-primary);
}

.detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.detail-list li {
    padding: 3px 0 3px 18px;
    position: relative;
    line-height: 1.5;
}

.detail-list li::before {
    content: "□";
    position: absolute;
    left: 0;
    color: var(--color-text-light);
    font-weight: 700;
}

.detail-sublist {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 12px;
}

.detail-sublist li {
    padding: 2px 0 2px 14px;
    position: relative;
}

.detail-sublist li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--color-text-light);
}

.footnote-ref {
    font-size: 0.75rem;
    vertical-align: super;
    color: #f59e0b;
    font-weight: 600;
}

.footnotes {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--color-bg-header);
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    font-size: 0.85rem;
}

.footnotes p {
    margin-bottom: 0.5rem;
}

.footnotes p:last-child {
    margin-bottom: 0;
}

.number[data-ignore] {
    color: #9ca3af !important;
    font-style: italic;
}

.number[data-ignore]::before {
    content: "[";
}

.number[data-ignore]::after {
    content: "]";
}

/* Insolvency specific styles */
.company-link {
    color: var(--color-tab-active);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

.company-link:hover {
    text-decoration: underline;
}

.detail-card {
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    scroll-margin-top: 100px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
    gap: 20px;
}

.card-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
    min-width: 40px;
}

.card-title-group {
    flex: 1;
}

.card-company {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.card-location {
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.card-status {
    text-align: right;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.status-badge.success {
    background: #dcfce7;
    color: #166534;
}

.status-badge.failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.ongoing {
    background: #dbeafe;
    color: #1e40af;
}

.status-reason {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

.card-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.meta-item {
    background: var(--color-bg-header);
    padding: 12px;
    border-radius: 6px;
}

.meta-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-light);
    margin-bottom: 4px;
}

.meta-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

.card-details {
    background: #f9fafb;
    padding: 16px;
    border-radius: 6px;
    border-left: 3px solid var(--color-primary);
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.back-button:hover {
    border-color: var(--color-tab-active);
    color: var(--color-tab-active);
    background: #f0f9ff;
}

.back-button::before {
    content: "←";
    font-size: 1.2rem;
}

.details-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text);
    margin-bottom: 10px;
}

.location {
    font-weight: 600;
    color: var(--color-text);
}

.product {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text-light);
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 1.2rem;
    }
    
    .tabs {
        gap: 6px;
    }
    
    .tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .card-header {
        flex-direction: column;
    }
    
    .card-status {
        text-align: left;
    }
}

/* Dashboard Styles */
#dashboard .dashboard-inner {
    background: linear-gradient(to br, #1a1a2e, #16213e, #0f3460);
    min-height: 100vh;
    padding: 2rem;
    margin: -20px;
}

#dashboard .dashboard-header {
    text-align: center;
    margin-bottom: 2rem;
}

#dashboard .dashboard-header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

#dashboard .dashboard-header p {
    color: #9ca3af;
    font-size: 1.1rem;
}

#dashboard .dashboard-header .data-count {
    color: #10b981;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

#dashboard .dash-tab-navigation {
    display: flex;
    gap: 0.5rem;
    background: #1f2937;
    padding: 0.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

#dashboard .dash-tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background: #374151;
    color: #d1d5db;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

#dashboard .dash-tab-btn:hover {
    background: #4b5563;
}

#dashboard .dash-tab-btn.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

#dashboard .content-area {
    max-width: 1200px;
    margin: 0 auto;
    background: #1f2937;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#dashboard .dash-content-section {
    display: none;
}

#dashboard .dash-content-section.active {
    display: block;
}

#dashboard .section-title {
    color: white;
    font-size: 1.75rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

#dashboard .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

#dashboard .stat-card {
    background: #374151;
    padding: 1.5rem;
    border-radius: 0.75rem;
}

#dashboard .stat-card.highlight {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

#dashboard .stat-card.highlight-red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

#dashboard .stat-label {
    color: #9ca3af;
    font-size: 0.875rem;
}

#dashboard .stat-value {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

#dashboard .chart-container {
    position: relative;
    height: 400px;
    margin-top: 1rem;
}

#dashboard .ranking-list {
    margin-top: 1rem;
}

#dashboard .ranking-item {
    background: #374151;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

#dashboard .ranking-number {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

#dashboard .ranking-number.top3 {
    background: #eab308;
}

#dashboard .ranking-number.normal {
    background: #4b5563;
}

#dashboard .ranking-info {
    flex: 1;
}

#dashboard .ranking-name {
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#dashboard .ranking-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    color: white;
}

#dashboard .ranking-badge.oem {
    background: #3b82f6;
}

#dashboard .ranking-badge.zulieferer {
    background: #ef4444;
}

#dashboard .ranking-value {
    color: #9ca3af;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

#dashboard .progress-bar-container {
    width: 12rem;
    background: #4b5563;
    border-radius: 9999px;
    height: 0.75rem;
}

#dashboard .progress-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s;
}

#dashboard .progress-bar.oem {
    background: #3b82f6;
}

#dashboard .progress-bar.zulieferer {
    background: #ef4444;
}

#dashboard .grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

#dashboard .card {
    background: #374151;
    border-radius: 0.75rem;
    padding: 1.5rem;
}

#dashboard .card-title {
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

#dashboard .heatmap-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

#dashboard .heatmap-box {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

#dashboard .heatmap-info {
    flex: 1;
    min-width: 0;
}

#dashboard .heatmap-label {
    color: white;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#dashboard .heatmap-bar-container {
    width: 100%;
    background: #4b5563;
    border-radius: 9999px;
    height: 0.5rem;
    margin-top: 0.25rem;
}

#dashboard .heatmap-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s;
}

#dashboard .legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

#dashboard .legend-gradient {
    display: flex;
    gap: 0.25rem;
}

#dashboard .legend-box {
    width: 2rem;
    height: 1rem;
    border-radius: 0.25rem;
}

#dashboard .dashboard-footer {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 1.5rem;
}
