/* ===============================================
   MODERN SUPPORT SYSTEM - ULTIMATE CSS
   =============================================== */

:root {
    /* Dark Mode (Standard) */
    --bg-primary: #0a0e1a;
    --bg-secondary: #151b2e;
    --bg-tertiary: #1e2742;
    --bg-hover: #2a3552;
    --bg-active: #1cb0f6;
    
    --text-primary: #e8eaf0;
    --text-secondary: #9ca3b4;
    --text-muted: #6b7280;
    
    --border-color: #2a3552;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    
    --accent-primary: #1cb0f6;
    --accent-secondary: #0a8cd4;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --accent-info: #06b6d4;
    
    /* Priority Colors */
    --priority-low: #6b7280;
    --priority-normal: #06b6d4;
    --priority-high: #f59e0b;
    --priority-critical: #ef4444;
    
    /* Status Colors */
    --status-open: #10b981;
    --status-progress: #f59e0b;
    --status-waiting: #06b6d4;
    --status-solved: #10b981;
    --status-closed: #6b7280;
}

/* Light Mode */
[data-theme="light"] {
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --bg-hover: #e5e7eb;
    --bg-active: #1cb0f6;
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --border-color: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
}

/* ============== RESET & BASE ============== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden; /* Verhindert horizontales Scrollen auf Mobile */
    -webkit-text-size-adjust: 100%; /* Verhindert Auto-Zoom in iOS */
}

/* ============== SCROLLBAR ============== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* ============== TYPOGRAPHY ============== */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

/* ============== CONTAINER ============== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ============== HEADER ============== */
.header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px var(--shadow);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* ============== NAVIGATION ============== */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.nav-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

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

.nav-tab.active {
    background: var(--accent-primary);
    color: white;
}

/* ============== BUTTONS ============== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(28, 176, 246, 0.3);
}

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(28, 176, 246, 0.4);
}

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

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

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

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 6px;
}

/* ============== CARDS ============== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 16px var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* ============== GRID LAYOUTS ============== */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ============== DASHBOARD LAYOUT ============== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.main-content {
    min-height: 400px;
}

/* ============== TICKET LIST ============== */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.ticket-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent-primary);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.ticket-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateX(4px);
}

.ticket-item:hover::before {
    transform: scaleY(1);
}

.ticket-info-compact {
    flex: 1;
}

.ticket-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ticket-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

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

/* ============== BADGES ============== */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-priority-niedrig {
    background: rgba(107, 114, 128, 0.2);
    color: var(--priority-low);
    border: 1px solid var(--priority-low);
}

.badge-priority-normal {
    background: rgba(6, 182, 212, 0.2);
    color: var(--priority-normal);
    border: 1px solid var(--priority-normal);
}

.badge-priority-hoch {
    background: rgba(245, 158, 11, 0.2);
    color: var(--priority-high);
    border: 1px solid var(--priority-high);
}

.badge-priority-kritisch {
    background: rgba(239, 68, 68, 0.2);
    color: var(--priority-critical);
    border: 1px solid var(--priority-critical);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.badge-status-offen {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-open);
    border: 1px solid var(--status-open);
}

.badge-status-inbearbeitung {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-progress);
    border: 1px solid var(--status-progress);
}

.badge-status-wartetaufantwort {
    background: rgba(6, 182, 212, 0.2);
    color: var(--status-waiting);
    border: 1px solid var(--status-waiting);
}

.badge-status-gelöst {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-solved);
    border: 1px solid var(--status-solved);
}

.badge-status-geschlossen {
    background: rgba(107, 114, 128, 0.2);
    color: var(--status-closed);
    border: 1px solid var(--status-closed);
}

/* ============== TAGS ============== */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tag:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.tag-input {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ============== FORMS ============== */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

select.form-control {
    cursor: pointer;
}

/* ============== SEARCH & FILTER ============== */
.search-bar {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(28, 176, 246, 0.1);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.25rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.filter-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ============== CHAT INTERFACE ============== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.chat-header {
    padding: 1.25rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* ===================================================
   DISCORD-STYLE NACHRICHTEN – KOMPLETTES REDESIGN
   =================================================== */

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

/* ── Wrapper: volle Breite, kein Bubble-Padding ── */
.message {
    width: 100%;
    animation: msgFadeIn 0.2s ease;
    position: relative;
}

/* ── Hover-Highlight wie Discord ── */
.message:hover {
    background: rgba(255,255,255,0.025);
    border-radius: 4px;
}

/* ── Zeile: Avatar + Content ── */
.msg-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.35rem 0.5rem;
}

/* Eigene Nachrichten: Avatar rechts, content rechts */
.message-own .msg-row {
    flex-direction: row-reverse;
}

/* ── Avatar ── */
.msg-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    margin-top: 2px;
    /* border-color kommt per inline style (Rollenfarbe) */
    border: 2.5px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ── Rechter Bereich: Meta + Text ── */
.msg-bubble-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
    max-width: calc(100% - 60px);
}

/* Eigene: rechtsbündig */
.message-own .msg-bubble-wrap {
    align-items: flex-end;
}

/* ── Meta-Zeile: Name + Rolle + Zeit ── */
.msg-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    line-height: 1;
    margin-bottom: 0.15rem;
}

