/**
 * AI Dashboard - BEM Styles KOMPLETT KORRIGIERT
 * Version: 3.1.0-FINAL
 * 
 * ÄNDERUNGEN (22.10.2025):
 * - Modal-Overlay CSS hinzugefügt
 * - Kanban-Card Alias-Klassen ergänzt
 * - Ampel-Dot Klassen für deutsche Namen
 * - Tabellen-Wrapper mit horizontalem Scroll
 * - Spaltenbreiten für 11-spaltige Tabelle
 * 
 * Based on: usecase-bem.css (PMPS Standard)
 */

/* === ROOT VARIABLES (PMPS CI) === */
:root {
  --ai-primary: #196297;
  --ai-primary-light: #2a7ec0;
  --ai-success: #059669;
  --ai-success-light: #34d399;
  --ai-secondary: #475569;
  --ai-secondary-light: #64748b;
  --ai-danger: #dc2626;
  --ai-danger-light: #ef4444;
  --ai-warning: #f59e0b;
  --ai-warning-light: #fbbf24;
  
  /* Ampel-Farben */
  --ai-green: #16a34a;
  --ai-yellow: #eab308;
  --ai-red: #dc2626;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
}

/* === CONTAINER - VOLLE BREITE (BREAKOUT) === */
.ai-dashboard__container {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
    background: white !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15) !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    position: relative !important;
}

