/* ═══════════════════════════════════════════════════════════════
   ITIdee - Modern Elegant Design
   IT-Dienstleister: Gute Ideen, Zuverlässig, Gewissenhaft
   Stil: Seriös, Dezent, Modern-Elegant mit Glasmorphism
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   CSS Variables - Light Theme
   ═══════════════════════════════════════════════════════════════ */

:root,
[data-bs-theme="light"] {
    /* Primary Colors - Elegantes Petrol/Teal */
    --itidee-primary: #0d9488;
    --itidee-primary-dark: #0f766e;
    --itidee-primary-light: #14b8a6;
    --itidee-primary-subtle: rgba(13, 148, 136, 0.08);

    /* Secondary Colors - Warme Grautöne */
    --itidee-secondary: #64748b;
    --itidee-secondary-dark: #475569;
    --itidee-secondary-light: #94a3b8;

    /* Accent Colors - Dezente, harmonische Töne */
    --itidee-accent: #06b6d4;
    --itidee-success: #10b981;
    --itidee-warning: #f59e0b;
    --itidee-danger: #ef4444;

    /* Backgrounds - Sanfte, elegante Töne */
    --itidee-bg-body: #f8fafc;
    --itidee-bg-surface: #ffffff;
    --itidee-bg-elevated: #ffffff;
    --itidee-bg-light: #f1f5f9;
    --itidee-bg-white: #ffffff;
    --itidee-bg-sidebar: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    --itidee-bg-sidebar-solid: #1e293b;
    --itidee-bg-sidebar-hover: rgba(255, 255, 255, 0.08);

    /* Text Colors — bewusst dunkel gehalten:
       Grau-auf-weiss war auf vielen Pages schlecht lesbar (WCAG-Kontrast < 4.5:1
       bei #94a3b8 auf #ffffff). Statt grau verwenden wir durchgaengig fast-schwarz.
       Sidebar bleibt hell, weil dort dunkler Hintergrund. */
    --itidee-text-primary: #1e293b;
    --itidee-text-secondary: #1e293b;  /* zuvor #64748b — auf weiss schwer lesbar */
    --itidee-text-muted: #1e293b;       /* zuvor #94a3b8 — auf weiss schwer lesbar */
    --itidee-text-sidebar: rgba(255, 255, 255, 0.9);
    --itidee-text-sidebar-muted: rgba(255, 255, 255, 0.5);

    /* Borders - Dezent und elegant */
    --itidee-border: rgba(0, 0, 0, 0.08);
    --itidee-border-light: rgba(0, 0, 0, 0.04);

    /* Shadows - Weich und modern */
    --itidee-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --itidee-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --itidee-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    --itidee-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --itidee-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

    /* Glasmorphism */
    --itidee-glass-bg: rgba(255, 255, 255, 0.7);
    --itidee-glass-border: rgba(255, 255, 255, 0.2);
    --itidee-glass-blur: blur(20px);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --itidee-radius: 0.625rem;
    --itidee-radius-lg: 0.875rem;
    --itidee-radius-xl: 1.25rem;

    /* Transitions */
    --itidee-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --itidee-transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════════════
   CSS Variables - Dark Theme
   ═══════════════════════════════════════════════════════════════ */

[data-bs-theme="dark"] {
    /* Primary Colors - Elegantes Petrol/Teal im Dark Mode */
    --itidee-primary: #2dd4bf;
    --itidee-primary-dark: #14b8a6;
    --itidee-primary-light: #5eead4;
    --itidee-primary-subtle: rgba(45, 212, 191, 0.12);

    /* Backgrounds - Tiefe, elegante Töne */
    --itidee-bg-body: #0f172a;
    --itidee-bg-surface: rgba(30, 41, 59, 0.8);
    --itidee-bg-elevated: rgba(51, 65, 85, 0.6);
    --itidee-bg-light: rgba(30, 41, 59, 0.6);
    --itidee-bg-white: #1e293b;
    --itidee-bg-sidebar: linear-gradient(180deg, #0f172a 0%, #020617 100%);
    --itidee-bg-sidebar-solid: #0f172a;
    --itidee-bg-sidebar-hover: rgba(255, 255, 255, 0.06);

    /* Text Colors */
    --itidee-text-primary: #f1f5f9;
    --itidee-text-secondary: #94a3b8;
    --itidee-text-muted: #64748b;

    /* Borders */
    --itidee-border: rgba(255, 255, 255, 0.08);
    --itidee-border-light: rgba(255, 255, 255, 0.04);

    /* Shadows */
    --itidee-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --itidee-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --itidee-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --itidee-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
    --itidee-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.4);

    /* Glasmorphism Dark */
    --itidee-glass-bg: rgba(30, 41, 59, 0.6);
    --itidee-glass-border: rgba(255, 255, 255, 0.08);
}

/* ═══════════════════════════════════════════════════════════════
   Base Styles
   ═══════════════════════════════════════════════════════════════ */

* {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

html, body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--itidee-text-primary);
    background-color: var(--itidee-bg-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════════════════
   App Layout (Authenticated Users)
   ═══════════════════════════════════════════════════════════════ */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════
   Sidebar - Dunkles, professionelles Design
   ═══════════════════════════════════════════════════════════════ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--itidee-bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: var(--itidee-transition-slow);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-brand .brand-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(135deg, var(--itidee-primary) 0%, var(--itidee-primary-dark) 100%);
    border-radius: var(--itidee-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.sidebar-close {
    background: transparent;
    border: none;
    color: var(--itidee-text-sidebar-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.sidebar-close:hover {
    color: #fff;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-section {
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 0.75rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--itidee-text-sidebar-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-section-title:hover {
    color: var(--itidee-text-sidebar);
}

/* Statische Section-Überschrift (nicht aufklappbar, z. B. "Häufig genutzt") */
.nav-section-title-static {
    cursor: default;
}

.nav-section-title-static:hover {
    color: var(--itidee-text-sidebar-muted);
}

.nav-section-title .nav-section-icon {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
}

.nav-section-title[aria-expanded="false"] .nav-section-icon {
    transform: rotate(-90deg);
}

.nav-section-title[aria-expanded="true"] .nav-section-icon {
    transform: rotate(0deg);
}

/* Nav Section Collapse Animation */
.nav-section-items {
    overflow: hidden;
}

.nav-section-items.collapsing {
    transition: height 0.25s ease;
}

/* Sub-Gruppen-Beschriftung innerhalb einer Sektion (z. B. "Ausgang", "Eingang") */
.nav-subgroup-label {
    padding: 0.5rem 0.875rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--itidee-text-sidebar-muted);
    opacity: 0.75;
}

.nav-subgroup-label:first-child {
    padding-top: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    margin: 0.125rem 0;
    color: var(--itidee-text-sidebar);
    text-decoration: none;
    border-radius: var(--itidee-radius);
    font-weight: 450;
    font-size: 0.9rem;
    transition: var(--itidee-transition);
    position: relative;
}

.nav-item i {
    font-size: 1rem;
    opacity: 0.6;
    width: 1.25rem;
    text-align: center;
    transition: var(--itidee-transition);
}

.nav-item:hover {
    background: var(--itidee-bg-sidebar-hover);
    color: #fff;
}

.nav-item:hover i {
    opacity: 0.9;
}

.nav-item.active {
    background: rgba(13, 148, 136, 0.15);
    color: #fff;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--itidee-primary);
    border-radius: 0 2px 2px 0;
}

.nav-item.active i {
    opacity: 1;
    color: var(--itidee-primary-light);
}

/* Benachrichtigungs-Badge im Sidebar-Eintrag (z. B. neue Eingangsrechnungen) */
.nav-badge {
    margin-left: auto;
    min-width: 1.25rem;
    padding: 0.05rem 0.4rem;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    border-radius: 999px;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--itidee-radius);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: var(--itidee-transition);
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.06);
}

.user-avatar {
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(135deg, var(--itidee-primary) 0%, var(--itidee-primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
    text-decoration: none;
    transition: var(--itidee-transition);
}

.user-avatar:hover {
    transform: scale(1.05);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    display: block;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: var(--itidee-transition);
}

.user-name:hover {
    color: #fff;
}

.user-role {
    display: block;
    font-size: 0.65rem;
    color: var(--itidee-text-sidebar-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.125rem;
}

.user-role.admin {
    color: rgba(251, 191, 36, 0.9);
}

.btn-logout {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--itidee-text-sidebar-muted);
    border-radius: var(--itidee-radius);
    transition: var(--itidee-transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* ═══════════════════════════════════════════════════════════════
   Main Wrapper (Content Area)
   ═══════════════════════════════════════════════════════════════ */

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--itidee-glass-bg);
    backdrop-filter: var(--itidee-glass-blur);
    -webkit-backdrop-filter: var(--itidee-glass-blur);
    border-bottom: 1px solid var(--itidee-border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    font-size: 1.35rem;
    color: var(--itidee-text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    display: none;
    border-radius: var(--itidee-radius);
    transition: var(--itidee-transition);
}

.sidebar-toggle:hover {
    background: var(--itidee-primary-subtle);
    color: var(--itidee-primary);
}

.header-title {
    flex: 1;
}

.header-title h1 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: var(--itidee-text-primary);
    letter-spacing: -0.01em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--itidee-radius);
    color: var(--itidee-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--itidee-transition);
}

.btn-icon:hover {
    background: var(--itidee-primary-subtle);
    color: var(--itidee-primary);
}

/* Pin-Button in der Kopfleiste (P11) — Form soll Flex-Layout nicht stören */
.header-pin-form {
    margin: 0;
    display: flex;
}

.btn-icon.is-pinned {
    color: var(--itidee-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
}

@media (min-width: 768px) {
    .main-content {
        padding: 2rem;
    }
}

/* Main Footer */
.main-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--itidee-text-muted);
    border-top: 1px solid var(--itidee-border);
    background: var(--itidee-bg-surface);
}

/* ═══════════════════════════════════════════════════════════════
   Mobile Sidebar
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1040;
        backdrop-filter: blur(4px);
    }

    .sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Public Layout (Non-Authenticated)
   ═══════════════════════════════════════════════════════════════ */

.public-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.navbar-public {
    background: var(--itidee-bg-surface);
    border-bottom: 1px solid var(--itidee-border);
    padding: 1rem 0;
    box-shadow: var(--itidee-shadow-sm);
}

.navbar-public .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--itidee-text-primary);
    text-decoration: none;
}

.navbar-public .navbar-brand:hover {
    color: var(--itidee-primary);
}

.navbar-public .brand-icon {
    width: 2.75rem;
    height: 2.75rem;
    background: linear-gradient(135deg, var(--itidee-primary-light) 0%, var(--itidee-primary) 100%);
    border-radius: var(--itidee-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.35rem;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.btn-login {
    background: linear-gradient(135deg, var(--itidee-primary-light) 0%, var(--itidee-primary) 100%);
    color: #fff;
    padding: 0.65rem 1.5rem;
    border-radius: var(--itidee-radius);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--itidee-primary) 0%, var(--itidee-primary-dark) 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.35);
}

.public-content {
    flex: 1;
    padding: 3rem 0;
}

.public-footer {
    background: var(--itidee-bg-sidebar);
    border-top: 1px solid var(--itidee-border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--itidee-text-sidebar-muted);
    font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════════
   Cards - Elegant Glass Design
   ═══════════════════════════════════════════════════════════════ */

.card {
    background: var(--itidee-bg-surface);
    border: 1px solid var(--itidee-border);
    border-radius: var(--itidee-radius-lg);
    box-shadow: var(--itidee-shadow-sm);
    transition: var(--itidee-transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--itidee-shadow);
    border-color: rgba(0, 0, 0, 0.1);
}

.card-header {
    background: var(--itidee-bg-light);
    border-bottom: 1px solid var(--itidee-border);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 1rem 1.25rem;
    color: var(--itidee-text-primary);
}

.card-header i {
    opacity: 0.7;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: var(--itidee-bg-light);
    border-top: 1px solid var(--itidee-border);
    padding: 1rem 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   Buttons - Elegant und Modern
   ═══════════════════════════════════════════════════════════════ */

.btn {
    font-weight: 500;
    border-radius: var(--itidee-radius);
    padding: 0.625rem 1.25rem;
    transition: var(--itidee-transition);
    border: none;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--itidee-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.2);
}

.btn-primary:hover {
    background: var(--itidee-primary-dark);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
    color: #fff;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--itidee-bg-light);
    color: var(--itidee-text-secondary);
    border: 1px solid var(--itidee-border);
}

.btn-secondary:hover {
    background: var(--itidee-bg-body);
    color: var(--itidee-text-primary);
    border-color: rgba(0, 0, 0, 0.12);
}

.btn-success {
    background: var(--itidee-success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    color: #fff;
}

.btn-danger {
    background: var(--itidee-danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    color: #fff;
}

.btn-warning {
    background: var(--itidee-warning);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.btn-warning:hover {
    background: #d97706;
    color: #fff;
}

.btn-outline-primary {
    background: transparent;
    border: 1.5px solid var(--itidee-primary);
    color: var(--itidee-primary);
}

.btn-outline-primary:hover {
    background: var(--itidee-primary-subtle);
    color: var(--itidee-primary);
}

.btn-outline-secondary {
    background: transparent;
    border: 1.5px solid var(--itidee-border);
    color: var(--itidee-text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--itidee-bg-light);
    border-color: var(--itidee-secondary-light);
    color: var(--itidee-text-primary);
}

.btn-outline-success {
    background: transparent;
    border: 1.5px solid var(--itidee-success);
    color: var(--itidee-success);
}

.btn-outline-success:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--itidee-success);
}

.btn-outline-danger {
    background: transparent;
    border: 1.5px solid var(--itidee-danger);
    color: var(--itidee-danger);
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--itidee-danger);
}

.btn-outline-warning {
    background: transparent;
    border: 1.5px solid var(--itidee-warning);
    color: var(--itidee-warning);
}

.btn-outline-warning:hover {
    background: rgba(245, 158, 11, 0.1);
    color: var(--itidee-warning);
}

.btn-outline-info {
    background: transparent;
    border: 1.5px solid var(--itidee-accent);
    color: var(--itidee-accent);
}

.btn-outline-info:hover {
    background: rgba(6, 182, 212, 0.1);
    color: var(--itidee-accent);
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

.btn-group-sm .btn {
    border-radius: var(--itidee-radius);
}

/* Fix für Icons in Button-Gruppen */
.btn-group-sm .btn i.bi,
.btn-group .btn i.bi,
.table .btn i.bi {
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal;
    font-size: 0.875rem;
    line-height: 1;
    display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════
   Forms - Clean and Elegant
   ═══════════════════════════════════════════════════════════════ */

.form-control,
.form-select {
    background: var(--itidee-bg-surface);
    border: 1px solid var(--itidee-border);
    border-radius: var(--itidee-radius);
    padding: 0.625rem 0.875rem;
    color: var(--itidee-text-primary);
    font-size: 0.9rem;
    transition: var(--itidee-transition);
}

.form-control:focus,
.form-select:focus {
    background: var(--itidee-bg-surface);
    border-color: var(--itidee-primary);
    box-shadow: 0 0 0 3px var(--itidee-primary-subtle);
    color: var(--itidee-text-primary);
    outline: none;
}

.form-control::placeholder {
    color: var(--itidee-text-muted);
    font-weight: 400;
}

.form-label {
    font-weight: 500;
    color: var(--itidee-text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.form-text {
    color: var(--itidee-text-muted);
    font-size: 0.75rem;
    margin-top: 0.375rem;
}

.input-group-text {
    background: var(--itidee-bg-light);
    border: 1px solid var(--itidee-border);
    color: var(--itidee-text-muted);
    font-size: 0.9rem;
}

.form-check-input:checked {
    background-color: var(--itidee-primary);
    border-color: var(--itidee-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--itidee-primary-subtle);
    border-color: var(--itidee-primary);
}

/* ═══════════════════════════════════════════════════════════════
   Tables - Clean and Refined
   ═══════════════════════════════════════════════════════════════ */

.table {
    background: var(--itidee-bg-surface);
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table-responsive {
    background: var(--itidee-bg-surface);
    border-radius: var(--itidee-radius-lg);
    box-shadow: var(--itidee-shadow-sm);
    overflow: hidden;
    border: 1px solid var(--itidee-border);
}

.table thead th {
    background: var(--itidee-bg-light);
    border-bottom: 1px solid var(--itidee-border);
    font-weight: 500;
    color: var(--itidee-text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--itidee-border-light);
    color: var(--itidee-text-primary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-hover tbody tr {
    transition: var(--itidee-transition);
}

.table-hover tbody tr:hover {
    background: var(--itidee-primary-subtle);
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(0, 0, 0, 0.015);
}

.table-secondary {
    --bs-table-bg: var(--itidee-bg-light);
}

/* Kontextuelle Tabellen-Zeilen (table-warning/-danger/-success/…) im Dark Mode:
   Bootstrap-Defaults sind fix helle Tönungen → sonst heller Text auf hellem
   Grund. Hintergrund dunkel tönen; der Zelltext folgt weiter dem Theme. */
[data-bs-theme="dark"] .table-warning { --bs-table-bg: rgba(245, 158, 11, 0.22); }
[data-bs-theme="dark"] .table-danger  { --bs-table-bg: rgba(239, 68, 68, 0.22); }
[data-bs-theme="dark"] .table-success { --bs-table-bg: rgba(16, 185, 129, 0.22); }
[data-bs-theme="dark"] .table-info    { --bs-table-bg: rgba(6, 182, 212, 0.22); }
[data-bs-theme="dark"] .table-primary { --bs-table-bg: rgba(45, 212, 191, 0.22); }
[data-bs-theme="dark"] .table-light   { --bs-table-bg: var(--itidee-bg-light); }

/* ═══════════════════════════════════════════════════════════════
   Page Headers
   ═══════════════════════════════════════════════════════════════ */

.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--itidee-border);
}

.page-header h1,
.page-header .h1 {
    font-weight: 700;
    color: var(--itidee-text-primary);
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
}

.page-header p {
    color: var(--itidee-text-secondary);
    margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Alerts - Subtle and Elegant
   ═══════════════════════════════════════════════════════════════ */

.alert {
    border: none;
    border-radius: var(--itidee-radius);
    border-left: 3px solid;
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-left-color: var(--itidee-success);
    color: #047857;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: var(--itidee-warning);
    color: #b45309;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: var(--itidee-danger);
    color: #b91c1c;
}

.alert-info {
    background: var(--itidee-primary-subtle);
    border-left-color: var(--itidee-primary);
    color: var(--itidee-primary-dark);
}

[data-bs-theme="dark"] .alert-success {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
}

[data-bs-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #fcd34d;
}

[data-bs-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

[data-bs-theme="dark"] .alert-info {
    background: rgba(45, 212, 191, 0.12);
    color: #5eead4;
}

/* ═══════════════════════════════════════════════════════════════
   Badges - Subtle Pills
   ═══════════════════════════════════════════════════════════════ */

.badge {
    font-weight: 500;
    padding: 0.35em 0.7em;
    border-radius: 9999px;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
}

.badge-status {
    font-size: 0.7rem;
    padding: 0.35em 0.75em;
}

.badge-success,
.bg-success {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #059669 !important;
}

.badge-warning,
.bg-warning {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #d97706 !important;
}

.badge-danger,
.bg-danger {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #dc2626 !important;
}

.badge-info,
.bg-info {
    background: rgba(6, 182, 212, 0.12) !important;
    color: #0891b2 !important;
}

.badge-primary,
.bg-primary {
    background: var(--itidee-primary-subtle) !important;
    color: var(--itidee-primary) !important;
}

.badge-secondary,
.bg-secondary {
    background: rgba(100, 116, 139, 0.12) !important;
    color: var(--itidee-secondary) !important;
}

[data-bs-theme="dark"] .badge-success,
[data-bs-theme="dark"] .bg-success {
    color: #6ee7b7 !important;
}

[data-bs-theme="dark"] .badge-warning,
[data-bs-theme="dark"] .bg-warning {
    color: #fcd34d !important;
}

[data-bs-theme="dark"] .badge-danger,
[data-bs-theme="dark"] .bg-danger {
    color: #fca5a5 !important;
}

[data-bs-theme="dark"] .badge-info,
[data-bs-theme="dark"] .bg-info {
    color: #67e8f9 !important;
}

[data-bs-theme="dark"] .badge-primary,
[data-bs-theme="dark"] .bg-primary {
    color: #5eead4 !important;
}

/* ═══════════════════════════════════════════════════════════════
   Modals - Elegant Glass Effect
   ═══════════════════════════════════════════════════════════════ */

.modal-backdrop {
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--itidee-bg-surface);
    border: 1px solid var(--itidee-border);
    border-radius: var(--itidee-radius-xl);
    box-shadow: var(--itidee-shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--itidee-border);
    padding: 1.25rem 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--itidee-text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--itidee-border);
    padding: 1rem 1.5rem;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   Dropdowns - Clean Floating Menus
   ═══════════════════════════════════════════════════════════════ */

.dropdown-menu {
    background: var(--itidee-bg-surface);
    border: 1px solid var(--itidee-border);
    border-radius: var(--itidee-radius-lg);
    box-shadow: var(--itidee-shadow-lg);
    padding: 0.375rem;
    min-width: 10rem;
}

.dropdown-item {
    border-radius: var(--itidee-radius);
    padding: 0.5rem 0.75rem;
    color: var(--itidee-text-primary);
    font-weight: 450;
    font-size: 0.875rem;
    transition: var(--itidee-transition);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--itidee-primary-subtle);
    color: var(--itidee-primary);
}

.dropdown-item.active {
    background: var(--itidee-primary);
    color: #fff;
}

.dropdown-divider {
    border-color: var(--itidee-border);
    margin: 0.375rem 0;
}

/* ═══════════════════════════════════════════════════════════════
   Toast Notifications
   ═══════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
}

.toast {
    background: var(--itidee-bg-surface);
    border: 1px solid var(--itidee-border);
    border-radius: var(--itidee-radius);
    box-shadow: var(--itidee-shadow-lg);
}

/* ═══════════════════════════════════════════════════════════════
   Loading & Spinners
   ═══════════════════════════════════════════════════════════════ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

[data-bs-theme="dark"] .loading-overlay {
    background: rgba(15, 23, 42, 0.95);
}

.spinner-itidee {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--itidee-border);
    border-top-color: var(--itidee-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   Pagination - Minimal Style
   ═══════════════════════════════════════════════════════════════ */

.pagination {
    gap: 0.25rem;
}

.page-link {
    border: 1px solid var(--itidee-border);
    border-radius: var(--itidee-radius);
    color: var(--itidee-text-secondary);
    padding: 0.5rem 0.75rem;
    font-weight: 450;
    font-size: 0.875rem;
    transition: var(--itidee-transition);
}

.page-link:hover {
    background: var(--itidee-primary-subtle);
    border-color: transparent;
    color: var(--itidee-primary);
}

.page-item.active .page-link {
    background: var(--itidee-primary);
    border-color: var(--itidee-primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
}

.page-item.disabled .page-link {
    background: transparent;
    color: var(--itidee-text-muted);
    border-color: var(--itidee-border-light);
}

/* ═══════════════════════════════════════════════════════════════
   Utilities
   ═══════════════════════════════════════════════════════════════ */

.text-primary { color: var(--itidee-primary) !important; }
.text-secondary { color: var(--itidee-text-secondary) !important; }
.text-muted { color: var(--itidee-text-muted) !important; }
.text-success { color: var(--itidee-success) !important; }
.text-warning { color: var(--itidee-warning) !important; }
.text-danger { color: var(--itidee-danger) !important; }

.bg-surface { background-color: var(--itidee-bg-surface) !important; }
.bg-body { background-color: var(--itidee-bg-body) !important; }

/* bg-light / bg-white theme-aware machen: Bootstrap-Defaults sind fix helle
   Farben — im Dark Mode ergibt das hellen Text auf hellem Grund (readonly-
   Inputs, Info-/Hinweis-Boxen `card bg-light`, sticky `thead.bg-white` …). */
.bg-light { background-color: var(--itidee-bg-light) !important; }
.bg-white { background-color: var(--itidee-bg-white) !important; }

.border-primary { border-color: var(--itidee-primary) !important; }
.border-light { border-color: var(--itidee-border) !important; }

.shadow-sm { box-shadow: var(--itidee-shadow-sm) !important; }
.shadow { box-shadow: var(--itidee-shadow) !important; }
.shadow-lg { box-shadow: var(--itidee-shadow-lg) !important; }

.rounded { border-radius: var(--itidee-radius) !important; }
.rounded-lg { border-radius: var(--itidee-radius-lg) !important; }
.rounded-xl { border-radius: var(--itidee-radius-xl) !important; }

/* ═══════════════════════════════════════════════════════════════
   Responsive Helpers
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 576px) {
    .main-content {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.5rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Scrollbar Styling - Minimal
   ═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

/* ═══════════════════════════════════════════════════════════════
   Print Styles
   ═══════════════════════════════════════════════════════════════ */

@media print {
    .sidebar,
    .top-header,
    .main-footer,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .main-content {
        padding: 0;
    }
}
