/* CSS Design System for VERICON 1D */

/* Custom Properties for Light Mode (Default) */
:root {
    --bg-app: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: #4f46e5;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --input-bg: #f8fafc;
    --input-text: #0f172a;
    
    /* Brand Colors */
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --primary-color: #4f46e5;
    --secondary-bg: #e2e8f0;
    --secondary-hover: #cbd5e1;
    
    /* Alert Statuses */
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #0ea5e9;
    
    /* Layout Constants */
    --sidebar-width: 280px;
    --card-radius: 16px;
    --input-radius: 8px;
    --shadow-premium: 0 10px 25px -12px rgba(0, 0, 0, 0.1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Override */
[data-theme="dark"] {
    --bg-app: #0b0f19;
    --bg-sidebar: #111827;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #6366f1;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --input-bg: #1f2937;
    --input-text: #f8fafc;
    
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --primary-color: #6366f1;
    --secondary-bg: #1e293b;
    --secondary-hover: #334155;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    
    /* Brighter statuses for dark mode contrast */
    --color-success: #34d399;
    --color-danger: #f87171;
}

/* Global Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: var(--transition-smooth);
    line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* App Layout Grid */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    transition: var(--transition-smooth);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-logo {
    background: var(--primary-gradient);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
    color: #1e3a8a;
}

[data-theme="dark"] .brand-text h1 {
    color: #38bdf8;
}

.brand-text h1 span {
    color: var(--primary-color);
    font-size: 0.9rem;
    background: rgba(99, 102, 241, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 2px;
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sidebar-section {
    margin-bottom: 28px;
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 700;
}

.section-help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: -6px;
    margin-bottom: 14px;
}

/* Sidebar Controls */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-select, .form-input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--input-text);
    padding: 10px 12px;
    font-size: 0.875rem;
    border-radius: var(--input-radius);
    outline: none;
    transition: var(--transition-smooth);
    font-family: inherit;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-input:focus, .form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.spec-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

/* Sidebar Footer & Theme Toggle */
.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: var(--input-radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
    background-color: var(--secondary-hover);
}

.theme-toggle-icon {
    display: flex;
    align-items: center;
}

/* Toggle Sun/Moon display depending on theme */
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Main Area Layout */
.main-content {
    flex-grow: 1;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
    width: calc(100% - var(--sidebar-width));
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-title h1,
.header-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

.header-title p,
.header-title .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 10px 18px;
    border-radius: var(--input-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: inherit;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 10px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.btn-danger:hover {
    background-color: var(--color-danger);
    color: #ffffff;
}

.btn-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.btn-success:hover {
    background-color: var(--color-success);
    color: #ffffff;
}

/* Pulsing simulation button */
.btn-pulse {
    animation: btnPulse 2.5s infinite;
}

@keyframes btnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.6);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(99, 102, 241, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* Cards System */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.card {
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.card:hover {
    background-color: var(--bg-card-hover);
    border-color: rgba(99, 102, 241, 0.2);
}

.span-2 {
    grid-column: span 2;
}

.span-3 {
    grid-column: span 3;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.card-title h3 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Badges */
.badge {
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
}

.badge-info {
    background-color: rgba(14, 165, 233, 0.15);
    color: var(--color-info);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

/* Table Area Styles */
.table-card {
    display: flex;
    flex-direction: column;
}

.table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    min-height: 250px;
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--input-radius);
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.stackup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.stackup-table th, .stackup-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.stackup-table th {
    background-color: var(--input-bg);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.stackup-table tbody tr {
    transition: var(--transition-smooth);
}

.stackup-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Row animations */
.table-row-fade-in {
    animation: rowFadeIn 0.3s ease-out forwards;
}

@keyframes rowFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-row-fade-out {
    animation: rowFadeOut 0.25s ease-in forwards;
}

@keyframes rowFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Table inputs */
.table-input-name {
    font-weight: 500;
}

.table-select-sign, .table-select-sigma {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 8px 24px 8px 6px !important;
    background-position: right 6px center;
    text-align: center;
}

.table-select-sign {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.table-input-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 8px 6px !important;
    min-width: 80px;
}

.table-input-factor {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 8px 6px !important;
    min-width: 50px;
    text-align: center;
}

.cell-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.action-icon-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.action-icon-btn:hover {
    background-color: var(--secondary-bg);
    color: var(--text-primary);
}

.action-icon-btn.btn-delete-row:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}

.checkbox-custom {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    pointer-events: auto !important;
}

.row-inactive {
    opacity: 0.45;
}

.row-inactive input:not(.checkbox-custom), .row-inactive select {
    pointer-events: none;
}

/* Sensitivity Analysis Progress Bars */
.cell-influence {
    padding: 8px 12px;
}

.influence-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.influence-bar-bg {
    flex-grow: 1;
    height: 6px;
    background-color: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

[data-theme="dark"] .influence-bar-bg {
    background-color: rgba(255, 255, 255, 0.1);
}

.influence-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    border-radius: 3px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.influence-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 38px;
    text-align: right;
    color: var(--text-secondary);
}

.table-summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.summary-item {
    font-size: 0.95rem;
}

.summary-item span {
    color: var(--text-secondary);
    margin-right: 8px;
}

.summary-item strong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
}

#btnApplyNominal {
    padding: 4px 8px;
    font-size: 0.75rem;
    height: 24px;
    margin-left: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    vertical-align: middle;
    transition: var(--transition-smooth);
    font-family: inherit;
    font-weight: 500;
}

#btnApplyNominal:hover {
    background-color: var(--secondary-hover);
    color: var(--text-primary);
    border-color: var(--border-focus);
}

#btnApplyNominal.highlighted {
    background: linear-gradient(135deg, #6366f1 0%, #d946ef 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(217, 70, 239, 0.4);
    animation: applyPulse 1.8s infinite ease-in-out;
    font-weight: 600;
}

#btnApplyNominal.highlighted:hover {
    transform: scale(1.06) translateY(-1px);
    box-shadow: 0 6px 18px rgba(217, 70, 239, 0.6);
}

@keyframes applyPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(217, 70, 239, 0.7), 0 4px 14px rgba(217, 70, 239, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 8px rgba(217, 70, 239, 0), 0 6px 18px rgba(217, 70, 239, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(217, 70, 239, 0), 0 4px 14px rgba(217, 70, 239, 0.3);
    }
}

#btnApplyNominal svg {
    flex-shrink: 0;
}

/* Calculation Result Cards Details */
.result-card {
    position: relative;
    overflow: hidden;
    min-height: 170px;
    display: flex;
    flex-direction: column;
}

.result-card .status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    background-color: var(--text-muted);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transition: var(--transition-smooth);
}