/* Reset für alle Kinder */
.ai-dashboard__container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === HEADER - EXAKT GLEICH WIE CONTENT === */
.ai-dashboard__header {
    background: linear-gradient(135deg, #196297 0%, #2475b3 100%) !important;
    color: white !important;
    padding: 30px 40px !important;
    text-align: center !important;
    max-width: 1600px !important;
    margin: 0 auto !important;
    border-radius: 15px 15px 0 0 !important;
    box-sizing: border-box !important;
}

.ai-dashboard__header h1 {
    margin: 0 0 0.5rem 0 !important;
    font-size: 2rem !important;
    font-weight: 600 !important;
}

.ai-dashboard__header-meta {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* === CONTENT-BEREICH - Identische Werte wie Header === */
.ai-dashboard__content {
    padding: 40px !important;
    max-width: 1600px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

/* Auf großen Bildschirmen - beide gleich */
@media (min-width: 1920px) {
    .ai-dashboard__header,
    .ai-dashboard__content {
        padding: 50px 80px !important;
        max-width: 1800px !important;
    }
}

/* === SECTIONS === */
.ai-dashboard__section {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ai-dashboard__section--radar {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 6px solid var(--ai-primary);
    padding: 0.5rem !important;
}

/* ==========================================================================
   READINESS RADAR CHART - NEUES LAYOUT
   ========================================================================== */

.ai-dashboard__section--radar {
    margin-bottom: 3rem;
}

.ai-dashboard__readiness-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
    padding: 0.5rem !important;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    min-height: 0 !important;
}

.ai-dashboard__readiness-info {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-self: flex-start;
}

.ai-dashboard__readiness-text {
    font-size: 1rem;
    line-height: 1.7;
    color: #374151;
    padding-left: 30px;  /* NEU: von 0 auf 30px erhöht */
}

.ai-dashboard__readiness-text p {
    margin: 0 0 1rem 0;
}

.ai-dashboard__readiness-text p:last-child {
    margin-bottom: 0;
}

.ai-dashboard__readiness-chart {
    flex: 0 0 60%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 !important;
    margin: 0 !important;
}

/* NEU: IMG-Element Support für PNG-Export */
.ai-dashboard__readiness-chart img {
    max-width: 800px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.ai-dashboard__readiness-chart canvas {
    max-width: 100%;
    height: auto !important;
    display: block;
}

.ai-dashboard__readiness-date {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    text-align: right;
    line-height: 1.5;
}

.ai-dashboard__date-placeholder {
    color: #9ca3af;
    font-style: italic;
}

.ai-dashboard__readiness-error {
    text-align: center;
    padding: 3rem 2rem;
    flex: 1;
}

.ai-dashboard__error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.ai-dashboard__error-message {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.ai-dashboard__error-detail {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.ai-dashboard__readiness-error .ai-dashboard__btn {
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .ai-dashboard__readiness-wrapper {
        gap: 2rem;
    }
    
    .ai-dashboard__readiness-info {
        flex: 0 0 45%;
    }
    
    .ai-dashboard__readiness-chart {
        flex: 0 0 50%;
    }
}

@media (max-width: 768px) {
    .ai-dashboard__readiness-wrapper {
        flex-direction: column;
        padding: 1.5rem;
        min-height: auto;
    }
    
    .ai-dashboard__readiness-info,
    .ai-dashboard__readiness-chart {
        flex: 1 1 100%;
    }
    
    .ai-dashboard__readiness-chart {
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .ai-dashboard__readiness-wrapper {
        padding: 1rem;
    }
    
    .ai-dashboard__readiness-chart {
        min-height: 300px;
    }
    
    .ai-dashboard__readiness-date {
        font-size: 0.75rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .ai-dashboard__date-created::after {
        display: none;
    }
}

.ai-dashboard__section--filters {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 6px solid var(--ai-success);
}

.ai-dashboard__section--kanban {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border-left: 6px solid var(--ai-warning);
}

.ai-dashboard__section--list {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    border-left: 6px solid #8b5cf6;
}

.ai-dashboard__section h2 {
    margin-bottom: var(--spacing-md);
    color: var(--ai-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-dashboard__section--radar h2 {
    margin-bottom: 0.5rem !important;
}

/* === RADAR CHART === */
.ai-dashboard__radar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.ai-dashboard__radar-date {
    margin-top: var(--spacing-md);
    color: var(--ai-secondary-light);
    font-size: 0.9rem;
}

.ai-dashboard__readiness-chart {
    max-width: 800px;  /* Feste maximale Breite */
    margin: 0 auto;    /* Zentrieren */
}

.ai-dashboard__readiness-chart img {
    width: 100%;
    height: auto;
    display: block;
}

/* === FILTERS === */
.ai-dashboard__filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.ai-dashboard__filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.ai-dashboard__filter-label {
    font-weight: 600;
    color: var(--ai-secondary);
    font-size: 0.9rem;
}

/* === BUTTONS === */
.ai-dashboard__btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.ai-dashboard__btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-dashboard__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ai-dashboard__btn:active {
    transform: translateY(0);
}

/* Button Variants */
.ai-dashboard__btn--primary {
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-light));
    color: white;
}

.ai-dashboard__btn--success {
    background: linear-gradient(135deg, var(--ai-success), var(--ai-success-light));
    color: white;
}

.ai-dashboard__btn--secondary {
    background: linear-gradient(135deg, var(--ai-secondary), var(--ai-secondary-light));
    color: white;
}

.ai-dashboard__btn--danger {
    background: linear-gradient(135deg, var(--ai-danger), var(--ai-danger-light));
    color: white;
}

.ai-dashboard__btn--warning {
    background: linear-gradient(135deg, var(--ai-warning), var(--ai-warning-light));
    color: white;
}

/* === SVG ICON SUPPORT === */
.ai-dashboard__btn-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    margin-right: 8px;
}

/* === INPUTS === */
.ai-dashboard__input,
.ai-dashboard__select {
    padding: 10px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 100%;
}

.ai-dashboard__input:focus,
.ai-dashboard__select:focus {
    outline: none;
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 3px rgba(25, 98, 151, 0.1);
}

/* === KANBAN BOARD === */
.ai-dashboard__kanban {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.ai-dashboard__kanban-column {
    background: white;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: var(--spacing-md);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.ai-dashboard__kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid #e5e7eb;
}

.ai-dashboard__kanban-title {
    font-weight: 700;
    color: var(--ai-secondary);
    font-size: 1.1rem;
}

.ai-dashboard__kanban-count {
    background: var(--ai-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.ai-dashboard__kanban-cards {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* === TASK CARDS === */
.ai-dashboard__task-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: var(--spacing-md);
    cursor: move;
    transition: all 0.3s ease;
}

.ai-dashboard__task-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--ai-primary);
}

.ai-dashboard__task-card--dragging {
    opacity: 0.5;
    transform: rotate(3deg);
}

.ai-dashboard__task-title {
    font-weight: 600;
    color: var(--ai-secondary);
    margin-bottom: var(--spacing-sm);
}

.ai-dashboard__task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
    margin-top: var(--spacing-sm);
}

/* Alias-Klassen für Kanban-Cards (falls alte Klassennamen verwendet werden) */
.ai-dashboard__kanban-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: var(--spacing-md);
    cursor: move;
    transition: all 0.3s ease;
}

.ai-dashboard__kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: var(--ai-primary);
}

.ai-dashboard__card-title {
    font-weight: 600;
    color: var(--ai-secondary);
    margin-bottom: var(--spacing-sm);
}

.ai-dashboard__card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
    margin-top: var(--spacing-sm);
}

/* === TRAFFIC LIGHT DOTS === */
.ai-dashboard__traffic-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.ai-dashboard__traffic-light--green {
    background: var(--ai-green);
    box-shadow: 0 0 8px rgba(22, 163, 74, 0.5);
}

.ai-dashboard__traffic-light--yellow {
    background: var(--ai-yellow);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
}

.ai-dashboard__traffic-light--red {
    background: var(--ai-red);
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

/* Ampel-Dots mit deutschen Namen (Fallback) */
.ai-dashboard__ampel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.ai-dashboard__ampel-dot--grün,
.ai-dashboard__ampel-dot--grun {
    background: var(--ai-green);
    box-shadow: 0 0 8px rgba(22, 163, 74, 0.5);
}

.ai-dashboard__ampel-dot--gelb {
    background: var(--ai-yellow);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.5);
}

.ai-dashboard__ampel-dot--rot {
    background: var(--ai-red);
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

/* === EFFORT BADGES === */
.ai-dashboard__effort-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.ai-dashboard__effort-badge--low {
    background: #dcfce7;
    color: #166534;
}

.ai-dashboard__effort-badge--medium {
    background: #fef3c7;
    color: #854d0e;
}

.ai-dashboard__effort-badge--high {
    background: #fee2e2;
    color: #991b1b;
}

/* Deutsche Namen Fallback */
.ai-dashboard__effort-badge--niedrig {
    background: #dcfce7;
    color: #166534;
}

.ai-dashboard__effort-badge--mittel {
    background: #fef3c7;
    color: #854d0e;
}

.ai-dashboard__effort-badge--hoch {
    background: #fee2e2;
    color: #991b1b;
}

/* === LIST VIEW === */
.ai-dashboard__list-view {
    display: none;
}

.ai-dashboard__list-view--active {
    display: block;
}

/* === TABLE WRAPPER WITH HORIZONTAL SCROLL === */
.ai-dashboard__table-wrapper {
    overflow-x: auto;
    margin-top: var(--spacing-lg);
    -webkit-overflow-scrolling: touch;
}

.ai-dashboard__table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.ai-dashboard__table th {
    background: var(--ai-primary);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.ai-dashboard__table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e5e7eb;
}

.ai-dashboard__table tbody tr:hover {
    background: #f9fafb;
    cursor: pointer;
}

/* Spaltenbreiten für 10-spaltige Tabelle */
.ai-dashboard__table th:nth-child(1),
.ai-dashboard__table td:nth-child(1) {
    width: 140px; /* Thema */
}

.ai-dashboard__table th:nth-child(2),
.ai-dashboard__table td:nth-child(2) {
    min-width: 200px; /* Aufgabe */
    max-width: 300px;
}

.ai-dashboard__table th:nth-child(3),
.ai-dashboard__table td:nth-child(3) {
    width: 140px; /* Verantwortlich */
}

.ai-dashboard__table th:nth-child(4),
.ai-dashboard__table td:nth-child(4) {
    width: 120px; /* Status */
}

.ai-dashboard__table th:nth-child(5),
.ai-dashboard__table td:nth-child(5) {
    width: 100px; /* Ampel */
}

.ai-dashboard__table th:nth-child(6),
.ai-dashboard__table td:nth-child(6) {
    width: 100px; /* Aufwand */
}

.ai-dashboard__table th:nth-child(7),
.ai-dashboard__table td:nth-child(7) {
    min-width: 200px; /* Kommentar - BREITER */
    max-width: 350px;
}

.ai-dashboard__table th:nth-child(8),
.ai-dashboard__table td:nth-child(8) {
    width: 100px; /* Erstellt */
}

.ai-dashboard__table th:nth-child(9),
.ai-dashboard__table td:nth-child(9) {
    width: 100px; /* Fällig */
}

.ai-dashboard__table th:nth-child(10),
.ai-dashboard__table td:nth-child(10) {
    width: 110px; /* Aktualisiert */
}

/* Text-Truncation für lange Inhalte */
.ai-dashboard__table td:nth-child(2),
.ai-dashboard__table td:nth-child(7) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-dashboard__table td:nth-child(2):hover,
.ai-dashboard__table td:nth-child(7):hover {
    white-space: normal;
    word-wrap: break-word;
}

/* Text-Truncation für lange Inhalte */
.ai-dashboard__table td:nth-child(3),
.ai-dashboard__table td:nth-child(8) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-dashboard__table td:nth-child(3):hover,
.ai-dashboard__table td:nth-child(8):hover {
    white-space: normal;
    word-wrap: break-word;
}

.ai-dashboard__table-info {
    margin-top: var(--spacing-md);
    color: var(--ai-secondary-light);
    font-size: 0.9rem;
    font-style: italic;
}

/* === MODAL OVERLAY (NEU - KRITISCH!) === */
.ai-dashboard__modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.ai-dashboard__modal-overlay--visible {
    display: flex !important;
}

/* Modal-Container innerhalb des Overlays */
.ai-dashboard__modal-overlay .ai-dashboard__modal {
    display: block;
    position: relative;
    width: auto;
    height: auto;
    background: transparent;
    z-index: auto;
}

/* === MODALS === */
.ai-dashboard__modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.ai-dashboard__modal--active {
    display: flex;
}

.ai-dashboard__modal-content {
    background: white;
    border-radius: 16px;
    padding: var(--spacing-xl);
    max-width: 1000px;
    width: 90%;
    max-height: 90vh;
    overflow-y: visible;  /* â† GEÄNDERT von auto zu visible */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    display: flex;        /* â† NEU */
    flex-direction: column; /* â† NEU */
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ai-dashboard__modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid #e5e7eb;
}

.ai-dashboard__modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ai-secondary);
}

.ai-dashboard__modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--ai-secondary-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.ai-dashboard__modal-close:hover {
    background: #f3f4f6;
    color: var(--ai-danger);
}

.ai-dashboard__modal-body {
    margin-bottom: var(--spacing-lg);
    overflow-y: auto;     /* â† NEU */
    flex: 1;              /* â† NEU */
    min-height: 0;        /* â† NEU - wichtig für Flex! */
}

.ai-dashboard__modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 2px solid #e5e7eb;
}

/* === REPORT CONFIGURATION FORM === */
.ai-dashboard__report-form-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--spacing-xl);
    align-items: start;
}

