/* ===== VARIABLEN ===== */
:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1a1d21;
    --sidebar-hover: #2c3036;
    --sidebar-active: #0d6efd;
    --content-bg: #f4f6f9;
    --card-bg: #ffffff;
}

/* ===== LAYOUT ===== */
body {
    margin: 0;
    background: var(--content-bg);
    font-family: 'Segoe UI', sans-serif;
    color: #333;
}

#sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

#main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-wrapper {
    padding: 24px 32px;
}

/* ===== SIDEBAR ===== */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid #2c3036;
}

.sidebar-logo {
    font-size: 28px;
    color: #0d6efd;
    line-height: 1;
}

.brand-name {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.brand-company {
    display: block;
    font-size: 11px;
    color: #8a9bb0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.sidebar-nav {
    list-style: none;
    padding: 12px 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #adb5bd;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav li a.active {
    background: var(--sidebar-active);
    color: #fff;
    border-radius: 0 20px 20px 0;
    margin-right: 12px;
}

.sidebar-nav li a i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-divider {
    padding: 16px 16px 4px;
}

.nav-divider span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #556070;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #2c3036;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    color: #adb5bd;
    font-size: 18px;
    min-width: 0;
}

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

.user-role {
    font-size: 11px;
    color: #8a9bb0;
}

.logout-btn {
    color: #8a9bb0;
    font-size: 18px;
    text-decoration: none;
    transition: color 0.15s;
    flex-shrink: 0;
}

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

/* ===== LOGIN SEITE ===== */
.login-body {
    background: linear-gradient(135deg, #1a1d21 0%, #2c3e50 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0 !important;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon {
    font-size: 48px;
    color: #0d6efd;
}

.login-header h2 {
    margin: 8px 0 4px;
    font-weight: 700;
    letter-spacing: 2px;
}

.login-header p {
    color: #6c757d;
    margin: 0;
    font-size: 14px;
}

/* ===== SEITEN-HEADER ===== */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: #1a1d21;
    display: inline;
}

/* ===== CARDS ===== */
.card {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 16px;
    border-radius: 10px 10px 0 0 !important;
}

/* ===== KPI KARTEN ===== */
.kpi-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border: 1px solid #e9ecef;
}

.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    color: #1a1d21;
}

.kpi-label {
    font-size: 12px;
    color: #6c757d;
    margin-top: 4px;
}

/* ===== AMPEL ===== */
.ampel {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
}

