/* ───────────────────────────────────────────────────
   Affiliate Branch (KBR-Empfehlungsportal) — Globaler
   Gold-Reskin. Wird von layout.php automatisch auf JEDER
   Seite dieses Branches geladen (kein Markup-Rewrite je
   Seite noetig) — ueberschreibt generische dynos-*-Klassen
   nur innerhalb des Affiliate-Branches.
   ─────────────────────────────────────────────────── */

/* Karten-Hintergrund an den neuen KBR-Look (aff-panel) angleichen.
   Border kommt bereits ueber --border aus dem finance-gold-Theme (gold). */
:root {
    --card-bg: rgba(255, 255, 255, 0.03);
}

/* Bootstrap-Primary ist plattformweit hartcodiertes Blau — hier auf
   den Branch-Akzent (Gold) gemappt, gilt nur auf Affiliate-Seiten. */
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1508;
    font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--branch-accent-hover, var(--accent)) !important;
    border-color: var(--branch-accent-hover, var(--accent)) !important;
    color: #1a1508 !important;
}
.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1508;
}

/* Tabellen-Hover leicht gold statt neutral-weiss einfaerben */
.table {
    --bs-table-hover-bg: rgba(197, 165, 90, 0.05);
}

/* ───────────────────────────────────────────────────
   Affiliate Branch — Mobile PWA Bottom Navigation
   ─────────────────────────────────────────────────── */

.aff-bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1040;
    display: flex;
    align-items: stretch;
    height: 60px;
    background: #1A1D21;
    border-top: 1px solid rgba(197, 165, 90, 0.25);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.aff-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.aff-bottom-nav-item i { font-size: 1.3rem; line-height: 1; }
.aff-bottom-nav-item.active { color: #C5A55A; }
.aff-bottom-nav-item.active i { filter: drop-shadow(0 0 5px rgba(197,165,90,0.6)); }

/* Platz am unteren Rand des Inhalts */
@media (max-width: 991.98px) {
    .branch-main.has-bottom-nav {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 0.75rem);
    }
    /* Hamburger nicht mehr nötig — Bottom Nav übernimmt */
    .branch-mobile-toggle { display: none !important; }
    /* Touch-Targets */
    .btn { min-height: 44px; }
}

/* ── WhatsApp Share Button ── */
.btn-whatsapp {
    background: #25D366;
    color: #fff !important;
    border: none;
    border-radius: 10px;
    padding: 0.55rem 1.1rem;
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn-whatsapp:hover { background: #1ebe57; }
.btn-whatsapp:active { transform: scale(0.96); }

/* ───────────────────────────────────────────────────
   Affiliate Branch — Theme Overrides
   Fixes dark-mode-coded elements for both modes.
   Loaded automatically by layout.php when this file exists.
   ─────────────────────────────────────────────────── */

/* ════════════════════════════════════════════════════
   DARK MODE — restore correct backgrounds for elements
   that use CSS-variable backgrounds (baked as light by
   law-gold theme) but need dark bg in dark mode.
   ════════════════════════════════════════════════════ */

/* MLM tree nodes use --branch-card-bg which is #fff in law-gold;
   force a dark bg in dark mode */
body.dark-mode .mlm-node {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}
body.dark-mode .mlm-accordion-item {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}
body.dark-mode .mlm-toggle {
    background: rgba(30, 35, 50, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}
body.dark-mode .mlm-toggle:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* ════════════════════════════════════════════════════
   LIGHT MODE — fix hardcoded rgba(255,255,255,...)
   colors that are invisible on light backgrounds.
   ════════════════════════════════════════════════════ */

/* Dashboard — mini sales list */
body:not(.dark-mode) .sale-mini-row {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}
body:not(.dark-mode) .sale-mini-row .sale-date {
    color: #6c757d;
}
body:not(.dark-mode) .stat-label-sm {
    color: #6c757d;
}
body:not(.dark-mode) .stat-card-earnings {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.07) 0%, rgba(0, 0, 0, 0.01) 100%);
}

/* MLM Tree nodes */
body:not(.dark-mode) .mlm-node {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}
body:not(.dark-mode) .mlm-node:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
body:not(.dark-mode) .mlm-name {
    color: #212529;
}
body:not(.dark-mode) .mlm-earnings {
    color: #6c757d;
}
body:not(.dark-mode) .mlm-avatar {
    background: rgba(0, 0, 0, 0.08);
    color: #495057;
}
body:not(.dark-mode) .mlm-avatar.av-repr {
    background: rgba(150, 150, 150, 0.15);
    color: #6c757d;
}
body:not(.dark-mode) .mlm-avatar.av-berater {
    background: rgba(0, 150, 200, 0.15);
    color: #0077aa;
}
body:not(.dark-mode) .mlm-avatar.av-experte {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}
body:not(.dark-mode) .mlm-avatar.av-botschafter {
    background: rgba(197, 165, 90, 0.2);
    color: #a88b3e;
}
body:not(.dark-mode) .mlm-toggle {
    background: #f0f0f5;
    border-color: rgba(0, 0, 0, 0.12);
    color: #495057;
}
body:not(.dark-mode) .mlm-toggle:hover {
    background: #e8e8f0;
}
body:not(.dark-mode) .mlm-acc-level-label {
    background: rgba(0, 0, 0, 0.07);
    color: #6c757d;
}
body:not(.dark-mode) .mlm-accordion-item {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
body:not(.dark-mode) .mlm-accordion-body {
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* MLM connector lines (vertical bars between nodes) */
body:not(.dark-mode) .mlm-subtree::before,
body:not(.dark-mode) .mlm-subtree-body::before {
    background: rgba(0, 0, 0, 0.12);
}

/* Partners page inline strong */
body:not(.dark-mode) #optimaPartnerName {
    color: #212529 !important;
}

/* Materials page HR */
body:not(.dark-mode) hr[style*="rgba(255,255,255"] {
    border-color: rgba(0, 0, 0, 0.12) !important;
}

/* Conversions page JS-generated TR border */
body:not(.dark-mode) tr[style*="rgba(255,255,255"] {
    border-top-color: rgba(0, 0, 0, 0.1) !important;
}