.ai-dashboard__report-form-checks {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.ai-dashboard__report-form-checks h4,
.ai-dashboard__report-form-notes h4 {
    margin-bottom: var(--spacing-sm);
    color: var(--ai-primary);
    font-size: 1.1rem;
}

.ai-dashboard__report-form-notes {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ai-dashboard__report-form-notes .ai-dashboard__form-textarea {
    flex: 1;
    min-height: 300px;
    max-height: 400px;
    resize: vertical;
}

.ai-dashboard__checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.ai-dashboard__checkbox-label:hover {
    background-color: #f3f4f6;
}

.ai-dashboard__checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.ai-dashboard__checkbox-label span {
    font-size: 0.95rem;
    color: var(--ai-secondary);
}

/* === FORM GROUPS === */
.ai-dashboard__form-group {
    margin-bottom: var(--spacing-lg);
}

.ai-dashboard__form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--ai-secondary);
}

.ai-dashboard__form-input,
.ai-dashboard__form-select,
.ai-dashboard__form-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.ai-dashboard__form-textarea {
    resize: vertical;
    min-height: 100px;
}

.ai-dashboard__form-input:focus,
.ai-dashboard__form-select:focus,
.ai-dashboard__form-textarea:focus {
    outline: none;
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 3px rgba(25, 98, 151, 0.1);
}

