/* ===========================================================
   ELEKTRO NIEHAGE INTERN
   v2.0 — Corporate Design (Farben aus elektro-niehage.de)
   =========================================================== */

:root {

    /* Layout */
    --sidebar-width: 272px;
    --sidebar-collapsed: 72px;

    /* Markenfarben (elektro-niehage.de) */
    --primary: #4caf50;
    --primary-dark: #388e3c;
    --heading: #2f2f2f;
    --heading-dark: #1a1a1a;

    /* Flächen */
    --bg: #f7f9f8;
    --surface: #ffffff;
    --surface-2: #f7f9f8;

    --sidebar-bg: #ffffff;
    --sidebar-border: #e9eeeb;

    --text: #666666;
    --text-light: #8a8a8a;

    --hover: #eef7ee;
    --active: #e3f3e4;

    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;

    --shadow: 0 2px 10px rgba(47, 47, 47, .06);
    --shadow-md: 0 10px 28px rgba(47, 47, 47, .09);

    --radius: 12px;
    --radius-sm: 8px;
}


/* ===========================================================
   GLOBAL
   =========================================================== */

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading);
    font-weight: 700;
    letter-spacing: -.01em;
}

a {
    color: var(--primary-dark);
}

a:hover {
    color: var(--primary-dark);
}


/* ===========================================================
   SIDEBAR
   =========================================================== */

#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    transition: .25s;
    z-index: 1000;
    overflow-y: auto;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed);
}


/* ===========================================================
   CONTENT
   =========================================================== */

#content {
    margin-left: var(--sidebar-width);
    padding: 28px;
    transition: .25s;
}

#sidebar.collapsed ~ #content {
    margin-left: var(--sidebar-collapsed);
}


/* ===========================================================
   SIDEBAR HEADER / LOGO
   =========================================================== */

.sidebar-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: 88px;
    display: flex;
    align-items: center;
}

.sidebar-logo {
    max-width: 100%;
    height: auto;
    display: block;
}

#sidebar.collapsed .sidebar-logo-full {
    display: none;
}

.sidebar-logo-mark {
    display: none;
    width: 34px;
    height: 34px;
}

#sidebar.collapsed .sidebar-logo-mark {
    display: block;
}

#sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 18px 8px;
}


/* ===========================================================
   NAVIGATION
   =========================================================== */

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 4px 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.nav-item i {
    width: 22px;
    text-align: center;
    font-size: 16px;
}

.nav-item:hover {
    background: var(--hover);
    color: var(--heading);
}

.nav-item.active {
    background: var(--active);
    color: var(--primary-dark);
    font-weight: 600;
}

.nav-item.active i {
    color: var(--primary);
}


/* ===========================================================
   COLLAPSED MODE
   =========================================================== */

#sidebar.collapsed .label {
    display: none;
}

#sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
}

#sidebar.collapsed .nav-item i {
    margin: 0;
}


/* ===========================================================
   DIVIDER
   =========================================================== */

#sidebar hr {
    margin: 14px;
    border: none;
    border-top: 1px solid var(--sidebar-border);
}


/* ===========================================================
   USER PANEL
   =========================================================== */

.sidebar-user {
    margin-top: auto;
    padding: 16px 18px;
    border-top: 1px solid var(--sidebar-border);
    color: var(--text-light);
    font-size: 13px;
    background: var(--surface-2);
}

.sidebar-user i {
    color: var(--primary);
}

.sidebar-user a i {
    color: var(--text-light);
}

.sidebar-user a:hover i {
    color: var(--danger);
}

#sidebar.collapsed .sidebar-user {
    flex-direction: column;
    gap: 10px;
    padding: 16px 8px;
}


/* ===========================================================
   TOPBAR
   =========================================================== */

.fw-bold {
    color: var(--heading);
}


/* ===========================================================
   CARDS
   =========================================================== */

.card {
    border: none;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--sidebar-border);
    font-weight: 600;
    color: var(--heading);
}


/* ===========================================================
   QUICK TILES (Dashboard)
   =========================================================== */

.quick-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    padding: 22px 12px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--heading);
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    transition: box-shadow .2s, transform .15s;
}

.quick-tile i {
    font-size: 26px;
    color: var(--primary);
}

.quick-tile:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--heading);
}


/* ===========================================================
   DROPDOWNS
   =========================================================== */

.dropdown-menu {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}


