/* CoKi Web Frontend - Hauptstyles */
/* Design basierend auf CoKi Logo: Blau-Türkis Gradient auf Dunkel */

:root {
    /* Primärfarben - Türkis/Cyan aus dem Logo */
    --primary-color: #06b6d4;
    --primary-hover: #0891b2;
    --primary-light: #22d3ee;
    
    /* Sekundär/Akzent - Blau aus dem Logo */
    --accent-color: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-light: #38bdf8;
    
    /* Dunkel-Palette aus dem Logo-Hintergrund */
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-card: #334155;
    --dark-border: #475569;
    
    /* Helle Palette für Light-Mode */
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f0f4f8;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    
    /* Gradient aus dem Logo - Blau zu Türkis */
    --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #14b8a6 100%);
    --gradient-dark: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --coki-gradient: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #14b8a6 100%);
    
    /* Template-Editor Farbkodierung */
    --template-tag-color: #ef4444;        /* Rot für Tags */
    --template-tag-bg: rgba(239, 68, 68, 0.1);
    --template-suggestion-color: #3b82f6; /* Blau für Vorschläge */
    --template-suggestion-bg: rgba(59, 130, 246, 0.1);
    --template-hint-color: #22c55e;       /* Grün für Hinweise */
    --template-hint-bg: rgba(34, 197, 94, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Login Page - Dunkles Design passend zum Logo */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg);
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(59, 130, 196, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(107, 191, 89, 0.1) 0%, transparent 50%);
    z-index: 9999;
}

.login-container.hidden {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    background: var(--dark-card);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--dark-border);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-card .logo {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.login-card .subtitle {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-card p {
    color: rgba(255, 255, 255, 0.6);
}

.login-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

/* Login Logo */
.login-logo {
    margin-bottom: 1.5rem;
}

.login-logo img {
    max-width: 200px;
    height: auto;
}

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

.app-container.hidden {
    display: none !important;
}

/* Sidebar - Dunkles Design */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark-surface);
    border-right: 1px solid var(--dark-border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.back-to-modules {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: all 0.2s;
}

.back-to-modules:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.back-to-modules-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--dark-border);
    transition: all 0.2s;
}

.back-to-modules-link:hover {
    background: var(--dark-card);
    color: white;
}

.back-to-modules-link svg {
    flex-shrink: 0;
}

.sidebar-header .logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.05em;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background-color: var(--dark-card);
    color: white;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 196, 0.2) 0%, transparent 100%);
    color: var(--primary-light);
    border-right: 3px solid var(--primary-color);
}

.nav-item .icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.nav-item.hidden {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
}

/* Header - Heller Bereich für Kontrast */
.header {
    height: var(--header-height);
    background: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-selectors {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selector-group {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.selector-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.selector-separator {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-top: 0.75rem;
}

.org-selector {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-color);
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--text-primary);
    min-width: 140px;
}

.org-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 196, 0.15);
}

.tenant-selector {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-color);
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--text-primary);
    min-width: 140px;
}

.tenant-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 196, 0.15);
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.llm-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.llm-icon {
    color: var(--accent-color);
    flex-shrink: 0;
}

.llm-selector {
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 150px;
}

.llm-selector:focus {
    outline: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-menu:hover {
    background-color: var(--background-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

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

/* Page Content */
.page-content {
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Stat Cards - Mit CoKi-Farben */
.stat-card {
    background: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-card .stat-icon.primary {
    background: rgba(59, 130, 196, 0.15);
    color: var(--primary-color);
}

.stat-card .stat-icon.success {
    background: rgba(107, 191, 89, 0.15);
    color: var(--accent-color);
}

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

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* Buttons - CoKi Design */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 196, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(59, 130, 196, 0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 8px rgba(107, 191, 89, 0.25);
}

.btn-success:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(107, 191, 89, 0.35);
}

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

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

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-gradient {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 196, 0.3);
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 196, 0.4);
}

/* Forms - Mit CoKi Focus-Farben */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--card-background);
    color: var(--text-primary);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 196, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Badges - CoKi Farben */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    margin: 0.125rem;
}