/* === TOGGLE SWITCH === */
.ai-dashboard__toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.ai-dashboard__toggle-btn {
    padding: 8px 20px;
    border: 2px solid var(--ai-primary);
    background: white;
    color: var(--ai-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ai-dashboard__toggle-btn:hover {
    background: #f0f9ff;
}

.ai-dashboard__toggle-btn--active {
    background: var(--ai-primary);
    color: white;
}

/* === LOADING STATE === */
.ai-dashboard__loading {
    display: none;
    text-align: center;
    padding: var(--spacing-xl);
}

.ai-dashboard__loading--active {
    display: block;
}

.ai-dashboard__spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--ai-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === AUTOSAVE INDICATOR === */
.ai-dashboard__autosave-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--ai-success);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10000;
}

.ai-dashboard__autosave-indicator--visible {
    opacity: 1;
}

.ai-dashboard__save-text {
    font-weight: 600;
}

/* === ALERTS === */
.ai-dashboard__alert {
    padding: var(--spacing-md);
    border-radius: 8px;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.ai-dashboard__alert--success {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid var(--ai-success);
}

.ai-dashboard__alert--error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--ai-danger);
}

.ai-dashboard__alert--info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--ai-primary);
}

/* === E-MAIL & SETTINGS === */

/* Settings Section */
.ai-dashboard__section--settings {
    background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
    border-left: 6px solid #0284c7;
    margin-bottom: var(--spacing-xl);
}

