/**
 * DAICMS Layout V2 - Barrierefreies Basis-CSS
 * WCAG 2.1 Level AA konform
 *
 * @version 2.0.0
 * @since 2026-01-25
 */

/* =====================================================
   1. CSS RESET (Modern, Accessibility-aware)
   ===================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

html {
    font-size: 100%; /* Respects user browser settings */
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
}

/* =====================================================
   2. CSS CUSTOM PROPERTIES (Light Mode Default)
   ===================================================== */

:root {
    /* Colors - WCAG AA Contrast Ratios verified */
    --color-primary: #2563eb;           /* Blue - 4.5:1 on white */
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --accent-color: #2563eb;            /* Alias fuer --color-primary (Kalender, Modals) */

    --color-success: #059669;           /* Green - 4.5:1 on white */
    --color-warning: #d97706;           /* Orange - 4.5:1 on white */
    --color-error: #dc2626;             /* Red - 4.5:1 on white */
    --color-info: #0284c7;              /* Sky - 4.5:1 on white */
    --color-accent: #7c3aed;            /* Purple - AI/Accent */

    /* Semantische Hintergruende (Light) */
    --color-success-bg: #d1fae5;
    --color-warning-bg: #fef3c7;
    --color-error-bg: #fee2e2;
    --color-info-bg: #dbeafe;
    --color-accent-bg: #ede9fe;

    /* Alert-Farben (Light) */
    --alert-success-bg: #d1fae5;
    --alert-success-border: #a7f3d0;
    --alert-success-text: #065f46;
    --alert-error-bg: #fee2e2;
    --alert-error-border: #fecaca;
    --alert-error-text: #991b1b;
    --alert-warning-bg: #fef3c7;
    --alert-warning-border: #fde68a;
    --alert-warning-text: #92400e;
    --alert-info-bg: #dbeafe;
    --alert-info-border: #bfdbfe;
    --alert-info-text: #1e40af;

    /* Text colors - WCAG AA compliant */
    --text-primary: #1f2937;            /* Contrast 12.6:1 on white */
    --text-secondary: #4b5563;          /* Contrast 7.5:1 on white */
    --text-muted: #6b7280;              /* Contrast 5.0:1 on white - minimum */
    --text-inverted: #ffffff;

    /* Backgrounds */
    --bg-body: #f9fafb;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;
    --bg-hover: #f3f4f6;
    --bg-active: #e5e7eb;
    --bg-tertiary: #f3f4f6;

    /* Header Icons */
    --header-icon-color: #4b5563;
    --header-icon-hover: #1f2937;

    /* Borders */
    --border-color: #e5e7eb;
    --border-color-strong: #d1d5db;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-sm: 4px;

    /* Border-Radius Aliase (kompatibel mit --radius-* Notation) */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Focus */
    --focus-ring-color: var(--color-primary);
    --focus-ring-width: 3px;
    --focus-ring-offset: 2px;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --header-height: 64px;
    --content-max-width: 1400px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;
}

/* =====================================================
   3. DARK MODE (System Preference + Manual Override)
   ===================================================== */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-primary: #3b82f6;
        --color-primary-hover: #60a5fa;
        --color-primary-light: #1e3a5f;
        --accent-color: #3b82f6;

        --text-primary: #f3f4f6;
        --text-secondary: #d1d5db;
        --text-muted: #b0b5bd;          /* Contrast 5.0:1 on #111827 - WCAG AA */
        --text-inverted: #1f2937;

        --bg-body: #111827;
        --bg-card: #1f2937;
        --bg-sidebar: #1f2937;
        --bg-header: #1f2937;
        --bg-hover: #374151;
        --bg-active: #4b5563;

        --border-color: #374151;
        --border-color-strong: #4b5563;

        --bg-tertiary: #374151;

        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);

        /* Header Icons im Dark Mode */
        --header-icon-color: #d1d5db;
        --header-icon-hover: #f3f4f6;

        /* Semantische Hintergruende (Dark) */
        --color-success-bg: #064e3b;
        --color-warning-bg: #78350f;
        --color-error-bg: #7f1d1d;
        --color-info-bg: #1e3a8a;
        --color-accent-bg: #2e1065;
        --color-accent: #a78bfa;

        /* Alert-Farben Dark Mode */
        --alert-success-bg: #064e3b;
        --alert-success-border: #065f46;
        --alert-success-text: #a7f3d0;
        --alert-error-bg: #7f1d1d;
        --alert-error-border: #991b1b;
        --alert-error-text: #fecaca;
        --alert-warning-bg: #78350f;
        --alert-warning-border: #92400e;
        --alert-warning-text: #fde68a;
        --alert-info-bg: #1e3a8a;
        --alert-info-border: #1e40af;
        --alert-info-text: #bfdbfe;
    }
}