.message-own .msg-meta {
    flex-direction: row-reverse;
}

/* Name – in Rollenfarbe (wird per inline style gesetzt) */
.msg-author {
    font-weight: 700;
    font-size: 0.92rem;
    white-space: nowrap;
    /* color wird inline gesetzt (= Rollenfarbe) */
}

/* Zeit */
.msg-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 400;
}

/* Rollen-Tag – Discord-style pill */
.msg-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.08rem 0.5rem;
    border-radius: 3px;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    /* background + color werden inline gesetzt */
}

/* ── Nachrichten-Text – KEIN Bubble für andere ── */
.msg-bubble {
    font-size: 0.93rem;
    line-height: 1.65;
    word-break: break-word;
    color: var(--text-primary);
    padding: 0;          /* kein Padding = echter Discord-Stil */
    background: none;
    border: none;
}

/* Eigene Nachrichten: leicht hervorgehobene Bubble */
.message-own .msg-bubble {
    background: #2b3a55;
    color: #e8eaf0;
    padding: 0.55rem 0.85rem;
    border-radius: 12px 12px 4px 12px;
    border: 1px solid rgba(255,255,255,0.08);
    max-width: 100%;
}

/* Nachrichtentext */
.msg-text {
    line-height: 1.65;
    white-space: pre-wrap;
}
.msg-text a {
    color: var(--accent-primary);
    text-decoration: underline;
    word-break: break-all;
}
.message-own .msg-text a {
    color: #9ecfff;
}

/* System-Nachrichten (zentriert) */
.message-system {
    text-align: center;
}
.message-system .msg-row {
    justify-content: center;
}
.message-system .msg-bubble {
    background: rgba(107,114,128,0.1);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 0.4rem 1rem;
    border-radius: 8px;
}

/* ── Löschen-Button (erscheint beim Hover oben rechts) ── */
.msg-delete-btn {
    position: absolute;
    top: 4px;
    right: 6px;
    opacity: 0;
    transition: opacity 0.15s;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
    line-height: 1;
}
.message:hover .msg-delete-btn { opacity: 1; }
.msg-delete-btn:hover { color: var(--accent-error); background: var(--bg-tertiary); }

/* ── Anhänge ── */
.msg-attachment {
    margin-top: 0.5rem;
}
.msg-attachment img {
    max-width: 360px;
    max-height: 300px;
    border-radius: 8px;
    display: block;
    margin-bottom: 0.4rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: opacity 0.2s;
}
.msg-attachment img:hover { opacity: 0.85; }
.msg-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.82rem;
    max-width: 320px;
    transition: background 0.15s;
}
.msg-attachment-file:hover { background: var(--bg-hover); }
.msg-attachment-file i { font-size: 1rem; flex-shrink: 0; color: var(--accent-primary); }
.msg-attachment-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-attachment-size { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }
.msg-attachment-dl { color: var(--text-muted); margin-left: 0.3rem; flex-shrink: 0; }
.msg-attachment-dl:hover { color: var(--accent-primary); }

/* ── Legacy-Compat ── */
.message-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.message-author { font-weight: 600; font-size: 0.875rem; }
.message-time { font-size: 0.75rem; color: var(--text-muted); }
.role-badge {
    display: inline-block; padding: 0.08rem 0.5rem; border-radius: 3px;
    font-size: 0.67rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.03em; color: white; white-space: nowrap;
}
.message-content { line-height: 1.65; word-wrap: break-word; }
.message-content p { margin-bottom: 0.5rem; }
.message-content p:last-child { margin-bottom: 0; }
.message-attachments { margin-top: 0.75rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }

.attachment {
    padding: 0.5rem 1rem;
    background: var(--bg-hover);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.attachment:hover {
    background: var(--bg-active);
    color: white;
}

/* ── Typing-Indikator (Discord-style, außerhalb des Chat-Scrollbereichs) ── */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem 0.1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    min-height: 22px;
    background: transparent;
    border-radius: 0;
    width: 100%;
}

.typing-indicator.hidden {
    visibility: hidden;  /* hidden statt display:none → hält Höhe und verhindert Layout-Sprung */
    pointer-events: none;
}

.typing-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    display: block;
    animation: typingBounce 1.2s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ── Chat-Input-Bereich ── */
.chat-input-container {
    padding: 0 1rem 0.75rem;
    background: var(--bg-secondary);
    border-top: none;
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;   /* center statt flex-end → einheitliche Ausrichtung */
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 0.4rem 0.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(28, 176, 246, 0.12);
}