.ai-dashboard__settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Feste 50/50 Aufteilung */
    gap: 2rem;
    margin-top: 1.5rem;
}

/* Settings Box */
.ai-dashboard__settings-box {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.ai-dashboard__settings-box:hover {
    border-color: var(--ai-primary);
    box-shadow: 0 4px 12px rgba(25, 98, 151, 0.1);
}

.ai-dashboard__settings-box--email {
    border-left: 4px solid var(--ai-primary);
}

/* Settings Header */
.ai-dashboard__settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.ai-dashboard__settings-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ai-primary);
    margin: 0;
}

/* Toggle Switch */
.ai-dashboard__settings-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-dashboard__toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.ai-dashboard__toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ai-dashboard__toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 26px;
}

.ai-dashboard__toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.ai-dashboard__toggle-switch input:checked + .ai-dashboard__toggle-slider {
    background-color: var(--ai-success);
}

.ai-dashboard__toggle-switch input:checked + .ai-dashboard__toggle-slider:before {
    transform: translateX(24px);
}

.ai-dashboard__toggle-switch input:focus + .ai-dashboard__toggle-slider {
    box-shadow: 0 0 1px var(--ai-success);
}

/* Status Text */
.ai-dashboard__settings-status {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    transition: color 0.3s ease;
}

.ai-dashboard__settings-status--active {
    color: var(--ai-success);
}

/* Settings Content */
.ai-dashboard__settings-content {
    margin-top: 1rem;
}

.ai-dashboard__settings-content p {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Settings Info Box */
.ai-dashboard__settings-info {
    display: flex;
    gap: 0.75rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--ai-primary);
    margin-top: 1.5rem;
}

.ai-dashboard__info-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    stroke: var(--ai-primary);
    stroke-width: 2;
}

.ai-dashboard__settings-info p {
    margin: 0;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.5;
}

/* E-Mail Modal Specific */
.ai-dashboard__modal--email {
    max-width: 900px; /* Verbreitert von 600px auf 900px (+50%) für mehr Platz bei Buttons */
}