.ampel-success { background: #198754; }
.ampel-warning { background: #ffc107; }
.ampel-danger  { background: #dc3545; }

/* ===== LEGENDE ===== */
.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== ERSATZTEIL-BADGE (Maschinendetail) ===== */
.part-badge {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 14px;
}

.part-badge.part-low {
    background: #fff5f5;
    border-color: #dc3545;
}

.part-name   { font-size: 13px; font-weight: 600; }
.part-stock  { font-size: 12px; color: #555; margin-top: 2px; }
.part-number { font-size: 11px; margin-top: 2px; }

/* ===== FLASH ===== */
.flash-container {
    margin-bottom: 20px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #adb5bd;
}

.empty-state i {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* ===== TABELLEN ===== */
.table thead th {
    background: #f8f9fa;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #e9ecef;
}

/* ===== KALENDER BADGE (Dashboard) ===== */
.calendar-day-badge {
    background: #0d6efd;
    color: #fff;
    border-radius: 8px;
    padding: 4px 10px;
    text-align: center;
    min-width: 52px;
    flex-shrink: 0;
}
.cal-month { font-size: 10px; font-weight: 600; letter-spacing: 1px; }
.cal-day   { font-size: 22px; font-weight: 700; line-height: 1; }

/* ===== TEAM ÜBERSICHT ===== */
.team-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.team-task {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 6px 10px;
    margin-top: 6px;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

/* ===== CARD SM ===== */
.card-sm .card-body { padding: 8px 12px; }

/* ===== DARK MODE – Custom Overrides ===== */
[data-bs-theme="dark"] body {
    background: #0f1117;
    color: #e0e0e0;
}
[data-bs-theme="dark"] #sidebar {
    background: #111318;
    border-right: 1px solid #23262d;
}
[data-bs-theme="dark"] #main-content {
    background: #0f1117;
}
[data-bs-theme="dark"] .card {
    background: #1a1d24;
    border-color: #2a2d36;
    color: #e0e0e0;
}
[data-bs-theme="dark"] .card-header {
    background: #1f2229;
    border-color: #2a2d36;
    color: #c0c8d8;
}
[data-bs-theme="dark"] .table {
    color: #e0e0e0;
}
[data-bs-theme="dark"] .table thead th {
    background: #1f2229;
    color: #8a9bb0;
}
[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background-color: #22262f;
    color: #e0e0e0;
}
[data-bs-theme="dark"] .kpi-card {
    background: #1a1d24;
    border-color: #2a2d36;
}
[data-bs-theme="dark"] .kpi-value {
    color: #e0e0e0;
}
[data-bs-theme="dark"] .part-badge {
    background: #1f2229;
    border-color: #2a2d36;
}
[data-bs-theme="dark"] .part-badge.part-low {
    background: #2d1a1a;
    border-color: #dc3545;
}
[data-bs-theme="dark"] .team-task {
    background: #1f2229;
}
[data-bs-theme="dark"] .page-header h1 {
    color: #e0e0e0;
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background: #1a1d24;
    border-color: #2a2d36;
    color: #e0e0e0;
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background: #1f2229;
    color: #e0e0e0;
}
[data-bs-theme="dark"] .btn-outline-secondary {
    color: #adb5bd;
    border-color: #495057;
}
[data-bs-theme="dark"] .alert-info {
    background: #1a2535;
    border-color: #1a4a7a;
    color: #90c4f8;
}
[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #adb5bd;
}
[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background: #1a1d24;
    border-color: #2a2d36 #2a2d36 #1a1d24;
    color: #e0e0e0;
}
[data-bs-theme="dark"] .tab-content {
    color: #e0e0e0;
}
[data-bs-theme="dark"] .modal-content {
    background: #1a1d24;
    color: #e0e0e0;
}
[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: #2a2d36;
}
[data-bs-theme="dark"] .empty-state {
    color: #556070;
}
[data-bs-theme="dark"] .text-muted {
    color: #6c7a8d !important;
}
[data-bs-theme="dark"] code {
    color: #79c0ff;
    background: #1f2229;
    padding: 1px 5px;
    border-radius: 4px;
}

/* ===== DARK MODE TOGGLE BUTTON ===== */
.dark-mode-btn {
    color: #8a9bb0;
    font-size: 18px;
    text-decoration: none;
    transition: color 0.15s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    flex-shrink: 0;
}
.dark-mode-btn:hover { color: #ffc107; }

/* ===== KLICKBARE TABELLENZEILEN ===== */
.table-clickable tbody tr {
    cursor: pointer;
}
.table-clickable tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}
[data-bs-theme="dark"] .table-clickable tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.12);
}

/* ===== MINI KALENDER (Dashboard) ===== */
.mini-calendar {
    font-size: 13px;
    width: 100%;
}
.mini-calendar table {
    width: 100%;
    border-collapse: collapse;
}
.mini-calendar th {
    text-align: center;
    color: #6c757d;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 2px;
    text-transform: uppercase;
}
.mini-calendar td {
    text-align: center;
    padding: 4px 2px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    line-height: 24px;
    position: relative;
}
.mini-calendar td.today {
    background: #0d6efd;
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
}
.mini-calendar td.has-event::after {
    content: '';
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #0d6efd;
    margin: 1px auto 0;
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
}
.mini-calendar td.today.has-event::after {
    background: #fff;
}
.mini-calendar td.other-month {
    color: #bbb;
}
.mini-calendar td.selected {
    background: #e8f0fe;
    border-radius: 50%;
    font-weight: 700;
    color: #0d6efd;
}
.mini-calendar td.today.selected {
    background: #0d6efd;
    color: #fff;
}
[data-bs-theme="dark"] .mini-calendar td.selected {
    background: #1a2d4a;
    color: #79c0ff;
}
.mini-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
}
[data-bs-theme="dark"] .mini-calendar th {
    color: #6c7a8d;
}
[data-bs-theme="dark"] .mini-calendar td.other-month {
    color: #444;
}

/* ===== ÖFFENTLICHE MASCHINENINFO ===== */
.public-machine-body {
    background: #f4f6f9;
    min-height: 100vh;
}
[data-bs-theme="dark"] .public-machine-body {
    background: #0f1117;
}

/* ===== LOGO IN SIDEBAR ===== */
.sidebar-logo-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #sidebar { display: none; }
    #main-content { margin-left: 0; }
    .content-wrapper { padding: 16px; }
}