/* Attachment-Button innerhalb der Wrapper-Box */
.chat-attach-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem 0.45rem;
    border-radius: 8px;
    font-size: 1.05rem;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
}
.chat-attach-btn:hover { color: var(--accent-primary); background: rgba(28,176,246,0.08); }

/* Textarea selbst – kein eigener Rahmen/Hintergrund, sitzt im Wrapper */
.chat-input {
    flex: 1;
    width: 100%;
    padding: 0.4rem 0.25rem;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: none;
    overflow-y: hidden;   /* kein Scrollbalken im Eingabefeld */
    min-height: 24px;
    max-height: 140px;
    box-sizing: border-box;
    display: block;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus { outline: none; box-shadow: none; border: none; }

/* Send-Button */
.chat-send-btn {
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    padding: 0.4rem 0.65rem;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
    line-height: 1;
    display: flex;
    align-items: center;
}
.chat-send-btn:hover  { background: var(--accent-secondary); }
.chat-send-btn:active { transform: scale(0.95); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============== STATISTICS ============== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-info));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px var(--shadow-lg);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============== MODAL ============== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

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

.modal-body {
    padding: 1.5rem;
}

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

/* ============== THEME TOGGLE ============== */
.theme-toggle {
    width: 60px;
    height: 30px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle::before {
    content: '🌙';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.theme-toggle::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: var(--accent-primary);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

[data-theme="light"] .theme-toggle::before {
    content: '☀️';
    left: auto;
    right: 4px;
}

[data-theme="light"] .theme-toggle::after {
    left: calc(100% - 26px);
}

/* ============== NOTIFICATIONS ============== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 24px var(--shadow-lg);
    max-width: 400px;
    animation: slideInRight 0.3s ease;
    z-index: 10000;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification-success {
    border-left: 4px solid var(--accent-success);
}

.notification-error {
    border-left: 4px solid var(--accent-error);
}

.notification-warning {
    border-left: 4px solid var(--accent-warning);
}

.notification-info {
    border-left: 4px solid var(--accent-info);
}

/* ============== LOADING ============== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============== TOOLTIPS ============== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* ============== RESPONSIVE ============== */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.35rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Header */
    .header-content {
        padding: 0 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .header-actions {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    /* Navigation Tabs */
    .nav-tabs {
        padding: 0.35rem;
        gap: 0.25rem;
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    .nav-tab {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
        border-radius: 6px;
    }

    /* Dashboard Grid */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Sidebar wird auf Mobile nicht sticky */
    .sidebar {
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    /* Buttons */
    .btn {
        padding: 0.65rem 1.1rem;
        font-size: 0.9rem;
    }

    .btn-small {
        padding: 0.45rem 0.8rem;
        font-size: 0.8rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
    }

    /* Ticket Items */
    .ticket-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }

    .ticket-item:hover {
        transform: none; /* Kein X-Shift auf Mobile */
    }

    .ticket-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .ticket-meta {
        gap: 0.5rem;
        font-size: 0.8rem;
    }

    .ticket-title {
        font-size: 0.95rem;
        flex-wrap: wrap;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Grid Layouts */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    /* Chat */
    .chat-container {
        height: calc(100vh - 120px);
        border-radius: 8px;
    }

    .chat-header {
        padding: 0.85rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .chat-messages {
        padding: 1rem;
        gap: 0.75rem;
    }

    .message {
        max-width: 88%;
        padding: 0.75rem 1rem;
    }

    .message-header {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .message-system {
        max-width: 95%;
    }

    .chat-input-container {
        padding: 0.75rem;
    }

    .chat-input {
        font-size: 0.9rem;
        padding: 0.65rem 0.85rem;
    }

    /* Filters */
    .filter-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filter-btn {
        width: 100%;
        text-align: center;
    }

    /* Search */
    .search-bar {
        margin-bottom: 1rem;
    }

    /* Modal */
    .modal-content {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    /* Notifications */
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    /* Form */
    .form-group {
        margin-bottom: 1rem;
    }

    /* Tags */
    .tags {
        gap: 0.35rem;
    }

    /* Tooltips auf Mobile deaktivieren */
    [data-tooltip]::after {
        display: none;
    }

    /* Theme Toggle */
    .theme-toggle {
        width: 50px;
        height: 26px;
    }

    .theme-toggle::after {
        width: 18px;
        height: 18px;
    }
}

/* Sehr kleine Bildschirme (≤ 400px) */
@media (max-width: 400px) {
    .container {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.4rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .message {
        max-width: 95%;
    }

    .nav-tab {
        padding: 0.5rem 0.65rem;
        font-size: 0.8rem;
    }

    .btn {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
    }
}

/* ============== UTILITY CLASSES ============== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--accent-primary); }
.text-success { color: var(--accent-success); }
.text-danger { color: var(--accent-error); }
.text-warning { color: var(--accent-warning); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none; }
.visible { display: block; }