.ai-dashboard__modal--email .ai-dashboard__form-group {
    margin-bottom: 1.5rem;
}

.ai-dashboard__modal--email .ai-dashboard__form-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .ai-dashboard__container {
        width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 0 !important;
    }

    .ai-dashboard__header,
    .ai-dashboard__content {
        padding: 15px !important;
        max-width: 100% !important;
    }
    
    .ai-dashboard__header {
        border-radius: 0 !important;
    }

    .ai-dashboard__kanban {
        grid-template-columns: 1fr;
    }

    .ai-dashboard__filters {
        grid-template-columns: 1fr;
    }

    .ai-dashboard__btn-group {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-dashboard__modal-content {
        width: 95%;
        padding: var(--spacing-lg);
    }
    
    .ai-dashboard__table {
        min-width: 1200px;
    }
}

/* Tablet-Anpassungen */
@media (min-width: 769px) and (max-width: 1199px) {
    .ai-dashboard__header,
    .ai-dashboard__content {
        max-width: 100% !important;
        padding: 30px !important;
    }
}

/* === LOGIN REQUIRED MESSAGE === */
.ai-dashboard__login-required {
    padding: var(--spacing-xl);
    text-align: center;
    background: #fef3c7;
    border: 2px solid var(--ai-warning);
    border-radius: 12px;
    color: #854d0e;
    font-weight: 600;
}

/* === ERROR MESSAGE === */
.ai-dashboard__error {
    padding: var(--spacing-xl);
    text-align: center;
    background: #fee2e2;
    border: 2px solid var(--ai-danger);
    border-radius: 12px;
    color: #991b1b;
    font-weight: 600;
}

/* === CHART FIXES === */
.ai-dashboard__readiness-chart {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.ai-dashboard__readiness-chart canvas {
    display: block !important;
    max-width: 100% !important;
    width: auto !important;
    height: 800px !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

.ai-dashboard__readiness-wrapper {
    align-items: stretch !important;
}

/* === VERANTWORTLICHEN-MANAGEMENT === */
.ai-dashboard__responsible-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: var(--spacing-lg);
}

.ai-dashboard__responsible-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: var(--spacing-sm);
    border: 1px solid #e5e7eb;
}

.ai-dashboard__responsible-item:hover {
    background: #f3f4f6;
}

.ai-dashboard__responsible-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-dashboard__responsible-info strong {
    font-size: 1rem;
    color: #111827;
}

.ai-dashboard__responsible-position {
    font-size: 0.875rem;
    color: #6b7280;
    font-style: italic;
}

.ai-dashboard__responsible-email {
    font-size: 0.875rem;
    color: #4b5563;
}

.ai-dashboard__btn--sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.ai-dashboard__empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: #6b7280;
    font-style: italic;
}

.ai-dashboard__empty-state p {
    margin: 0;
}

/* === AKKORDEON === */
.ai-dashboard__accordion {
    margin-top: var(--spacing-xl);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.ai-dashboard__accordion-toggle {
    width: 100%;                /* Volle Breite */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 30px;
    background: #6b7280;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    transition: all 0.2s;
    text-align: center;
}

.ai-dashboard__accordion-toggle:hover {
    background: #4b5563;
}

.ai-dashboard__accordion-icon {
    width: 24px;
    height: 24px;
    stroke: white;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.ai-dashboard__accordion-toggle--open .ai-dashboard__accordion-icon {
    transform: rotate(180deg);
}

.ai-dashboard__accordion-content {
    display: none;
    padding: var(--spacing-md);
    background: white;
    max-height: 400px;
    overflow-y: auto;
}

/* === FORM SECTIONS === */
.ai-dashboard__form-section {
    margin-bottom: var(--spacing-xl);
}

.ai-dashboard__section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 var(--spacing-md) 0;
}

.ai-dashboard__responsible-form {
    background: #f9fafb;
    padding: var(--spacing-lg);
    border-radius: 8px;
}

.ai-dashboard__form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.ai-dashboard__form-actions {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.ai-dashboard__btn--add {
    min-width: 150px;
}

.ai-dashboard__modal-content--large {
    max-width: 700px;
}

/* Modal Footer - Button rechtsbündig (auf gleicher Linie mit oberem Schließen-Button) */
.ai-dashboard__modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* ============================================================================
   TABLE SORTING
   ============================================================================ */

.ai-dashboard__table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 28px;
}

.ai-dashboard__table th.sortable:hover {
    background-color: #4b5563;;
}

.ai-dashboard__table th .sort-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
    opacity: 0.85;
    transition: all 0.2s ease;
    fill: white;
    stroke: white;
    width: 16px;
    height: 16px;
}

