:root {
    --primary-color: #0056b3; /* Behörden-Blau */
    --primary-hover: #004494; /* Dunklere Variante für Hover-Zustände */
    --secondary-color: #f4f6f8;
    --text-color: #333;
    --border-color: #ddd;
    --hover-color: #e9ecef;
    --disabled-color: #999;

    /* IBM Design Language Palette for Accessibility */
    --color-sl: #648FFF;      /* Ultramarine - Schulleitung */
    --color-aufsicht: #785EF0; /* Indigo - Aufsicht */
    --color-sb: #DC267F;       /* Magenta - Sachbearbeitung */
    --color-zpm: #FE6100;      /* Orange - ZPM */
    --color-hotspot: #FF4500;  /* Sattes Orange-Rot - Hotspots/Pfeile */
}

html {
    overflow-y: scroll; /* Force scrollbar to prevent layout shift */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background-color: var(--secondary-color);
}

.container {
    max-width: 1200px; /* Wider container for better image visibility */
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.main-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.main-header .container {
    position: relative; /* Anchor for absolute logo */
    display: flex;      /* Keep flex for vertical alignment of text if needed */
    align-items: center;
    min-height: 80px;   /* Reserve height for logo */
}

.header-content {
    /* display: flex; removed, handled by container */
    /* justify-content: space-between; removed */
    width: 100%;
}

.main-header h1 {
    margin: 0;
    font-size: 1.8rem;
    padding-right: 100px; /* Prevent text from overlapping logo */
}

.header-titles {
    /* flex-grow: 1; removed */
}

.header-logo-container {
    position: absolute;
    top: 15px; /* Fixed distance from top */
    right: 20px;
    /* transform: translateY(-50%); REMOVED vertical centering */
    text-align: center;
    margin-left: 0;
    z-index: 10;
}

.header-logo {
    height: 60px;
    width: auto;
    display: block;
    margin: 0 auto 5px auto;
    background: white; 
    padding: 5px;
    border-radius: 4px;
}

.logo-text {
    font-size: 0.8rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.subtitle {
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Process List */
.process-list {
    background: transparent;
    border-radius: 8px;
    box-shadow: none;
    overflow: visible;
}

/* Accordion Styling */
details.category-group {
    background: white;
    margin-bottom: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

details.category-group[open] {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

summary.category-header {
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    background-color: white;
    color: var(--primary-color);
    list-style: none; /* Hide default triangle */
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

summary.category-header:hover {
    background-color: var(--hover-color);
}

/* Automatische Deaktivierung: Grau, wenn KEIN aktiver Link (<a>), KEINE Tabelle ODER KEIN Textinhalt enthalten ist */
details.category-group:not(:has(a.process-item, .abbreviation-table, ul, ol, p)) {
    opacity: 0.8;
}

details.category-group:not(:has(a.process-item, .abbreviation-table, ul, ol, p)) summary.category-header {
    color: var(--disabled-color);
    background-color: #f9f9f9;
}

/* Optional: Der Pfeil bleibt sichtbar, damit man weiß, dass man es öffnen kann */
details.category-group:not(:has(a.process-item)) summary.category-header::after {
    opacity: 0.4;
}

/* Custom triangle indicator */
summary.category-header::after {
    content: '▼';
    font-size: 0.8rem;
    transition: transform 0.3s;
    opacity: 0.7;
}

details.category-group[open] summary.category-header::after {
    transform: rotate(180deg);
}

/* Process Flow Step Accordion (Nested) */
details.flow-details summary {
    list-style: none;
    cursor: pointer;
}
details.flow-details summary::-webkit-details-marker {
    display: none;
}

details.flow-details .step-header {
    margin-bottom: 0; /* Remove margin when closed */
}

details.flow-details[open] .step-header {
    margin-bottom: 1rem; /* Add margin when open */
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.flow-content {
    padding-top: 0.5rem;
    font-size: 0.95rem;
    color: #444;
}

.flow-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.flow-content li {
    margin-bottom: 0.3rem;
}


/* Sub-items list */
.process-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem 1rem 2.5rem; /* Indented */
    border-top: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
    background-color: #fcfcfc;
}

.process-item:hover {
    background-color: #f0f4f8;
}

.process-item.active {
    background-color: #e3f2fd; /* Highlight active item */
    border-left: 4px solid var(--primary-color);
    padding-left: calc(2.5rem - 4px); /* Adjust padding for border */
}

.process-item.disabled {
    background-color: #fafafa;
    color: var(--disabled-color);
    cursor: not-allowed;
    opacity: 0.7;
}

.process-number {
    font-weight: bold;
    font-size: 1.2rem;
    min-width: 60px;
    color: var(--primary-color);
}

.process-item.disabled .process-number {
    color: var(--disabled-color);
}

.process-name {
    flex-grow: 1;
    font-weight: 500;
}

.status-badge {
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #e3f2fd;
    color: var(--primary-color);
}

.status-badge.locked {
    background-color: #eee;
    color: #777;
}

/* Role Badges - Softer Design with IBM Colors */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    margin-left: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #000; /* Text schwarz für bessere Lesbarkeit */
}

.role-icon {
    font-size: 1.3rem; /* Etwas größer für bessere Sichtbarkeit */
    line-height: 1;
}

/* Role Colors - Pastel Backgrounds with Darker Borders */
.role-sl, .role-schule {
    background-color: rgba(100, 143, 255, 0.2); 
    border: 1px solid var(--color-sl);
}

.role-aufsicht {
    background-color: rgba(120, 94, 240, 0.2); 
    border: 1px solid var(--color-aufsicht);
}

.role-sb {
    background-color: rgba(220, 38, 127, 0.2); 
    border: 1px solid var(--color-sb);
}

.role-zpm {
    background-color: rgba(254, 97, 0, 0.2); 
    border: 1px solid var(--color-zpm);
}

/* Light Backgrounds for Flow Steps (low opacity) */
.flow-step.bg-sl, .flow-step.bg-schule { background-color: rgba(100, 143, 255, 0.05); }
.flow-step.bg-aufsicht { background-color: rgba(120, 94, 240, 0.05); }
.flow-step.bg-sb { background-color: rgba(220, 38, 127, 0.05); }
.flow-step.bg-zpm { background-color: rgba(254, 97, 0, 0.05); }


/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.dashboard-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.dashboard-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.dashboard-card h2 {
    margin: 0 0 1rem 0;
    color: var(--text-color); /* Text standardmäßig schwarz */
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-card h2 .number {
    color: var(--primary-color); /* Nur die Nummer in Blau */
    font-weight: bold;
}

.dashboard-card p {
    margin: 0;
    color: #666;
    line-height: 1.5;
    flex-grow: 1;
}

.dashboard-card .card-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.85rem;
    color: #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-badge {
    background-color: #f8f9fa;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
}

.card-badge.urgent {
    background-color: #d9534f;
    color: white;
}

/* Footer */
.main-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    border-top: 1px solid #ddd;
}

/* Process Flow Chart (Simple) */
.flow-chart {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 900px;
    margin: 2rem auto;
}

.flow-step {
    background: white;
    border: 1px solid var(--border-color);
    padding: 1.2rem 1.5rem;
    border-radius: 8px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.flow-step::after {
    content: '↓';
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: #999;
}

.flow-step:last-child::after {
    display: none;
}

.flow-step.interactive {
    border-left: 5px solid var(--primary-color);
}

/* Role-based borders for flow-steps */
.flow-step.border-sl, .flow-step.border-schule { border-left: 5px solid var(--color-sl); }
.flow-step.border-aufsicht { border-left: 5px solid var(--color-aufsicht); }
.flow-step.border-sb { border-left: 5px solid var(--color-sb); }
.flow-step.border-zpm { border-left: 5px solid var(--color-zpm); }

.flow-step.interactive:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Flex container for Title + Badge */
.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.step-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

/* Guide Image View */
.guide-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #eee;
}

#stepIndicator {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
}

.step-navigation button {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.step-navigation button:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}

.step-navigation button:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.step-navigation button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.image-viewer {
    position: relative;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #000;
}

/* Hotspot Trigger: Hidden when hovered */
.hotspot-trigger.active {
    opacity: 0;
}

/* Floating Arrow */
.tutorial-arrow {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 110;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    animation: bounce 1.5s infinite;
}

/* Unsichtbare Erweiterung des Klickbereichs nach unten */
.tutorial-arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -50%;
    width: 200%;
    height: 60px;
    background: transparent;
    cursor: pointer;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Visible Hotspot Trigger (Permanent) - Orange-Red */
.hotspot-trigger {
    border: 2px dashed rgba(255, 69, 0, 0.7); 
    background-color: rgba(255, 69, 0, 0.05); 
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(255, 69, 0, 0.3);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { border-color: rgba(255, 69, 0, 0.5); box-shadow: 0 0 2px rgba(255, 69, 0, 0.2); }
    50% { border-color: rgba(255, 69, 0, 1); box-shadow: 0 0 8px rgba(255, 69, 0, 0.5); }
    100% { border-color: rgba(255, 69, 0, 0.5); box-shadow: 0 0 2px rgba(255, 69, 0, 0.2); }
}

/* The container that will be scaled - Gold Border */
.focus-container {
    position: absolute;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 100;
    pointer-events: auto;
    border: 3px solid var(--color-hotspot);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    background-color: white;
    overflow: visible; 
}

.focus-container img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Target Arrow inside the zoom container */
.target-arrow {
    position: absolute;
    width: 30px;
    height: 30px;
    z-index: 110;
    transform: translate(-50%, -100%);
}


.guide-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease, filter 0.3s ease;
    transform-origin: top center;
}

/* Dimmed state for background image */
.guide-image.dimmed {
    filter: blur(4px) brightness(0.6);
}

/* Focus overlay should stand out */
.focus-overlay {
    z-index: 15;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Simple zoom on active state */
.image-viewer.zoomed .guide-image {
    transform: scale(2);
    cursor: zoom-out;
}


.hotspot {
    position: absolute;
    border: 3px solid rgba(255, 69, 0, 0.6);
    background-color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    animation: pulse 2s infinite;
}

.hotspot:hover {
    border-color: var(--color-hotspot);
    background-color: rgba(255, 255, 255, 0.1);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 69, 0, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 69, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 69, 0, 0); }
}

.info-box {
    margin-top: 20px;
    padding: 15px;
    background-color: #e8f4fd;
    border-left: 4px solid var(--primary-color);
    display: none;
}

/* Checklist Section Styling */
.checklist-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-top: 1rem;
}

.checklist-header h3 {
    margin: 0 0 5px 0;
    color: var(--primary-color);
}

.checklist-header p {
    margin: 0 0 20px 0;
    font-size: 0.9rem;
    color: #666;
}

.checklist-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group.full-width {
    grid-column: span 2;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.input-group input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
}

.input-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,86,179,0.1);
}

.pdf-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s;
}

.pdf-button:hover {
    background-color: #218838;
}

.pdf-button .icon {
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .checklist-grid {
        grid-template-columns: 1fr;
    }
    .input-group.full-width {
        grid-column: span 1;
    }
}

/* Abbreviation Table Styling */
.abbreviation-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
}

.abbreviation-table th, 
.abbreviation-table td {
    text-align: left;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
}

.abbreviation-table th {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: bold;
    position: sticky;
    top: 0;
}

.abbreviation-table tr:hover {
    background-color: var(--hover-color);
}

.abbreviation-table td:first-child {
    font-weight: bold;
    width: 150px;
    color: var(--primary-color);
}
