/* Portal Standard CSS - Zentrale Governance für das Design */

:root {
    --portal-primary: #0d6efd;
    --portal-bg-light: #f8f9fa;
    --portal-text-muted: #6c757d;
    --portal-border-color: #dee2e6;
    --portal-table-hover: rgba(13, 110, 253, 0.02);
    
    /* Doc-Type Badge Farben */
    --badge-invoice: #0d6efd;
    --badge-creditmemo: #198754;
    --badge-delivery: #d68000;
    --badge-quote: #0dcaf0;
    --badge-payment: #6f42c1;
    --badge-default: #6c757d;
}

/* Tabellen-Design */
.table-portal {
    table-layout: fixed;
    font-size: 0.875rem;
    vertical-align: middle;
}

.table-portal thead th {
    background-color: var(--portal-bg-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--portal-text-muted);
    font-weight: 700;
    border-bottom: 2px solid var(--portal-border-color);
    vertical-align: middle;
    letter-spacing: 0.02em;
}

.table-portal tbody tr {
    transition: background-color 0.15s ease-in-out;
}

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

.table-portal td {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    vertical-align: middle;
}

/* Sortierbare Header */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 25px !important;
}

th.sortable::after {
    content: '↕';
    font-size: 0.8em;
    color: #ccc;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

th.sortable.asc::after {
    content: '▲';
    color: var(--portal-primary);
}

th.sortable.desc::after {
    content: '▼';
    color: var(--portal-primary);
}

/* Filter-Navigation */
.filter-nav .nav-link {
    font-size: 0.9rem;
    border-radius: 20px;
    padding: 5px 15px;
    color: var(--portal-text-muted);
}

.filter-nav .nav-link.active {
    background-color: var(--portal-primary);
    color: #fff !important;
}

.filter-nav .badge {
    font-size: 0.75rem;
    margin-left: 5px;
}

/* Action Buttons in Listen */
.btn-action-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    opacity: 0.7;
    transition: all 0.2s;
    border: none;
}

.btn-action-sm:hover {
    opacity: 1;
    background-color: var(--portal-bg-light);
    transform: scale(1.1);
}

/* Typografie Helfer */
.text-id {
    font-family: var(--bs-font-monospace);
}

/* Spalten-Optimierung für Dokumenten-Tabelle */
.table-portal .col-type { width: 110px; }
.table-portal .col-number { width: 140px; white-space: nowrap; }
.table-portal .col-date { width: 100px; white-space: nowrap; }
.table-portal .col-net { width: 130px; white-space: nowrap; }
.table-portal .col-gross { width: 130px; white-space: nowrap; }
.table-portal .col-action { width: 50px; }

/* ========================================
   DYNAMISCHE DOC-TYPE BADGES
   Best Practice: CSS Custom Properties + data-Attribute
   ======================================== */
.doc-type-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid;
    white-space: nowrap;
    /* Fallback für unbekannte Typen */
    background-color: rgba(108, 117, 125, 0.1);
    color: var(--badge-default);
    border-color: rgba(108, 117, 125, 0.3);
}

/* Invoice - Primary Blue */
.doc-type-badge[data-doc-type="Invoice"] {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--badge-invoice);
    border-color: rgba(13, 110, 253, 0.3);
}

/* CreditMemo - Success Green */
.doc-type-badge[data-doc-type="CreditMemo"] {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--badge-creditmemo);
    border-color: rgba(25, 135, 84, 0.3);
}

/* Delivery - Warning Orange */
.doc-type-badge[data-doc-type="Delivery"] {
    background-color: rgba(255, 193, 7, 0.1);
    color: var(--badge-delivery);
    border-color: rgba(255, 193, 7, 0.3);
}

/* Quote/Order - Info Cyan */
.doc-type-badge[data-doc-type="Quote"],
.doc-type-badge[data-doc-type="Order"] {
    background-color: rgba(13, 202, 240, 0.1);
    color: var(--badge-quote);
    border-color: rgba(13, 202, 240, 0.3);
}

/* Payment/Receipt - Purple */
.doc-type-badge[data-doc-type="Payment"],
.doc-type-badge[data-doc-type="Receipt"] {
    background-color: rgba(111, 66, 193, 0.1);
    color: var(--badge-payment);
    border-color: rgba(111, 66, 193, 0.3);
}

/* WBS / Projektstruktur Spezialitäten */
.group-header { cursor: pointer; background-color: var(--portal-bg-light) !important; }
.group-header:hover { background-color: #f1f3f5 !important; }

.hierarchy-guide {
    color: #bbb; 
    display: inline-block; 
    width: 20px;
    text-align: center; 
}

.chevron-icon { 
    display: inline-block; 
    transition: transform 0.2s ease; 
    font-size: 10px; 
    color: #ccc; 
}
.is-closed .chevron-icon { transform: rotate(-90deg); color: var(--portal-primary); }

.header-sum { opacity: 0; transition: opacity 0.1s ease; }
.group-header.is-closed .header-sum { opacity: 1; }
.group-header:not(.is-closed):hover .header-sum { opacity: 0.35; }

/* ========================================
   AUTH SEITEN (Login, Setup, Forgot)
   ======================================== */
body.auth-page { 
    display: flex; 
    align-items: center; 
    padding-top: 40px; 
    padding-bottom: 40px; 
    background-color: #f5f5f5; 
    height: 100vh; 
}

.form-signin, .form-auth { 
    width: 100%; 
    max-width: 380px; 
    padding: 15px; 
    margin: auto; 
}

.form-auth { max-width: 400px; }

.form-signin .card, .form-auth .card {
    border: none;
    border-radius: 10px;
}

/* ========================================
   TENANT SELECTION
   ======================================== */
.tenant-card { 
    transition: transform 0.2s; 
    cursor: default; 
}

.tenant-card:hover { 
    transform: translateY(-3px); 
    border-color: #0d6efd; 
}

/* ========================================
   TEAM ACTIVITY
   ======================================== */
.nav-tabs .nav-link { 
    border-radius: 0.375rem 0.375rem 0 0; 
}

code { 
    font-size: 0.85em; 
}

.text-truncate-email { 
    max-width: 200px; 
    display: inline-block; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
}

/* ========================================
   PROJECT DETAILS (WBS Tabelle)
   ======================================== */
.col-chevron { 
    width: 25px; 
    text-align: center; 
    padding: 0 !important; 
}

.col-num { width: 60px; }
.col-desc { width: auto; }
.col-date { width: 85px; text-align: center; }

.col-value, .col-offen, .col-pct { 
    width: 90px; 
    text-align: right; 
    font-weight: 700 !important; 
    font-size: 0.95rem;
}

.col-pct { width: 60px; }
.col-cr { width: 35px; text-align: center; }
.col-status { width: 95px; text-align: right; }

#taskTable tbody tr { height: 44px; }

.status-count-badge { 
    font-size: 10px; 
    padding: 2px 6px; 
    border-radius: 8px; 
    font-weight: 700; 
}

/* ========================================
   GLOBALE AVATAR KOMPONENTE
   ======================================== */
.avatar-placeholder {
    width: 32px; 
    height: 32px;
    background-color: #e9ecef;
    color: #495057;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-right: 10px;
}