.ai-dashboard__table th.sortable:hover .sort-icon {
    opacity: 1;
    transform: scale(1.1);
}

.ai-dashboard__table th.sorted-asc .sort-icon,
.ai-dashboard__table th.sorted-desc .sort-icon {
    opacity: 1;
    fill: white;
}

.ai-dashboard__table th.sorted-desc .sort-icon {
    transform: rotate(180deg);
}

/* ID column - more padding left for better spacing */
.ai-dashboard__table th:first-child,
.ai-dashboard__table td:first-child {
    text-align: right;
    padding-right: 20px;
    padding-left: 30px;
}

/* Task column - narrower, allow 2 lines */
.ai-dashboard__table th.task-column,
.ai-dashboard__table td:nth-child(3) {
    max-width: 150px;
    white-space: normal;
    line-height: 1.4;
}

/* Comment column - narrower, allow 2 lines */
.ai-dashboard__table th:nth-child(8),
.ai-dashboard__table td:nth-child(8) {
    max-width: 120px;
    white-space: normal;
    line-height: 1.4;
}

/* Effort column - make it narrower, NO line breaks */
.ai-dashboard__table th:nth-child(7),
.ai-dashboard__table td:nth-child(7) {
    width: 70px;
    max-width: 70px;
    white-space: nowrap;
}

/* Allow line breaks in most columns for better space usage */
.ai-dashboard__table td {
    white-space: normal;
    line-height: 1.4;
}

/* Except for Effort - keep single line */
.ai-dashboard__table td:nth-child(7) {
    white-space: nowrap;
}

/* ============================================================================
   MODAL FORM - ZWEI-SPALTIG
   ============================================================================ */

.ai-dashboard__form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

.ai-dashboard__form-grid .ai-dashboard__form-group {
    margin-bottom: 0;
}

/* Vollbreite Felder */
.ai-dashboard__form-group--full {
    grid-column: 1 / -1;
}

/* Pflichtfeld-Markierung */
.ai-dashboard__label--required::after {
    content: ' *';
    color: #dc2626;
    font-weight: bold;
}

@media (max-width: 768px) {
    .ai-dashboard__form-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   PIE CHARTS CSS
   ============================================================================ */

.ai-dashboard__section--charts {
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border-left: 6px solid #f59e0b;
    margin-bottom: var(--spacing-xl);
}

.ai-dashboard__charts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* 3 feste Spalten */
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

/* Responsive: Bei schmalen Bildschirmen untereinander */
@media (max-width: 1200px) {
    .ai-dashboard__charts-grid {
        grid-template-columns: 1fr;  /* Untereinander auf kleinen Bildschirmen */
    }
}

.ai-dashboard__chart-container {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: var(--spacing-lg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ai-dashboard__chart-wrapper {
    width: 250px;
    height: 250px;
    position: relative;
    margin-bottom: var(--spacing-md);
}

.ai-dashboard__chart-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
}

.ai-dashboard__chart-legend {
    width: 100%;
    max-width: 300px;
    padding: var(--spacing-sm) 0;
}

.ai-dashboard__chart-legend-item {
    display: flex;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--ai-secondary);
}

.ai-dashboard__chart-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
}

.ai-dashboard__chart-legend-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-dashboard__chart-legend-value {
    font-weight: 600;
    margin-left: 10px;
    color: var(--ai-primary);
}

