/* ============================================================
   Piron Intranet – Stylesheet
   Farben: #035eb8 (Blau), #125eb1 (Blau alt.), #a29f95 (Grau)
   ============================================================ */

:root {
    --piron-blue:       #035eb8;
    --piron-blue-dark:  #024a92;
    --piron-blue-hover: #125eb1;
    --piron-gray:       #a29f95;
    --piron-gray-light: #f5f4f2;
    --piron-gray-mid:   #e8e6e2;
    --sidebar-width:    260px;
    --topbar-height:    60px;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--piron-gray-light);
    color: #2c2c2c;
    margin: 0;
    overflow-x: hidden;
}

/* ── Wrapper ── */
#wrapper {
    min-height: 100vh;
    position: relative;
}

/* ══════════════════════════════════════════
   OVERLAY (Mobile)
══════════════════════════════════════════ */
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

#sidebarOverlay.active {
    display: block;
}

/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */
#sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--piron-blue) 0%, var(--piron-blue-dark) 100%);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.25s ease, width 0.25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    z-index: 1000;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    text-align: center;
}

.sidebar-logo img {
    max-width: 160px;
    max-height: 60px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 16px 0;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav .nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.45);
    padding: 8px 20px 4px;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-radius: 0 24px 24px 0;
    margin-right: 12px;
    transition: background 0.15s, color 0.15s;
    min-height: 48px;
}

.sidebar-nav li a i {
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.sidebar-nav li a.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-info i {
    font-size: 26px;
    color: rgba(255,255,255,0.75);
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
}

.btn-logout {
    color: rgba(255,255,255,0.65);
    font-size: 20px;
    text-decoration: none;
    flex-shrink: 0;
    transition: color 0.15s;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-logout:hover {
    color: #fff;
}

/* ══════════════════════════════════════════
   CONTENT AREA
══════════════════════════════════════════ */
#content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--piron-gray-mid);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-bar #sidebarToggle {
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--piron-gray);
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.top-bar #sidebarToggle:hover {
    color: var(--piron-blue);
    background: var(--piron-gray-light);
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    color: #2c2c2c;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-inner {
    padding: 20px 16px;
    flex: 1;
}

/* ══════════════════════════════════════════
   CARDS
══════════════════════════════════════════ */
.card {
    border: 1px solid var(--piron-gray-mid);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--piron-gray-mid);
    font-weight: 600;
    padding: 14px 16px;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 16px;
}

/* ══════════════════════════════════════════
   BUTTONS – Touch-freundlich
══════════════════════════════════════════ */
.btn {
    min-height: 44px;
}

.btn-sm {
    min-height: 36px;
}

.btn-primary {
    background-color: var(--piron-blue);
    border-color: var(--piron-blue);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--piron-blue-dark);
    border-color: var(--piron-blue-dark);
}

.btn-outline-primary {
    color: var(--piron-blue);
    border-color: var(--piron-blue);
}

.btn-outline-primary:hover {
    background-color: var(--piron-blue);
    border-color: var(--piron-blue);
}

/* ══════════════════════════════════════════
   TABLES
══════════════════════════════════════════ */
.table thead th {
    background: var(--piron-gray-light);
    color: #555;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--piron-gray-mid);
}

.table tbody tr:hover {
    background: #f0f5fc;
}

.table td, .table th {
    vertical-align: middle;
}

/* ══════════════════════════════════════════
   BADGES / ROLLEN
══════════════════════════════════════════ */
.badge-rolle-1 { background: #dc3545; }
.badge-rolle-2 { background: var(--piron-blue); }
.badge-rolle-3 { background: #198754; }
.badge-rolle-4 { background: #fd7e14; }

/* ══════════════════════════════════════════
   ALERTS
══════════════════════════════════════════ */
.alert { border-radius: 8px; }

/* ══════════════════════════════════════════
   FORMS
══════════════════════════════════════════ */
.form-control, .form-select {
    min-height: 44px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--piron-blue);
    box-shadow: 0 0 0 0.2rem rgba(3, 94, 184, 0.2);
}

/* ══════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, var(--piron-blue) 0%, var(--piron-blue-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 14px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo img {
    max-width: 180px;
    max-height: 70px;
    object-fit: contain;
}

.login-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c2c2c;
    text-align: center;
    margin-bottom: 6px;
}

.login-sub {
    font-size: 14px;
    color: var(--piron-gray);
    text-align: center;
    margin-bottom: 24px;
}

/* ══════════════════════════════════════════
   DASHBOARD STATS
══════════════════════════════════════════ */
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px 20px;
    border: 1px solid var(--piron-gray-mid);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #e8f0fb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--piron-blue);
    flex-shrink: 0;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #2c2c2c;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--piron-gray);
    margin-top: 2px;
}

/* ══════════════════════════════════════════
   RESPONSIVE – Tablet
══════════════════════════════════════════ */
@media (max-width: 991px) {
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 1000;
    }

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

    #content {
        width: 100%;
    }

    .content-inner {
        padding: 16px 12px;
    }
}

/* ══════════════════════════════════════════
   RESPONSIVE – Mobile
══════════════════════════════════════════ */
@media (max-width: 576px) {
    .page-title {
        font-size: 15px;
    }

    .card-header {
        font-size: 14px;
    }

    .stat-value {
        font-size: 22px;
    }

    .login-card {
        padding: 28px 20px;
    }

    /* Tabelle: weniger wichtige Spalten ausblenden */
    .table .hide-mobile {
        display: none;
    }

    /* Buttons in Tabelle stapeln */
    .table td .d-flex {
        flex-wrap: wrap;
    }
}

/* ══════════════════════════════════════════
   DESKTOP – Sidebar immer sichtbar
══════════════════════════════════════════ */
@media (min-width: 992px) {
    #sidebar {
        transform: none !important;
    }

    #wrapper.sidebar-collapsed #sidebar {
        width: 0;
        padding: 0;
    }

    #sidebarOverlay {
        display: none !important;
    }
}

/* ── Safe Area – Home-Indicator Unterkante (iPhone) ── */
@supports (padding: env(safe-area-inset-bottom)) {
    .sidebar-footer {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

/* ── Logo im Top-Bar (nur Mobile, Sidebar dort versteckt) ── */
.topbar-logo-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.topbar-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
    max-width: 150px;
}
