/**
 * IV-App - Immobilienverwaltung
 * Copyright (c) Graup-IT
 * Eigene Styles + Branding CSS-Variablen
 */

/* ========================================
   CSS-Variablen (werden dynamisch überschrieben)
   ======================================== */
:root {
    --iv-primary: #0d6efd;
    --iv-secondary: #6c757d;
    --iv-sidebar-width: 260px;
    --iv-sidebar-bg: #212529;
    --iv-sidebar-color: #ffffff;
    --iv-topbar-height: 56px;
}

/* ========================================
   Allgemein
   ======================================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* ========================================
   Sidebar
   ======================================== */
.iv-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--iv-sidebar-width);
    height: 100vh;
    background-color: var(--iv-sidebar-bg);
    color: var(--iv-sidebar-color);
    z-index: 1030;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.iv-sidebar .sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.iv-sidebar .sidebar-header img {
    max-height: 36px;
    width: auto;
}

.iv-sidebar .sidebar-header .app-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
}

.iv-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.iv-sidebar .nav-link:hover,
.iv-sidebar .nav-link.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
    border-left-color: var(--iv-primary);
}

.iv-sidebar .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.iv-sidebar .sidebar-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.5rem 0;
}

.iv-sidebar .sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    padding: 0.75rem 1.25rem 0.25rem;
}

/* ========================================
   Content-Bereich
   ======================================== */
.iv-content {
    margin-left: var(--iv-sidebar-width);
    min-height: 100vh;
}

.iv-topbar {
    height: var(--iv-topbar-height);
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.iv-main {
    padding: 1.5rem;
}

/* ========================================
   Cards
   ======================================== */
.iv-card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    background-color: #fff;
}

.iv-card .card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    padding: 0.875rem 1.25rem;
}

/* ========================================
   Tabellen
   ======================================== */
.iv-table {
    margin-bottom: 0;
}

.iv-table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}

.iv-table td {
    vertical-align: middle;
}

/* ========================================
   Buttons
   ======================================== */
.btn-iv-primary {
    background-color: var(--iv-primary);
    border-color: var(--iv-primary);
    color: #fff;
}

.btn-iv-primary:hover {
    background-color: color-mix(in srgb, var(--iv-primary), #000 15%);
    border-color: color-mix(in srgb, var(--iv-primary), #000 15%);
    color: #fff;
}

/* ========================================
   Dashboard-Widgets
   ======================================== */
.iv-widget {
    padding: 1.25rem;
    border-radius: 0.5rem;
    background-color: #fff;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.iv-widget .widget-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.iv-widget .widget-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.iv-widget .widget-label {
    font-size: 0.825rem;
    color: #6c757d;
}

/* ========================================
   Login-Seite
   ======================================== */
.iv-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--iv-primary), color-mix(in srgb, var(--iv-primary), #000 30%));
}

.iv-login-card {
    max-width: 420px;
    width: 100%;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.15);
}

/* ========================================
   Installer
   ======================================== */
.iv-installer-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.iv-installer-card {
    max-width: 600px;
    width: 100%;
    border-radius: 0.75rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
}

.iv-installer-steps {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.iv-installer-step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.825rem;
    font-weight: 600;
    background-color: #e9ecef;
    color: #6c757d;
}

.iv-installer-step.active {
    background-color: var(--iv-primary);
    color: #fff;
}

.iv-installer-step.completed {
    background-color: #198754;
    color: #fff;
}

/* ========================================
   Leaflet Karte
   ======================================== */
.iv-map {
    height: 300px;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
}

/* ========================================
   Responsive (Mobile)
   ======================================== */
@media (max-width: 991.98px) {
    .iv-sidebar {
        transform: translateX(-100%);
    }

    .iv-sidebar.show {
        transform: translateX(0);
    }

    .iv-content {
        margin-left: 0;
    }

    .iv-sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1025;
        display: none;
    }

    .iv-sidebar-overlay.show {
        display: block;
    }
}

/* ========================================
   Drucken
   ======================================== */
@media print {
    .iv-sidebar,
    .iv-topbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .iv-content {
        margin-left: 0;
    }
}

/* ========================================
   Fehlerseiten (404, 500)
   ======================================== */
.iv-error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.iv-error-card {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 480px;
    width: 100%;
    background: #fff;
    border-radius: .5rem;
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .1);
}

.iv-error-card .error-code {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    color: var(--iv-primary);
    margin-bottom: .5rem;
}

.iv-error-card .error-text {
    font-size: 1.1rem;
    color: #6c757d;
    margin-bottom: 1.5rem;
}

.iv-error-card .error-reference {
    font-size: .85rem;
    color: #adb5bd;
    font-family: monospace;
    margin-bottom: 1.5rem;
}

/* ========================================
   Log-Viewer (Einstellungen)
   ======================================== */
.iv-log-viewer {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: .375rem;
    max-height: 400px;
    overflow-y: auto;
    font-size: .8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}