.badge-primary {
    background: rgba(59, 130, 196, 0.15);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(107, 191, 89, 0.15);
    color: var(--accent-color);
}

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

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

.badge-info {
    background: rgba(59, 130, 196, 0.1);
    color: #2563eb;
}

.badge-secondary {
    background: rgba(100, 116, 139, 0.15);
    color: var(--secondary-color);
}

/* Document styles */
.doc-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Status Badges */
.status-offen {
    background: #fef3c7;
    color: #92400e;
}

.status-erledigt {
    background: #d1fae5;
    color: #065f46;
}

.status-draft {
    background: #e0e7ff;
    color: #3730a3;
}

.status-final {
    background: #d1fae5;
    color: #065f46;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card-background);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.2s;
    position: relative;
    z-index: 1001;
}

.modal.modal-lg {
    max-width: 800px;
}

.modal.modal-xl {
    max-width: 1100px;
}

/* Modal with backdrop (standalone modal) */
div.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: transparent;
}

/* Verstecke Modals standardmäßig wenn inline display:none gesetzt ist */
div.modal[style*="display: none"],
div.modal[style*="display:none"] {
    display: none !important;
}

div.modal > .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* Dark Modal Override für spezielle Seiten */
#template-select-modal.modal > .modal-content,
#new-report-dialog.modal > .modal-content {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Globale Dark-Theme Modal Styles */
div.modal > .modal-content {
    background: var(--dark-card, #1e293b);
    border: 1px solid var(--dark-border, #334155);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 1001;
    color: white;
}

div.modal .modal-header {
    border-bottom: 1px solid var(--dark-border, #334155);
}

div.modal .modal-title {
    color: white;
}

div.modal .modal-close {
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    border: none;
}

div.modal .modal-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

div.modal .modal-footer {
    border-top: 1px solid var(--dark-border, #334155);
    background: rgba(0, 0, 0, 0.2);
}

div.modal .form-label {
    color: rgba(255, 255, 255, 0.9);
}

div.modal .form-input,
div.modal .form-textarea,
div.modal .form-select {
    background: var(--dark-bg, #0f172a);
    border: 1px solid var(--dark-border, #334155);
    color: white;
}

div.modal .form-input::placeholder,
div.modal .form-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

div.modal .form-input:focus,
div.modal .form-textarea:focus,
div.modal .form-select:focus {
    border-color: var(--coki-primary, #06b6d4);
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

div.modal .form-hint {
    color: rgba(255, 255, 255, 0.5);
}

div.modal > .modal-content.modal-lg {
    max-width: 800px;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: var(--background-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    margin-left: 0.5rem;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast.toast-info {
    border-left: 4px solid var(--primary-color);
}

/* Loading Spinner - Mit CoKi-Farbe */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-right-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Kleiner Spinner für Buttons */
.spinner-small {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
    color: var(--text-secondary);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem;
}

.empty-state .icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: var(--text-secondary);
}

.empty-state .title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state .description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Questionnaire */
.questionnaire-item {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.questionnaire-item.completed {
    border-color: var(--success-color);
    background: #f0fdf4;
}

.questionnaire-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.questionnaire-tag {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.questionnaire-question {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.questionnaire-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.questionnaire-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Progress Bar - Mit Gradient */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .progress {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.3s;
}

/* Tabs - CoKi Farben */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

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

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    z-index: 100;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: var(--background-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

/* Modal Container (verbessert für responsive und Dark-Mode) */
.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-container.hidden {
    display: none !important;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-container .modal {
    position: relative;
    z-index: 10000;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    max-width: 520px;
    width: calc(100% - 2rem);
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.2s ease-out;
    margin: auto;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* Subtiler Glow am oberen Rand */
.modal-container .modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: radial-gradient(ellipse at 50% 0%, rgba(6, 182, 212, 0.15) 0%, transparent 70%);
    pointer-events: none;
    border-radius: 16px 16px 0 0;
    z-index: 0;
}

.modal-container .modal .modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.modal-container .modal .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.modal-container .modal.modal-sm {
    max-width: 400px;
}

.modal-container .modal.modal-lg {
    max-width: 700px;
}

.modal-container .modal.modal-xl {
    max-width: 1000px;
}

/* Responsive Modal für kleinere Bildschirme */
@media (max-width: 640px) {
    .modal-container .modal {
        max-width: 100%;
        max-height: 95vh;
        margin: 0.5rem;
        border-radius: 12px;
    }
    
    .modal-container .modal-header,
    .modal-container .modal .modal-body,
    .modal-container .modal .modal-footer {
        padding: 1rem;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header - Glasmorphism Design */
.modal-container .modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px 16px 0 0;
    position: relative;
    z-index: 1;
}

.modal-container .modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
}

.modal-container .modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1;
    transition: all 0.2s;
}

.modal-container .modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.modal-container .modal-body {
    padding: 1.5rem;
    background: transparent;
}

.modal-container .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 16px 16px;
}

/* Modal Buttons */
.modal-container .modal-footer .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-container .modal-footer .btn-primary {
    background: linear-gradient(135deg, #06b6d4, #0ea5e9);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.modal-container .modal-footer .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.modal-container .modal-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.modal-container .modal-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-container .modal-footer .btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.modal-container .modal-footer .btn-warning:first-child {
    margin-right: auto;
}

/* Form Inputs im Modal */
.modal-container .modal-body .form-input,
.modal-container .modal-body .form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: white;
    font-size: 0.875rem;
    transition: all 0.15s ease;
}

.modal-container .modal-body .form-input:focus,
.modal-container .modal-body .form-select:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.modal-container .modal-body .form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.7);
}


/* Info Card - CoKi Farben */
.info-card {
    background: rgba(59, 130, 196, 0.08);
    border-color: rgba(59, 130, 196, 0.3);
}

.info-card.warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
}

.info-card.success {
    background: rgba(107, 191, 89, 0.08);
    border-color: rgba(107, 191, 89, 0.3);
}

.info-content {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.info-icon {
    flex-shrink: 0;
    color: var(--primary-color);
}

.info-card.warning .info-icon {
    color: var(--warning-color);
}

.info-card.success .info-icon {
    color: var(--accent-color);
}

/* Help Card */
.help-card {
    background: var(--background-color);
}

.help-content {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.help-content ul {
    margin: 0.5rem 0 0 1rem;
    padding: 0;
}

.help-content li {
    margin-bottom: 0.25rem;
}

.help-content pre {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.help-content code {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Empty State improvements */
.empty-state {
    padding: 3rem;
    text-align: center;
}

.empty-state .empty-icon {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
}

/* Progress Container */
.progress-container {
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Search Form */
.search-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}

.search-form .form-group {
    flex: 1;
    margin-bottom: 0;
}

.search-results {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Text Colors */
.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-muted {
    color: var(--text-secondary);
}

/* Mobile menu toggle */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: inline-flex;
    }
    
    .page-header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-actions {
        flex-direction: column;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .toast {
        min-width: auto;
        max-width: calc(100vw - 2rem);
    }
}

/* Badge secondary */
.badge-secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
}

/* Page Header improvements */
.page-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-actions,
.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Button Group */
.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    min-width: 200px;
}

/* Tag Editor Styles */
.tag-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tag-item {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.tag-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.tag-label {
    font-weight: 600;
    font-family: monospace;
    color: var(--primary-color);
    background: rgba(59, 130, 196, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.tag-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.tag-input-wrapper {
    margin-bottom: 0.75rem;
}

.tag-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tag-status {
    font-size: 0.875rem;
}

.tag-status.success {
    color: var(--success-color);
}

.tag-status.error {
    color: var(--danger-color);
}

.tag-actions {
    display: flex;
    gap: 0.5rem;
}

/* Form Hints */
.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Checkbox Styles */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.form-checkbox input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.form-checkbox span {
    user-select: none;
}

/* Questionnaire Styles */
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.progress-percentage {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.progress-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.chapter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}

.chapter-tab {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chapter-tab:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 196, 0.05);
}

.chapter-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.chapter-tab .chapter-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
}

.chapter-tab .chapter-status.complete {
    background: var(--success-color);
}

.chapter-tab .chapter-status.partial {
    background: var(--warning-color);
}

.chapter-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

.chapter-indicator {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Question Card */
.question-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.question-card.answered {
    border-left: 4px solid var(--success-color);
}

.question-card.unanswered {
    border-left: 4px solid var(--warning-color);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1.5rem;
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

.question-info {
    flex: 1;
}

.question-tag {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--primary-color);
    background: rgba(59, 130, 196, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.question-text {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.question-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.question-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

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

.status-badge.erledigt {
    background: rgba(107, 191, 89, 0.15);
    color: var(--success-color);
}

.question-body {
    padding: 1.5rem;
}

.question-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.question-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 196, 0.15);
}

.question-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--background-color);
    border-top: 1px solid var(--border-color);
}

.question-actions {
    display: flex;
    gap: 0.5rem;
}

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

/* Attachment Section */
.attachment-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.75rem;
}

.attachment-item .remove-attachment {
    cursor: pointer;
    color: var(--danger-color);
    opacity: 0.7;
}

.attachment-item .remove-attachment:hover {
    opacity: 1;
}

.attachment-upload {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attachment-upload input[type="file"] {
    font-size: 0.75rem;
}

/* ============================================
   Dark Theme Form Styles
   Für Seiten mit dunklem Hintergrund (Chat, Library, Module-Select)
   ============================================ */

/* Dark Theme Selects und Inputs */
.dark-select,
.org-selector-dark,
.dark-input {
    background: var(--dark-card) !important;
    color: white !important;
    border: 1px solid var(--dark-border) !important;
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
}

.dark-select:focus,
.org-selector-dark:focus,
.dark-input:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.dark-select option {
    background: var(--dark-card);
    color: white;
}

/* Dark Theme Labels */
.dark-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
    display: block;
}

/* Formular in Modal auf dunklem Hintergrund */
.modal .form-input,
.modal .form-select,
.modal .form-textarea {
    background: white;
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Header Selector Styling - Konsistent auf allen Seiten */
.header-selector-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-selector-group label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-selector-group select {
    background: var(--card-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.header-selector-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

/* Fix für weiße Schrift auf weißem Hintergrund in Light-Mode */
.light-theme .form-input,
.light-theme .form-select,
.light-theme .form-textarea,
.admin-form-input,
.admin-form-select {
    color: var(--text-primary) !important;
    background: white !important;
}

.admin-form-input::placeholder,
.admin-form-select::placeholder {
    color: var(--text-secondary);
}

/* Toast Styling - Fix für bessere Sichtbarkeit */
.toast {
    color: var(--text-primary);
}

/* Admin Table Fix - Bessere Lesbarkeit */
.admin-table td {
    color: var(--text-primary);
}

.admin-table select {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
}

/* ============================================
   Template-Editor Styles mit Farbkodierung
   ============================================ */

/* Template-Editor Farbvariablen */
:root {
    /* ...existing vars... */
    
    /* Template-Editor Farbkodierung */
    --template-tag-color: #ef4444;        /* Rot für Tags */
    --template-tag-bg: rgba(239, 68, 68, 0.1);
    --template-suggestion-color: #3b82f6; /* Blau für Vorschläge */
    --template-suggestion-bg: rgba(59, 130, 246, 0.1);
    --template-hint-color: #22c55e;       /* Grün für Hinweise */
    --template-hint-bg: rgba(34, 197, 94, 0.1);
}

/* Legende für Farbkodierung */
.template-legend {
    padding: 1rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-label {
    font-weight: 500;
    color: var(--text-primary);
}

.legend-format {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.75rem;
    background: var(--background-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--text-secondary);
}

/* Template-Info Grid */
.template-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-value {
    font-weight: 500;
    color: var(--text-primary);
}

/* Template Tags Table */
.template-tags-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.template-tags-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.template-tags-table th {
    background: var(--card-background);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid var(--border-color);
}

.template-tags-table td {
    vertical-align: top;
    padding: 0.75rem 0.5rem;
}

.template-tags-table .tag-code-cell {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--template-tag-color);
    background: var(--template-tag-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.template-tags-table .tag-type-select {
    width: 100%;
    padding: 0.375rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    color: var(--text-primary);
}

.template-tags-table .tag-input {
    width: 100%;
    padding: 0.375rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
    min-height: 60px;
}

.template-tags-table .tag-input.suggestion {
    border-left: 3px solid var(--template-suggestion-color);
    background: var(--template-suggestion-bg);
}

.template-tags-table .tag-input.hint {
    border-left: 3px solid var(--template-hint-color);
    background: var(--template-hint-bg);
}

/* Template Preview */
.template-preview {
    padding: 1.5rem;
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Georgia', serif;
    line-height: 1.8;
    color: var(--text-color, #e2e8f0);
}

.template-preview .preview-placeholder {
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
}

/* Farbkodierte Elemente im Preview */
.template-preview .tag-highlight {
    color: var(--template-tag-color);
    background: var(--template-tag-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-size: 0.875em;
    font-weight: 600;
}

.template-preview .suggestion-highlight {
    color: var(--template-suggestion-color);
    background: var(--template-suggestion-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    border-bottom: 2px solid var(--template-suggestion-color);
}

.template-preview .hint-highlight {
    color: var(--template-hint-color);
    background: var(--template-hint-bg);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-style: italic;
}

/* Tag-Aktionen Buttons */
.tag-actions {
    display: flex;
    gap: 0.25rem;
}

.tag-actions .btn-sm {
    padding: 0.25rem 0.5rem;
}

/* Dokument-Viewer Modal Styles */
.document-viewer-modal {
    max-width: 900px !important;
    max-height: 85vh;
}

.document-viewer-content {
    display: flex;
    flex-direction: column;
    height: 70vh;
}

.document-viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.document-viewer-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.document-viewer-info .doc-title {
    font-weight: 600;
    color: var(--text-primary);
}

.document-viewer-info .doc-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.document-viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--card-bg, #1e293b);
    color: var(--text-color, #e2e8f0);
}

.document-viewer-body.pdf-viewer {
    padding: 0;
}

.document-viewer-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.document-text-content {
    font-family: 'Inter', sans-serif;
    line-height: 1.8;
    color: var(--text-color, #e2e8f0);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.document-text-content h1,
.document-text-content h2,
.document-text-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Fragebogen Dokument-Referenz Button */
.doc-reference-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.doc-reference-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Dokumente-Liste im Fragebogen */
.questionnaire-docs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    margin-top: 0.5rem;
}

.questionnaire-doc-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.questionnaire-doc-item:hover {
    border-color: var(--primary-color);
    background: rgba(6, 182, 212, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(6, 182, 212, 0.15);
}

.questionnaire-doc-item .doc-icon {
    color: var(--primary-color);
    font-size: 1rem;
}

.questionnaire-doc-item .doc-name {
    color: var(--text-primary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

/* ============================================
   Administration Kategorien (Neu strukturiert)
   Dunkles Design passend zu module-select
   ============================================ */

.admin-category {
    margin-bottom: 2rem;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: 16px;
    padding: 1.5rem;
}

.admin-category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--dark-border);
}

.admin-category-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.admin-category-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    margin: 0 0 0.25rem 0;
}

.admin-category-description {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

.admin-badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: auto;
}

.admin-badge-system {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
}

/* Admin Kacheln in Kategorien */
.admin-category .admin-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.admin-category .admin-tile {
    padding: 1rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
}

.admin-category .admin-tile:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.2);
}

.admin-category .admin-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
}

/* ============================================
   Administration Kacheln
   ============================================ */

.admin-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.admin-tile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(6, 182, 212, 0.2);
    border-color: var(--primary-color);
}

.admin-tile-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.admin-tile-content {
    flex: 1;
    min-width: 0;
}

.admin-tile-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
}

.admin-tile-description {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

.admin-tile-arrow {
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
    transition: all 0.3s;
}

.admin-tile:hover .admin-tile-arrow {
    transform: translateX(4px);
    color: white;
}

/* Admin Stats Grid */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.admin-stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 8px;
}

.admin-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.admin-stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Admin Unterseiten Header */
.admin-page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
}

.admin-back-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Admin Template Editor Spezifisch */
.template-editor-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Archivierte Zeilen */
.archived-row {
    opacity: 0.6;
    background-color: var(--bg-tertiary) !important;
}

.archived-row td {
    color: var(--text-secondary);
}

.badge-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