/* Indicator states */
.status-pass .status-indicator {
    background-color: var(--color-success);
    box-shadow: 0 0 10px var(--color-success);
}

.status-fail .status-indicator {
    background-color: var(--color-danger);
    box-shadow: 0 0 10px var(--color-danger);
}

.status-warning .status-indicator {
    background-color: var(--color-warning);
    box-shadow: 0 0 10px var(--color-warning);
}

.result-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.result-val {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
    white-space: nowrap;
}

.result-span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 500;
}

.result-limits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-top: 12px;
    margin-bottom: 4px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.result-limits div {
    display: flex;
    flex-direction: column;
}

.result-limits span {
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.result-limits strong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Chart Canvas styling */
.chart-card {
    display: flex;
    flex-direction: column;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.legend-item {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

.bg-primary { background: var(--primary-gradient); }
.bg-success { background-color: var(--color-success); }
.bg-danger { background-color: var(--color-danger); }

.chart-container {
    position: relative;
    height: 320px;
    width: 100%;
    margin-top: 10px;
}

/* 2D Chain Visualization Card styling */
.visualization-card {
    display: flex;
    flex-direction: column;
}

#visualization-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
    background-color: var(--input-bg);
    border-radius: var(--input-radius);
    border: 1px solid var(--border-color);
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
}

#visualization-container svg {
    max-width: 100%;
    height: auto;
    display: block;
    user-select: none;
}

/* Explanations Grid */
.info-card {
    background-color: rgba(79, 70, 229, 0.04);
    border: 1px solid rgba(79, 70, 229, 0.15);
}

.info-card:hover {
    background-color: rgba(79, 70, 229, 0.08);
    border-color: rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] .info-card {
    background-color: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .info-card:hover {
    background-color: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.35);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px;
}

.info-col h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-col p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Utility alignments */
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Responsive adjustments */
@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .span-3 {
        grid-column: span 2;
    }
}