/* Manual Dark Mode Override */
[data-theme="dark"] {
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-primary-light: #1e3a5f;
    --accent-color: #3b82f6;

    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-muted: #b0b5bd;          /* Contrast 5.0:1 on #111827 - WCAG AA */
    --text-inverted: #1f2937;

    --bg-body: #111827;
    --bg-card: #1f2937;
    --bg-sidebar: #1f2937;
    --bg-header: #1f2937;
    --bg-hover: #374151;
    --bg-active: #4b5563;
    --bg-tertiary: #374151;

    --border-color: #374151;
    --border-color-strong: #4b5563;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);

    /* Header Icons im Dark Mode - besser sichtbar */
    --header-icon-color: #d1d5db;
    --header-icon-hover: #f3f4f6;

    /* Semantische Hintergruende (Dark) */
    --color-success-bg: #064e3b;
    --color-warning-bg: #78350f;
    --color-error-bg: #7f1d1d;
    --color-info-bg: #1e3a8a;
    --color-accent-bg: #2e1065;
    --color-accent: #a78bfa;

    /* Alert-Farben Dark Mode */
    --alert-success-bg: #064e3b;
    --alert-success-border: #065f46;
    --alert-success-text: #a7f3d0;
    --alert-error-bg: #7f1d1d;
    --alert-error-border: #991b1b;
    --alert-error-text: #fecaca;
    --alert-warning-bg: #78350f;
    --alert-warning-border: #92400e;
    --alert-warning-text: #fde68a;
    --alert-info-bg: #1e3a8a;
    --alert-info-border: #1e40af;
    --alert-info-text: #bfdbfe;
}

/* Manual Light Mode Override */
[data-theme="light"] {
    --color-primary: #2563eb;
    --accent-color: #2563eb;

    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;

    --bg-body: #f9fafb;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;

    --border-color: #e5e7eb;
}

/* =====================================================
   4. ACCESSIBILITY - SKIP LINK
   ===================================================== */

.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    z-index: 10000;
    padding: var(--space-3) var(--space-4);
    background: var(--color-primary);
    color: var(--text-inverted);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--space-4);
    outline: var(--focus-ring-width) solid var(--text-inverted);
    outline-offset: var(--focus-ring-offset);
}

/* =====================================================
   5. ACCESSIBILITY - FOCUS STYLES
   ===================================================== */

:focus {
    outline: none;
}

:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

/* Interactive elements with enhanced focus */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

a:focus-visible {
    text-decoration: underline;
}

/* =====================================================
   6. BASE TYPOGRAPHY
   ===================================================== */

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text-primary);
    background-color: var(--bg-body);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

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

a {
    color: var(--color-primary);
    text-decoration: none;
}

/* Links in Fliesstext unterstreichen */
p a, li a, td a, dd a, figcaption a, blockquote a {
    text-decoration: underline;
}

a:hover {
    color: var(--color-primary-hover);
}

/* =====================================================
   7. LAYOUT STRUCTURE
   ===================================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 100;
    transition: width var(--transition-normal);
}

.app-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.app-sidebar.collapsed + .app-main {
    margin-left: var(--sidebar-collapsed-width);
}

.app-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    z-index: 50;
    display: flex;
    align-items: center;
    padding: 0 var(--space-6);
}

.app-content {
    flex: 1;
    padding: var(--space-6);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
}

.app-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: var(--content-max-width);
    width: 100%;
    margin: 0 auto;
    margin-top: auto;
}

/* =====================================================
   8. BREADCRUMBS (WCAG 2.1 compliant)
   ===================================================== */

.breadcrumb-nav {
    margin-bottom: var(--space-6);
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: var(--text-sm);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    margin: 0 var(--space-2);
    color: var(--text-muted);
}

