/**
 * MODUL-CSS: layout (Basis-Rahmen, Sidebar, Header, Buttons, Formulare)
 * Alle Hauptwerte beziehen sich auf die CSS-Variablen aus dem Design-Modul,
 * können aber auch direkt hier angepasst werden.
 */

:root {
    --layout-primary: #E66E00;
    --layout-secondary: #142942;
    --layout-bg: #F4F6F9;
    --layout-sidebar-width: 270px;
    --layout-font-size: 15px;
    --layout-radius: 10px;
}

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

body.we-body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    font-size: var(--layout-font-size, 15px);
    background-color: var(--layout-bg, #F4F6F9);
    color: #1E293B;
    line-height: 1.55;
    min-height: 100vh;
}

/* App Shell */
.we-app-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.we-sidebar {
    width: var(--layout-sidebar-width, 270px);
    background: var(--layout-secondary, #142942);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.we-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.we-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: var(--layout-radius, 10px);
    background: var(--layout-primary, #E66E00);
    color: #FFFFFF;
    font-weight: 800;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.we-brand-logo {
    max-width: 48px;
    max-height: 48px;
    border-radius: 6px;
    object-fit: contain;
    background: #fff;
    padding: 3px;
}

.we-brand-text {
    display: flex;
    flex-direction: column;
}

.we-brand-title {
    font-weight: 700;
    font-size: 1.08rem;
    letter-spacing: 0.2px;
}

.we-brand-sub {
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.72);
}

/* Navigation */
.we-nav {
    flex: 1;
    padding: 14px 12px;
    overflow-y: auto;
}

.we-nav-group {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
    margin: 14px 10px 6px;
    font-weight: 600;
}

.we-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 13px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    border-radius: var(--layout-radius, 10px);
    margin-bottom: 4px;
    font-weight: 500;
    transition: background 0.18s ease, color 0.18s ease;
}

.we-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.we-nav-link.is-active {
    background: var(--layout-primary, #E66E00);
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(230, 110, 0, 0.32);
}

.we-nav-icon {
    display: inline-flex;
    align-items: center;
}

/* Sidebar Footer */
.we-sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.15);
}

.we-user-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.we-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--layout-primary, #E66E00);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.we-user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.we-user-role {
    display: inline-block;
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 5px;
    margin-top: 2px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-sys-suser {
    background: #E66E00;
    color: #fff;
}

.badge-sys-admin {
    background: #2563EB;
    color: #fff;
}

.badge-sys-super_member {
    background: #0D9488;
    color: #fff;
}

.badge-sys-member {
    background: rgba(255, 255, 255, 0.18);
    color: #E2E8F0;
}

.we-sidebar-actions {
    display: flex;
    gap: 8px;
}

.we-btn-small {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.76rem;
    padding: 7px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    transition: background 0.15s;
}

.we-btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
}

.we-btn-logout:hover {
    background: #DC2626;
}

/* Main Area */
.we-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.we-topbar {
    background: #FFFFFF;
    padding: 18px 28px;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.we-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.we-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: inherit;
}

.we-page-subtitle {
    font-size: 0.86rem;
    opacity: 0.75;
}

.we-topbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.we-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #CBD5E1;
    border-left-width: 4px;
    background: #F8FAFC;
    color: #0F172A !important;
    white-space: nowrap;
    line-height: 1.3;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.we-pill::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pill-color, currentColor);
    flex-shrink: 0;
}

.we-content {
    flex: 1;
    padding: 26px 28px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.we-footer {
    padding: 16px 28px;
    border-top: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: #64748B;
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

/* Allgemeine Karten, Buttons & Formular-Komponenten */
.we-card {
    background: #FFFFFF;
    border-radius: var(--layout-radius, 10px);
    border: 1px solid #E2E8F0;
    padding: 22px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
    margin-bottom: 22px;
}

.we-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #F1F5F9;
}

.we-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--layout-secondary, #142942);
}

.we-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--layout-radius, 10px);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.16s ease;
    background: var(--layout-primary, #E66E00);
    color: #FFFFFF;
}

.we-btn:hover {
    filter: brightness(0.93);
}

.we-btn-secondary {
    background: #F1F5F9;
    color: #1E293B;
    border-color: #CBD5E1;
}

.we-btn-secondary:hover {
    background: #E2E8F0;
}

.we-btn-danger {
    background: #DC2626;
    color: #FFFFFF;
}

.we-form-group {
    margin-bottom: 16px;
}

.we-label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 6px;
    color: #334155;
}

.we-input,
.we-select,
.we-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #CBD5E1;
    border-radius: calc(var(--layout-radius, 10px) - 2px);
    font-size: 0.94rem;
    font-family: inherit;
    background: #FFFFFF;
    color: #0F172A;
}

.we-input:focus,
.we-select:focus,
.we-textarea:focus {
    outline: none;
    border-color: var(--layout-primary, #E66E00);
    box-shadow: 0 0 0 3px rgba(230, 110, 0, 0.16);
}

/* Alerts / Flash-Meldungen */
.we-alert {
    padding: 13px 16px;
    border-radius: var(--layout-radius, 10px);
    margin-bottom: 18px;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.we-alert-success {
    background: #ECFDF5;
    color: #065F46;
    border-left-color: #10B981;
}

.we-alert-error {
    background: #FEF2F2;
    color: #991B1B;
    border-left-color: #EF4444;
}

.we-alert-info {
    background: #EFF6FF;
    color: #1E40AF;
    border-left-color: #3B82F6;
}

/* Mobile Navigation */
.we-mobile-toggle {
    display: none;
    background: var(--layout-secondary, #142942);
    color: #fff;
    border: none;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 900px) {
    .we-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -100%;
        transition: left 0.25s ease;
    }
    .we-sidebar.is-open {
        left: 0;
    }
    .we-mobile-toggle {
        display: inline-block;
    }
    .we-content {
        padding: 18px 16px;
    }
}
