/* V5/css/main.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

.card {
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.card-header {
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

/* Custom Tooltip */
.tooltip {
    position: relative;
    display: inline;
}
.tooltip:hover:after {
    content: attr(data-tooltip);
    position: absolute;
    background: #333;
    color: #fff;
    padding: 5px;
    border-radius: 5px;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

/* Content Toggle Buttons */
.expand-btn, .collapse-btn {
    color: #0d6efd !important;
    text-decoration: underline !important;
    cursor: pointer !important;
    border: none !important;
    background: none !important;
    padding: 0 !important;
    font-size: inherit !important;
}

.expand-btn:hover, .collapse-btn:hover {
    color: #0a58ca !important;
    text-decoration: underline !important;
}

/* Read Aloud Buttons */
.read-aloud-btn {
    transition: all 0.2s ease;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.read-aloud-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.read-aloud-btn:disabled {
    opacity: 0.6;
    transform: none;
    cursor: not-allowed;
}

.read-aloud-btn i {
    font-size: 14px;
}

/* Speaking state - stop button */
.read-aloud-btn.speaking {
    animation: pulse-speaking 1.5s ease-in-out infinite;
}

.read-aloud-btn.speaking:hover {
    transform: scale(1.1);
    animation: none;
}

@keyframes pulse-speaking {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Tree View Styles */
.tree-view-container {
    margin-top: 1rem;
}

.tree-structure {
    padding: 1rem 0;
}

.tree-node {
    margin: 0.25rem 0;
}

.tree-level-1 {
    margin-left: 0;
}

.tree-level-2 {
    margin-left: 1.5rem;
    border-left: 2px solid #e9ecef;
    padding-left: 1rem;
}

.tree-level-3 {
    margin-left: 1.5rem;
    border-left: 2px solid #dee2e6;
    padding-left: 1rem;
}

.tree-level-4 {
    margin-left: 1.5rem;
    border-left: 1px solid #f8f9fa;
    padding-left: 1rem;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.tree-item:hover {
    background-color: #f8f9fa;
}

.tree-level-1 > .tree-item {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    font-weight: 600;
}

.tree-level-2 > .tree-item {
    background-color: #ffffff;
    border: 1px solid #e9ecef;
}

.tree-level-3 > .tree-item {
    background-color: #fefefe;
}

.tree-alert {
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 0.5rem 0;
}

.tree-alert:hover {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1);
}

.tree-toggle {
    color: #6c757d !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
    min-width: 20px;
}

.tree-toggle:hover {
    color: #0d6efd !important;
}

.tree-icon {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.tree-headline {
    color: #212529;
    font-size: 0.95rem;
    line-height: 1.4;
}

.tree-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tree-details {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f3f4;
}

.tree-description-toggle,
.tree-instruction-toggle {
    color: #0d6efd !important;
    text-decoration: none !important;
    font-size: 0.875rem;
}

.tree-description-toggle:hover,
.tree-instruction-toggle:hover {
    color: #0a58ca !important;
    text-decoration: underline !important;
}

.tree-description,
.tree-instruction {
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    border-left: 3px solid #0d6efd;
}

.tree-instruction {
    border-left-color: #17a2b8;
    background-color: #e7f3ff;
}

.tree-children {
    margin-top: 0.5rem;
}

/* Responsive Tree View */
@media (max-width: 768px) {
    .tree-level-2,
    .tree-level-3,
    .tree-level-4 {
        margin-left: 1rem;
        padding-left: 0.5rem;
    }
    
    .tree-alert {
        padding: 0.75rem;
    }
    
    .tree-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .tree-headline {
        font-size: 0.9rem;
    }
}

.collapsible-content {
    max-width: 100%;
}

.content-short, .content-full {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Toggle Switch from table.css */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* KI-Lagebild (MOWAS / Polizei) */
.lagebild-card {
    border: 1px solid var(--border-color, #dee2e6);
}

.lagebild-stat-card .h4 {
    color: var(--text-primary, #212529);
    font-weight: 600;
}

.lagebild-content {
    color: var(--text-primary, #212529);
    line-height: 1.55;
    max-width: 52rem;
}

.lagebild-content .lagebild-h {
    margin: 1.25rem 0 0.5rem;
    font-weight: 600;
    color: var(--text-primary, #212529);
}

.lagebild-content .lagebild-h:first-child {
    margin-top: 0;
}

.lagebild-content .lagebild-p {
    margin-bottom: 0.65rem;
}

.lagebild-content .lagebild-list {
    margin: 0.25rem 0 0.75rem 1.25rem;
    padding-left: 0.5rem;
}

.lagebild-content .lagebild-list li {
    margin-bottom: 0.35rem;
}

.lagebild-content .lagebild-hr {
    margin: 1rem 0;
    border-color: var(--border-color, #dee2e6);
    opacity: 0.7;
}

.lagebild-content em {
    color: var(--text-secondary, #6c757d);
    font-size: 0.95em;
}

/* SEO: Breadcrumbs & Footer */
.seo-breadcrumbs .breadcrumb {
    background: transparent;
    padding-left: 0;
}

.site-footer {
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-primary, #212529);
}

.site-footer .nav-link {
    color: var(--text-secondary, #6c757d);
}

.site-footer .nav-link:hover {
    color: var(--accent-primary, #667eea);
}

.site-disclaimer {
    background: var(--bg-secondary, #f8f9fa);
    border-bottom: 1px solid var(--border-color, #dee2e6);
    padding: 0.5rem 0;
}

.site-disclaimer__text {
    font-size: 0.8125rem;
    color: var(--text-secondary, #6c757d);
    line-height: 1.45;
}

.site-disclaimer a {
    font-weight: 600;
}

.theme-matrix .site-disclaimer {
    background: #0a0a0a;
    border-bottom-color: #006600;
}

.theme-matrix .site-disclaimer__text {
    color: #00cc00;
}

.theme-matrix .site-disclaimer a {
    color: #00ff00;
}

.lagebild-subtitle {
    margin-top: 0.15rem;
}

.lagebild-ki-details {
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    background: var(--bg-secondary, #f8f9fa);
}

.lagebild-ki-details summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary, #212529);
}

.lagebild-footer-note a {
    font-weight: 600;
}

.theme-matrix .lagebild-ki-details {
    background: #111;
    border-color: #006600;
}

.page-intro h1 {
    color: var(--text-primary, #212529);
}

@media print {
    .professional-navbar,
    .nav-toolbar,
    .site-disclaimer,
    .auto-refresh-bar,
    .site-footer,
    #loadingOverlay,
    .no-print {
        display: none !important;
    }

    #main-content {
        margin: 0;
        padding: 0;
    }

    a[href]::after {
        content: none !important;
    }

    .card,
    .table {
        break-inside: avoid;
    }
}

@media (max-width: 767.98px) {
    body {
        overflow-x: hidden;
    }

    .container-fluid {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }

    .site-disclaimer__text {
        font-size: 0.75rem;
        line-height: 1.35;
    }

    .page-intro h1,
    .page-intro .h3 {
        font-size: 1.25rem;
    }

    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 575.98px) {
    .professional-navbar .brand-tagline {
        display: none !important;
    }
}