/* ===========================================================
   BUTTONS
   =========================================================== */

.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: background .15s, border-color .15s, transform .1s;
}

.btn:active {
    transform: scale(.98);
}

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

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

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
}

.btn-secondary {
    background: var(--heading);
    border-color: var(--heading);
}

.btn-secondary:hover {
    background: var(--heading-dark);
    border-color: var(--heading-dark);
}

.btn-outline-secondary {
    color: var(--heading);
    border-color: var(--sidebar-border);
}

.btn-outline-secondary:hover {
    background: var(--heading);
    border-color: var(--heading);
}


/* ===========================================================
   TABLES
   =========================================================== */

.table {
    background: white;
}

.table thead th {
    background: var(--surface-2);
    border-bottom: 1px solid var(--sidebar-border);
    font-weight: 600;
    color: var(--heading);
}

.table tbody tr:hover {
    background: var(--hover);
}


/* ===========================================================
   FORMS
   =========================================================== */

.form-control,
.form-select {
    border-radius: 10px;
    border: 1px solid var(--sidebar-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .15rem rgba(76, 175, 80, .18);
}

.form-label {
    color: var(--heading);
    font-weight: 500;
}


/* ===========================================================
   BADGES
   =========================================================== */

.badge {
    border-radius: 8px;
    padding: .45em .7em;
}

.bg-primary {
    background-color: var(--primary) !important;
}


/* ===========================================================
   ALERTS
   =========================================================== */

.alert {
    border: none;
    border-radius: var(--radius-sm);
}

.alert-success {
    background: var(--active);
    color: var(--primary-dark);
}


/* ===========================================================
   SCROLLBAR
   =========================================================== */

#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
    background: var(--sidebar-border);
    border-radius: 20px;
}


/* ===========================================================
   LOGIN PAGE
   =========================================================== */

body:has(.register) {
    background: linear-gradient(160deg, var(--bg) 0%, #eaf5ea 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.register .card {
    box-shadow: var(--shadow-md);
    border-top: 3px solid var(--primary);
}


/* ===========================================================
   MOBILE
   =========================================================== */

@media (max-width: 768px) {

    #sidebar {
        left: -280px;
        z-index: 9999;
    }

    #sidebar.mobile-open {
        left: 0;
    }

    #content {
        margin-left: 0;
        padding: 18px;
    }

}


/* ===========================================================
   KUNDENLISTE
   =========================================================== */

.kunden-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.kunden-icon.company {
    background: var(--active);
    color: var(--primary-dark);
}

.kunden-icon.private {
    background: var(--surface-2);
    color: var(--text-light);
}

.kunden-filter-tab {
    border: 1px solid var(--sidebar-border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: 6px 16px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}

.kunden-filter-tab:hover {
    background: var(--hover);
}

.kunden-filter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}


/* ===========================================================
   KUNDENDETAIL
   =========================================================== */

.crm-timeline {
    position: relative;
    margin-top: 10px;
}

.crm-timeline::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--sidebar-border);
}

.timeline-item {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    position: relative;
}

.timeline-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 1px solid var(--sidebar-border);
    z-index: 2;
}

.timeline-body {
    flex: 1;
}

.timeline-text {
    font-weight: 500;
    color: var(--heading);
}

.timeline-date {
    font-size: .85rem;
    color: var(--text-light);
}


/* ===========================================================
   TICKET
   =========================================================== */

.ticket-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.ticket-badge-row span {
    display: inline-block;
    background: var(--surface-2);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: .78rem;
    margin: 2px 4px 2px 0;
}

.ticket-conversation {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ticket-msg-group {
    max-width: 78%;
    display: flex;
    flex-direction: column;
}

.ticket-msg-group.mine {
    align-self: flex-end;
    align-items: flex-end;
}

.ticket-msg-group.theirs {
    align-self: flex-start;
    align-items: flex-start;
}

.ticket-bubble {
    border-radius: 12px;
    padding: 10px 14px;
    font-size: .92rem;
    width: fit-content;
    white-space: pre-wrap;
}

.ticket-bubble.theirs {
    background: var(--surface);
    border: 1px solid var(--sidebar-border);
    border-radius: 12px 12px 12px 2px;
}

.ticket-bubble.mine {
    background: var(--active);
    border-radius: 12px 12px 2px 12px;
}

.ticket-bubble-meta {
    font-size: .78rem;
    color: var(--text-light);
    margin-bottom: 3px;
}