@media (max-width: 860px) {
    .app-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        border-top: none;
        padding: 20px 16px;
    }
    .main-content {
        width: 100%;
        padding: 20px 12px;
        min-width: 0;
    }
    .card {
        padding: 16px;
        min-width: 0;
    }
    .card-header {
        flex-wrap: wrap;
        gap: 12px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        width: 100%;
        min-width: 0;
    }
    .tab-view {
        width: 100%;
        min-width: 0;
    }
    .span-2, .span-3 {
        grid-column: span 1;
    }
    .info-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
    .header-actions button {
        flex-grow: 1;
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .nav-tabs {
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        margin-bottom: 16px;
    }
    .btn-tab {
        font-size: 0.95rem;
        padding: 4px 8px;
        white-space: nowrap;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    .stackup-table {
        min-width: 600px;
    }
    
    /* Collapsible Sidebar Sections */
    .sidebar-section {
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 12px;
        margin-bottom: 16px;
    }
    .sidebar-section:last-of-type {
        border-bottom: none;
        margin-bottom: 0;
    }
    .section-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        padding: 4px 0;
        margin: 0;
    }
    .section-title::after {
        content: '▼';
        font-size: 0.7rem;
        opacity: 0.5;
        transition: transform 0.2s ease;
    }
    .sidebar-section:not(.collapsed) .section-title::after {
        transform: rotate(180deg);
    }
    .sidebar-section > *:not(.section-title) {
        max-height: 500px;
        opacity: 1;
        overflow: hidden;
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    }
    .sidebar-section.collapsed > *:not(.section-title) {
        max-height: 0 !important;
        opacity: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        pointer-events: none;
    }

    /* Responsive Chart & Visualization heights */
    .chart-container,
    .chart-container canvas {
        height: 300px !important;
        position: relative;
        width: 100%;
    }
    #visualization-container {
        justify-content: flex-start !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
    }
    #visualization-container svg {
        min-width: 500px;
        max-width: 500px;
        width: 100%;
        height: auto !important;
    }
}/* Premium Fit Presets Grid & Chips */
.fit-presets-grid {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-fit-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: inherit;
}