.breadcrumb-item a {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover,
.breadcrumb-item a:focus {
    text-decoration: underline;
}

.breadcrumb-item.active span {
    color: var(--text-muted);
}

/* =====================================================
   9. CARDS
   ===================================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
}

/* =====================================================
   10. BUTTONS
   ===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--text-inverted);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

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

.btn-danger {
    background: var(--color-error);
    color: var(--text-inverted);
}

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

/* =====================================================
   11. FORMS
   ===================================================== */

.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-control:invalid:not(:placeholder-shown),
.form-control[aria-invalid="true"] {
    border-color: var(--color-error);
}

.form-hint {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.error-message {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    color: var(--color-error);
}

/* =====================================================
   12. TABLES
   ===================================================== */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table caption {
    padding: var(--space-3);
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-hover);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

/* =====================================================
   13. ALERTS / MESSAGES
   ===================================================== */

.alert {
    padding: var(--space-4);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-4);
}

.alert-success {
    background: var(--alert-success-bg, #d1fae5);
    border: 1px solid var(--alert-success-border, #a7f3d0);
    color: var(--alert-success-text, #065f46);
}

.alert-error {
    background: var(--alert-error-bg, #fee2e2);
    border: 1px solid var(--alert-error-border, #fecaca);
    color: var(--alert-error-text, #991b1b);
}

.alert-warning {
    background: var(--alert-warning-bg, #fef3c7);
    border: 1px solid var(--alert-warning-border, #fde68a);
    color: var(--alert-warning-text, #92400e);
}

.alert-info {
    background: var(--alert-info-bg, #dbeafe);
    border: 1px solid var(--alert-info-border, #bfdbfe);
    color: var(--alert-info-text, #1e40af);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .alert-success {
        background: var(--alert-success-bg, #064e3b);
        border-color: var(--alert-success-border, #065f46);
        color: var(--alert-success-text, #a7f3d0);
    }

    :root:not([data-theme="light"]) .alert-error {
        background: var(--alert-error-bg, #7f1d1d);
        border-color: var(--alert-error-border, #991b1b);
        color: var(--alert-error-text, #fecaca);
    }

    :root:not([data-theme="light"]) .alert-warning {
        background: var(--alert-warning-bg, #78350f);
        border-color: var(--alert-warning-border, #92400e);
        color: var(--alert-warning-text, #fde68a);
    }

    :root:not([data-theme="light"]) .alert-info {
        background: var(--alert-info-bg, #1e3a8a);
        border-color: var(--alert-info-border, #1e40af);
        color: #bfdbfe;
    }
}

/* =====================================================
   14. MODALS (WCAG compliant)
   ===================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0;
}

.modal-close {
    padding: var(--space-2);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--border-radius-sm);
}

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

.modal-body {
    padding: var(--space-5);
}

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

/* =====================================================
   15. RESPONSIVE BREAKPOINTS
   ===================================================== */

@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    :root {
        --space-4: 0.75rem;
        --space-6: 1rem;
    }

    .app-content {
        padding: var(--space-4);
    }
}

/* =====================================================
   16. UTILITY CLASSES
   ===================================================== */

/* Visually hidden but accessible to screen readers */
.sr-only,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Show on focus (for skip links etc.) */
.sr-only-focusable:focus,
.sr-only-focusable:focus-within {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Display */
.d-none { display: none; }
.d-flex { display: flex; }
.d-block { display: block; }

/* Flex utilities */
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

/* Spacing */
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mt-4 { margin-top: var(--space-4); }
.p-4 { padding: var(--space-4); }

/* =====================================================
   17. V2 KOMPONENTEN-SYSTEM (Zentrale Container)
   ===================================================== */

/**
 * .v2-section - Transparenter Hauptcontainer
 * Verwendung: Hauptbereiche ohne eigenen Hintergrund
 */
.v2-section {
    background: transparent;
    margin-bottom: var(--space-6);
}

.v2-section-header {
    margin-bottom: var(--space-4);
}

.v2-section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-1) 0;
}

.v2-section-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin: 0;
}

/**
 * .v2-panel - Container mit Hintergrund
 * Verwendung: Abgegrenzte Bereiche (Cards, Widgets)
 */
.v2-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--space-4);
}

.v2-panel--transparent {
    background: transparent;
    border: none;
    padding: 0;
}

.v2-panel--elevated {
    box-shadow: var(--shadow-md);
}

.v2-panel--flush {
    padding: 0;
}

.v2-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.v2-panel-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.v2-panel-title i,
.v2-panel-title svg {
    color: var(--color-primary);
}

/**
 * .v2-widget - Sidebar-Widget
 * Verwendung: Kompakte Info-Boxen in Sidebars
 */
.v2-widget {
    background: transparent;
    margin-bottom: var(--space-5);
}

.v2-widget-header {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.v2-widget-header i,
.v2-widget-header svg {
    color: var(--color-primary);
}

.v2-widget-content {
    /* Inhalt erbt Styling */
}

/**
 * .v2-form-field - Einheitliches Formularfeld
 */
.v2-form-field {
    margin-bottom: var(--space-4);
}

.v2-form-field:last-child {
    margin-bottom: 0;
}

.v2-form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.v2-form-label .required {
    color: var(--color-error);
    margin-left: var(--space-1);
}

.v2-form-input {
    display: block;
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.v2-form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
    outline: none;
}

.v2-form-input:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

.v2-form-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/**
 * .v2-chip - Kleine interaktive Tags/Buttons
 */
.v2-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.v2-chip:hover {
    border-color: var(--color-primary);
}

.v2-chip--active,
.v2-chip[aria-selected="true"] {
    background: var(--color-primary);
    color: var(--text-inverted);
    border-color: var(--color-primary);
}

.v2-chip:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

/**
 * .v2-list - Einheitliche Listen
 */
.v2-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.v2-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--border-radius);
    transition: background var(--transition-fast);
}

.v2-list-item:hover {
    background: var(--bg-hover);
}

.v2-list-item--interactive {
    cursor: pointer;
}

.v2-list-item--active {
    background: var(--color-primary-light);
}

/**
 * .v2-grid - Flexibles Grid-System
 */
.v2-grid {
    display: grid;
    gap: var(--space-4);
}

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

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

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

/**
 * .v2-toolbar - Button-Leiste
 */
.v2-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) 0;
}

.v2-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.v2-toolbar-btn:hover {
    background: var(--bg-active);
}

.v2-toolbar-btn[aria-expanded="true"],
.v2-toolbar-btn--active {
    background: var(--color-primary);
    color: var(--text-inverted);
    border-color: var(--color-primary);
}

.v2-toolbar-btn:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}