.ai-dashboard__chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ai-secondary);
    text-align: center;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 2px solid #e5e7eb;
    width: 100%;
}

@media (max-width: 1200px) {
    .ai-dashboard__charts-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .ai-dashboard__chart-wrapper {
        width: 220px;
        height: 220px;
    }
}

@media (max-width: 768px) {
    .ai-dashboard__charts-grid {
        grid-template-columns: 1fr;
    }
    
    .ai-dashboard__chart-wrapper {
        width: 250px;
        height: 250px;
    }
    
    .ai-dashboard__chart-container {
        padding: var(--spacing-md);
    }
}

/* E-Mail Settings Grid Responsive */
@media (max-width: 768px) {
    .ai-dashboard__settings-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .ai-dashboard__settings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .ai-dashboard__settings-toggle {
        width: 100%;
        justify-content: space-between;
    }
}

/* === TOKEN-BEARBEITUNGSSEITE === */

/* Token Edit Container */
.ai-dashboard__token-edit {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.ai-dashboard__token-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.ai-dashboard__token-header h1 {
    font-size: 2rem;
    color: var(--ai-primary);
    margin-bottom: 0.5rem;
}

.ai-dashboard__token-header p {
    color: #64748b;
    font-size: 1.1rem;
}

/* Token Content */
.ai-dashboard__token-content {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Task Info Section */
.ai-dashboard__token-task-info {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e5e7eb;
}

.ai-dashboard__token-task-info h2 {
    font-size: 1.5rem;
    color: var(--ai-primary);
    margin-bottom: 1rem;
}

.ai-dashboard__token-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.ai-dashboard__token-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ai-dashboard__token-meta-item strong {
    color: #475569;
    font-size: 0.875rem;
}

.ai-dashboard__token-meta-item span {
    color: #1e293b;
    font-size: 1rem;
}

.ai-dashboard__token-description {
    margin-top: 1rem;
}

.ai-dashboard__token-description strong {
    display: block;
    color: #475569;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.ai-dashboard__token-description p {
    color: #475569;
    line-height: 1.6;
}

/* Token Form */
.ai-dashboard__token-form {
    margin-top: 2rem;
}

/* Status Radio Group */
.ai-dashboard__token-status-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ai-dashboard__token-status-option {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.ai-dashboard__token-status-option:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-dashboard__token-status-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ai-dashboard__token-status-option input[type="radio"]:checked + .ai-dashboard__token-status-label {
    font-weight: 600;
}

.ai-dashboard__token-status-option--gruen:has(input:checked) {
    border-color: var(--ai-success);
    background: #f0fdf4;
}

.ai-dashboard__token-status-option--gelb:has(input:checked) {
    border-color: var(--ai-warning);
    background: #fefce8;
}

.ai-dashboard__token-status-option--rot:has(input:checked) {
    border-color: var(--ai-danger);
    background: #fef2f2;
}

.ai-dashboard__token-status-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: #1e293b;
}

.ai-dashboard__token-status-label svg {
    width: 20px;
    height: 20px;
}

.ai-dashboard__token-status-option--gruen .ai-dashboard__token-status-label svg {
    color: var(--ai-success);
}

.ai-dashboard__token-status-option--gelb .ai-dashboard__token-status-label svg {
    color: var(--ai-warning);
}

.ai-dashboard__token-status-option--rot .ai-dashboard__token-status-label svg {
    color: var(--ai-danger);
}

.ai-dashboard__token-status-option small {
    color: #64748b;
    font-size: 0.875rem;
}

/* Token Actions */
.ai-dashboard__token-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.ai-dashboard__btn--large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Token Footer */
.ai-dashboard__token-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    color: #64748b;
}

/* Token Responsive */
@media (max-width: 768px) {
    .ai-dashboard__token-edit {
        padding: 1rem;
    }
    
    .ai-dashboard__token-content {
        padding: 1.5rem;
    }
    
    .ai-dashboard__token-status-group {
        grid-template-columns: 1fr;
    }
    
    .ai-dashboard__token-meta {
        grid-template-columns: 1fr;
    }
}