.btn-fit-chip:hover {
    background-color: var(--bg-sidebar);
    border-color: var(--primary-color);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.btn-fit-chip svg {
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.btn-fit-chip .icon-spiel { color: var(--color-success); }
.btn-fit-chip .icon-uebergang { color: var(--color-warning); }
.btn-fit-chip .icon-press { color: var(--color-danger); }

.btn-fit-chip:hover svg {
    transform: scale(1.1);
}

/* Tab Navigation Styling */
.nav-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.btn-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 12px;
    margin-bottom: -11px;
    border-bottom: 3px solid transparent;
    transition: var(--transition-smooth);
    font-family: 'Outfit', sans-serif;
}

.btn-tab:hover {
    color: var(--text-primary);
}

.btn-tab.active {
    color: var(--text-primary);
    border-bottom: 3px solid var(--primary-color);
    font-weight: 700;
}

/* Screen wrapper for repeating print headers (has no layout impact on screen) */
.print-layout-table {
    display: block;
    width: 100%;
    border-collapse: collapse;
    border: none;
    margin: 0;
    padding: 0;
}
.print-layout-table > thead,
.print-layout-table > tbody,
.print-layout-table > thead > tr,
.print-layout-table > tbody > tr,
.print-layout-table > thead > tr > td,
.print-layout-table > tbody > tr > td {
    display: block;
    width: 100%;
    border: none;
    padding: 0;
    margin: 0;
}

/* PDF Printing Customizations */
.print-only {
    display: none;
}

@page {
    size: A4 portrait;
    margin: 0;
}

@media print {
    .no-print,
    .sidebar,
    .main-header,
    .sidebar-footer,
    .table-actions-bottom,
    #btnApplyNominal,
    #btnCalculate,
    #themeToggle {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }

    body {
        margin: 0 !important;
        padding: 0 10mm 15mm 10mm !important;
        background-color: #ffffff !important;
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 9pt;
        line-height: 1.3;
        font-family: Arial, Helvetica, sans-serif !important;
    }

    .print-report-header {
        padding-top: 15mm !important;
    }


    svg text, text {
        font-family: Arial, Helvetica, sans-serif !important;
    }

    .app-container {
        display: block;
        background: #ffffff !important;
    }

    .main-content {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
        background: #ffffff !important;
    }

    .dashboard-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px !important;
        background: #ffffff !important;
    }

    .span-3 {
        grid-column: span 3 !important;
    }

    .card {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        padding: 12px !important;
        border-radius: 8px !important;
    }

    .card-header {
        margin-bottom: 10px !important;
        padding-bottom: 6px !important;
        border-bottom: 1px solid #cbd5e1 !important;
    }

    .table-responsive {
        max-height: none !important;
        overflow-y: visible !important;
        margin-bottom: 8px !important;
        border: 1px solid #cbd5e1 !important;
    }

    .stackup-table {
        page-break-inside: auto !important;
    }

    .stackup-table tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .stackup-table th, .stackup-table td {
        padding: 6px 8px !important;
        font-size: 8.5pt !important;
        border: 1px solid #cbd5e1 !important;
    }

    .stackup-table th {
        background-color: #f1f5f9 !important;
        color: #000000 !important;
    }

    .stackup-table td {
        color: #000000 !important;
    }

    .stackup-table input, .stackup-table select {
        border: none !important;
        background: transparent !important;
        color: #000000 !important;
        padding: 0 !important;
        font-size: 8.5pt !important;
        box-shadow: none !important;
        outline: none !important;
        width: 100%;
    }

    /* Hide standard dropdown arrows in select elements */
    .stackup-table select {
        appearance: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        background-image: none !important;
        padding-right: 0 !important;
        text-align: center;
        text-align-last: center;
    }

    /* Hide spin buttons for input type=number in print */
    .stackup-table input[type="number"]::-webkit-outer-spin-button,
    .stackup-table input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    .stackup-table input[type="number"] {
        -moz-appearance: textfield;
    }

    .table-summary-bar {
        display: none !important;
    }

    /* Print results layout - three cards side-by-side */
    .result-card {
        min-height: auto !important;
        padding: 10px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .result-val {
        font-size: 1.1rem !important;
        margin-bottom: 2px !important;
        font-weight: 700 !important;
        white-space: normal !important;
        word-break: break-word !important;
    }

    .result-span {
        font-size: 0.75rem !important;
        margin-bottom: 6px !important;
    }

    .result-limits {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 2px !important;
        padding-top: 6px !important;
        margin-bottom: 0 !important;
        font-size: 0.72rem !important;
        border-top: 1px solid #cbd5e1 !important;
    }

    .result-limits strong {
        font-size: 0.78rem !important;
        white-space: normal !important;
        word-break: break-all !important;
    }

    .chart-container {
        height: 220px !important;
        margin-top: 6px !important;
    }

    .chart-container canvas {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
    }

    #visualization-container {
        padding: 8px !important;
        background: none !important;
        border: 1px solid #cbd5e1 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    #visualization-container svg {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
    }

    /* Adjust legend for print */
    .legend-color {
        border: 1px solid #000;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Print headers and footers */
    .print-report-header {
        margin-bottom: 12px;
    }

    .print-header-grid {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
    }

    .print-header-grid > div:first-child {
        flex: 1 1 auto;
        min-width: 0;
    }

    .print-header-grid > div:last-child {
        flex: 0 0 auto;
        text-align: right;
    }

    .print-header-grid h2 {
        font-size: 1.4rem !important;
        margin: 0 0 2px 0 !important;
    }

    .print-header-grid h3 {
        font-size: 0.95rem !important;
        margin: 0 !important;
        text-align: right !important;
        white-space: nowrap !important;
        hyphens: none !important;
    }


    hr {
        border: 0;
        border-top: 1px solid #cbd5e1;
        margin: 6px 0;
    }

    /* Print-specific style for progress bars & indicators */
    .status-indicator,
    .badge {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .influence-bar-bg {
        background-color: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .influence-bar-fill {
        background: #7c3aed !important;
        background-color: #7c3aed !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .influence-text {
        color: #000000 !important;
        font-size: 8pt !important;
    }

    /* Repeating header logic for PDF print */
    .print-layout-table {
        display: table !important;
        width: 100% !important;
        border-collapse: collapse !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .print-layout-table > thead {
        display: table-header-group !important;
    }
    .print-layout-table > tbody {
        display: table-row-group !important;
    }
    .print-layout-table > thead > tr,
    .print-layout-table > tbody > tr {
        display: table-row !important;
    }
    .print-layout-table > thead > tr > td,
    .print-layout-table > tbody > tr > td {
        display: table-cell !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* ============================================================
   Thermische Überlastungswarnung für Werkstoffe
   ============================================================ */
.material-thermal-danger {
    border-color: var(--color-danger) !important;
    background-color: rgba(239, 68, 68, 0.08) !important;
    color: var(--color-danger) !important;
    font-weight: 600;
    animation: pulseBorder 2s infinite ease-in-out;
}

[data-theme="dark"] .material-thermal-danger {
    background-color: rgba(248, 113, 113, 0.12) !important;
}

@keyframes pulseBorder {
    0%   { box-shadow: 0 0 0 0   rgba(239, 68, 68, 0.4); }
    70%  { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);   }
    100% { box-shadow: 0 0 0 0   rgba(239, 68, 68, 0);   }
}
