/* ============================================================
   app.css
   
   Haupt-Stylesheet fuer ImmoSaaS.
   Kein Build-Step – direkt eingebunden via <link>.
   
   @package ImmoSaaS
   @module  Core / Assets
   @author  Darius Suchanek
   @version 1.0.0
   @since   2026-05-23
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Custom Properties ── */
:root {
    --clr-bg:          #f1f5f9;
    --clr-surface:     #ffffff;
    --clr-border:      #e2e8f0;
    --clr-text:        #1e293b;
    --clr-muted:       #64748b;
    --clr-primary:     #2563eb;
    --clr-primary-h:   #1d4ed8;
    --clr-danger:      #ef4444;
    --clr-danger-h:    #dc2626;
    --clr-success:     #22c55e;
    --clr-warning:     #f59e0b;
    --clr-sidebar-bg:  #0f172a;
    --clr-sidebar-tx:  #94a3b8;
    --radius:          6px;
    --shadow-sm:       0 1px 3px rgba(0,0,0,.08);
    --shadow-md:       0 4px 12px rgba(0,0,0,.10);
    --nav-h:           56px;
    --sidebar-w:       220px;
    --font:            -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; }
body { font-family: var(--font); background: var(--clr-bg); color: var(--clr-text); line-height: 1.5; }
a    { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ── */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-h);
    background: var(--clr-sidebar-bg);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem;
    box-shadow: var(--shadow-md);
}
.topbar-brand { font-size: 1.1rem; font-weight: 700; color: #fff; letter-spacing: -.3px; }
.topbar-brand span { color: var(--clr-primary); }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-user  { font-size: .82rem; color: var(--clr-sidebar-tx); }
.topbar-logout {
    font-size: .82rem; color: var(--clr-sidebar-tx);
    padding: .3rem .7rem; border-radius: var(--radius);
    transition: background .15s, color .15s;
}
.topbar-logout:hover { background: #ffffff18; color: #fff; text-decoration: none; }

/* Superadmin-Banner */
.superadmin-bar {
    position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 99;
    background: #7c3aed; color: #fff;
    text-align: center; padding: .25rem;
    font-size: .78rem; font-weight: 600; letter-spacing: .02em;
}

/* ── Sidebar ── */
.sidebar {
    position: fixed; top: var(--nav-h); left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--clr-sidebar-bg);
    overflow-y: auto; z-index: 90;
    padding: 1rem 0 2rem;
}
.sidebar-section {
    padding: .75rem 1rem .3rem;
    font-size: .65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    color: #475569;
}
.sidebar a {
    display: flex; align-items: center; gap: .6rem;
    padding: .48rem 1rem;
    color: var(--clr-sidebar-tx); font-size: .85rem;
    border-left: 3px solid transparent;
    transition: background .12s, color .12s, border-color .12s;
    text-decoration: none;
}
.sidebar a:hover { background: #ffffff0d; color: #cbd5e1; }
.sidebar a.active {
    background: #1e40af22; color: #fff;
    font-weight: 600; border-left-color: var(--clr-primary);
}
.sidebar a svg { flex-shrink: 0; opacity: .75; }
.sidebar a.active svg { opacity: 1; }

/* ── Layout-Wrapper ── */
.layout {
    margin-top: var(--nav-h);
    margin-left: var(--sidebar-w);
    min-height: calc(100vh - var(--nav-h));
    padding: 1.75rem 2rem;
    max-width: 1400px;
}
.layout.has-banner { margin-top: calc(var(--nav-h) + 26px); }

/* ── Page Header ── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--clr-text); }

/* ── Breadcrumb ── */
.breadcrumb {
    display: flex; align-items: center; gap: .4rem;
    font-size: .8rem; color: var(--clr-muted);
    margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--clr-muted); }
.breadcrumb a:hover { color: var(--clr-text); text-decoration: none; }
.breadcrumb-sep { color: #cbd5e1; }

/* ── Cards ── */
.card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: 10px;
    box-shadow: none;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}
.card-title { font-size: .95rem; font-weight: 600; margin-bottom: 1rem; color: var(--clr-text); }

/* ── Stat-Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem; margin-bottom: 0.75rem;
}
.stat-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.25rem;
}
.stat-label { font-size: .72rem; color: var(--clr-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--clr-text); line-height: 1.1; margin: .15rem 0 .1rem; }
.stat-sub   { font-size: .78rem; color: var(--clr-muted); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem 1rem; border-radius: var(--radius);
    font-size: .85rem; font-weight: 500;
    cursor: pointer; border: none; text-decoration: none;
    transition: background .15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--clr-primary);  color: #fff; }
.btn-primary:hover   { background: var(--clr-primary-h); }
.btn-secondary { background: #f1f5f9; color: var(--clr-text); border: 1px solid var(--clr-border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger    { background: var(--clr-danger);   color: #fff; }
.btn-danger:hover    { background: var(--clr-danger-h); }
.btn-ghost     { background: transparent; color: var(--clr-muted); }
.btn-ghost:hover     { background: #f1f5f9; color: var(--clr-text); }
.btn-sm   { padding: .28rem .65rem; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; padding: .65rem; font-size: .95rem; }

/* ── Tabelle ── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
    background: #f8fafc; padding: .6rem 1rem;
    text-align: left; font-weight: 600;
    color: var(--clr-muted); font-size: .73rem;
    text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--clr-border);
}
.table td { padding: .7rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f8fafc; }

/* ── Formulare ── */
.form-grid  { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-label { font-size: .82rem; font-weight: 600; color: var(--clr-muted); }
.form-control {
    padding: .45rem .75rem;
    border: 1px solid var(--clr-border);
    border-radius: 7px;
    font-size: .9rem; color: var(--clr-text);
    background: #fff; width: 100%;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px #2563eb22;
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint    { font-size: .75rem; color: var(--clr-muted); }
.form-actions { display: flex; gap: .6rem; margin-top: 1.25rem; }
.col-span-2   { grid-column: 1 / -1; }

/* ── Alerts ── */
.alert {
    padding: .75rem 1rem; border-radius: var(--radius);
    font-size: .875rem; margin-bottom: 1rem;
    display: flex; align-items: flex-start; gap: .5rem;
}
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Badges ── */
.badge {
    display: inline-flex; align-items: center;
    padding: .15rem .5rem; border-radius: 20px;
    font-size: .72rem; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef9c3; color: #a16207; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-neutral { background: #f1f5f9; color: var(--clr-muted); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--clr-muted); }
.empty-state svg { opacity: .3; margin-bottom: .75rem; }
.empty-state p   { margin-bottom: 1rem; }

/* ── Action-Row (Tabellen-Aktionen) ── */
.action-row { display: flex; gap: .4rem; align-items: center; }

/* ── Tarif-Auswahl (Registrierung) ── */
.plan-option {
    display: flex; align-items: flex-start; gap: .9rem;
    padding: .9rem 1rem; border: 2px solid var(--clr-border);
    border-radius: var(--radius); cursor: pointer;
    transition: border-color .15s;
}
.plan-option:has(input:checked) { border-color: var(--clr-primary); background: #eff6ff; }
.plan-option input { margin-top: .15rem; accent-color: var(--clr-primary); }
.plan-name    { font-weight: 700; color: var(--clr-text); }
.plan-price   { color: var(--clr-primary); font-weight: 600; font-size: .875rem; }
.plan-meta    { font-size: .78rem; color: var(--clr-muted); margin-top: .2rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .layout { margin-left: 0; padding: 1rem; }
}

/* ── Formular-Abschnitte ── */
.form-section { margin-bottom: 0.75rem; }
.form-section-label {
    font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--clr-muted);
    margin-bottom: .5rem; padding-left: .1rem;
    display: flex; align-items: center; gap: .6rem;
}
.form-section-label::after {
    content: ''; flex: 1;
    height: 1px; background: var(--clr-border);
}
.form-section .card { margin-bottom: 0; }

/* Größere Inputs für Hauptfelder */
.form-control-lg { font-size: 1rem; padding: .65rem .9rem; }

/* Größerer Button */
.btn-lg { padding: .6rem 1.4rem; font-size: .95rem; }

/* ── Typ-Cards ── */
.type-cards {
    display: flex; gap: .75rem; flex-wrap: wrap;
    margin-top: .4rem;
}
.type-card {
    display: flex; flex-direction: column; align-items: center;
    gap: .4rem; padding: .75rem 1.25rem;
    border: 2px solid var(--clr-border);
    border-radius: var(--radius);
    cursor: pointer; user-select: none;
    transition: border-color .15s, background .15s;
    min-width: 110px;
}
.type-card:hover { border-color: var(--clr-primary); background: #eff6ff; }
.type-card.active {
    border-color: var(--clr-primary);
    background: #eff6ff;
    box-shadow: 0 0 0 3px #2563eb22;
}
.type-card-icon  { font-size: 1.6rem; line-height: 1; }
.type-card-label { font-size: .82rem; font-weight: 600; color: var(--clr-text); }

/* ── Sidebar Banner-Fix ── */
.sidebar.has-banner { top: calc(var(--nav-h) + 26px); }

/* Alpine x-cloak */
[x-cloak] { display: none !important; }

/* Dropdown-Overflow-Fix */
.card { overflow: visible; }

/* ── Detail-Grid (Key-Value-Paare) ── */
.detail-grid   { display: flex; flex-direction: column; gap: .5rem; }
.detail-row    { display: flex; align-items: baseline; gap: 1rem; font-size: .9rem; }
.detail-label  { color: var(--clr-muted); min-width: 160px; flex-shrink: 0; }
.detail-value  { color: var(--clr-text); }

/* ── Miet-Tabelle ── */
.rent-table    { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rent-table td { padding: .35rem 0; }
.rent-table td:last-child { text-align: right; }
.rent-table .rent-total td {
    font-weight: 700;
    border-top: 2px solid var(--clr-border);
    padding-top: .5rem;
}

/* ── Flatpickr Anpassungen ── */
.flatpickr-calendar {
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    font-family: var(--font);
    border: 1px solid var(--clr-border);
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--clr-primary);
    border-color: var(--clr-primary);
}
.flatpickr-day:hover {
    background: #eff6ff;
    border-color: transparent;
}
.flatpickr-months .flatpickr-month {
    background: var(--clr-primary);
    border-radius: 7px 7px 0 0;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    font-weight: 600;
}
.flatpickr-day.today { border-color: var(--clr-primary); }
.flatpickr-day.today:hover { background: #eff6ff; }
.is-valid  { border-color: var(--clr-success) !important; }
.is-invalid{ border-color: var(--clr-danger)  !important; }

/* ── Filter-Tabs (z.B. Mieter & Kontakte) ── */
.filter-tabs {
    display: flex; gap: .3rem; flex-wrap: wrap;
    margin-bottom: 1rem;
}
.filter-tab {
    padding: .4rem .9rem;
    border-radius: 20px;
    font-size: .82rem; font-weight: 600;
    color: var(--clr-muted);
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    text-decoration: none;
    transition: background .12s, color .12s, border-color .12s;
}
.filter-tab:hover { background: #f1f5f9; color: var(--clr-text); text-decoration: none; }
.filter-tab.active {
    background: var(--clr-primary);
    border-color: var(--clr-primary);
    color: #fff;
}

/* ── Renditeberechnung (Property-Detail) ── */
.yield-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    margin-top: 1rem;
    color: #fff;
    box-shadow: var(--shadow-md);
}
.yield-card-head { margin-bottom: 1.1rem; }
.yield-card-title {
    display: flex; align-items: center; gap: .5rem;
    font-size: .95rem; font-weight: 700;
    color: #fff; opacity: .95;
}
.yield-card-title svg { color: #38bdf8; }

.yield-hero {
    display: flex; align-items: center; gap: 1.5rem;
    margin-bottom: 1.4rem;
}
.yield-hero-ring {
    width: 96px; height: 96px; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #38bdf8 0%, #0ea5e9 60%, #0369a1 100%);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 6px rgba(56,189,248,.15), 0 8px 20px rgba(14,165,233,.35);
    flex-shrink: 0;
}
.yield-hero-value {
    font-size: 1.5rem; font-weight: 800; color: #fff;
    letter-spacing: -.02em;
}
.yield-hero-meta { min-width: 0; }
.yield-hero-label {
    font-size: .92rem; font-weight: 700; color: #fff;
    margin-bottom: .35rem;
}
.yield-hero-sub {
    font-size: .82rem; color: rgba(255,255,255,.7);
    line-height: 1.5;
}
.yield-hero-sub strong { color: #fff; font-weight: 700; }

.yield-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .75rem;
    margin-bottom: 1.1rem;
}
.yield-tile {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    padding: .85rem 1rem;
    transition: background .15s, border-color .15s;
}
.yield-tile:hover {
    background: rgba(255,255,255,.11);
    border-color: rgba(56,189,248,.4);
}
.yield-tile-potential {
    border-color: rgba(251,191,36,.4);
    background: rgba(251,191,36,.08);
}
.yield-tile-icon {
    color: #38bdf8; margin-bottom: .4rem;
}
.yield-tile-potential .yield-tile-icon { color: #fbbf24; }
.yield-tile-label {
    font-size: .72rem; font-weight: 600; color: rgba(255,255,255,.65);
    text-transform: uppercase; letter-spacing: .04em;
    margin-bottom: .2rem;
}
.yield-tile-value {
    font-size: 1.2rem; font-weight: 700; color: #fff;
}

.yield-hint {
    font-size: .75rem; color: rgba(255,255,255,.5);
    border-top: 1px solid rgba(255,255,255,.1);
    padding-top: .85rem;
    margin: 0;
}

@media (max-width: 600px) {
    .yield-hero { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* ── Mietspiegel-Vergleich in der Rendite-Card ── */
.yield-divider {
    height: 1px;
    background: rgba(255,255,255,.1);
    margin: 1.2rem 0 1.1rem;
}
.yield-section-title {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
    font-size: .9rem; font-weight: 700; color: #fff;
    margin-bottom: .9rem;
}
.yield-section-title svg { color: #38bdf8; }
.yield-section-hint {
    font-size: .75rem; font-weight: 500; color: rgba(255,255,255,.55);
}
.yield-ms-compare {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: .9rem;
}
.yield-ms-bar {
    flex: 1;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    padding: .8rem 1rem;
}
.yield-ms-bar-target {
    border-color: rgba(56,189,248,.45);
    background: rgba(56,189,248,.1);
}
.yield-ms-bar-label {
    font-size: .72rem; font-weight: 600; color: rgba(255,255,255,.6);
    text-transform: uppercase; letter-spacing: .04em;
    margin-bottom: .25rem;
}
.yield-ms-bar-value { font-size: 1.05rem; font-weight: 700; color: #fff; }
.yield-ms-arrow { color: rgba(255,255,255,.4); flex-shrink: 0; }
.yield-tile-value-sub {
    font-size: .78rem; font-weight: 600; color: rgba(255,255,255,.6);
    margin-left: .25rem;
}

@media (max-width: 600px) {
    .yield-ms-compare { flex-direction: column; align-items: stretch; }
    .yield-ms-arrow { align-self: center; transform: rotate(90deg); }
}


/* ── Mietspiegel Min/Max-Spanne ── */
.yield-ms-bar-range {
    font-size: .72rem;
    color: rgba(255,255,255,.55);
    margin-top: .3rem;
}


/* ── Renditeberechnung (kompakt, hell – Property-Detail) ── */
.yield-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}
.yield-stat {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex: 0 0 auto;
    padding: .6rem .9rem;
    border: 1px solid var(--clr-border);
    border-radius: 8px;
    background: #f9fafb;
}
.yield-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0f2fe;
    color: var(--clr-primary, #2563eb);
    flex-shrink: 0;
}
.yield-stat-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--clr-text);
    line-height: 1.2;
}
.yield-stat-label {
    font-size: .72rem;
    color: var(--clr-muted);
}
.yield-stat-potential { background: #fffbeb; border-color: #fde68a; }
.yield-stat-potential .yield-stat-icon { background: #fef3c7; color: #b45309; }

/* ── Mietspiegel Ist/Soll-Balken ── */
.yield-ms-title { font-size: .9rem; font-weight: 700; margin-bottom: .6rem; }
.yield-ms-bars { display: flex; flex-direction: column; gap: .45rem; }
.yield-ms-bar-row { display: flex; align-items: center; gap: .6rem; }
.yield-ms-bar-label { width: 32px; font-size: .75rem; color: var(--clr-muted); flex-shrink: 0; }
.yield-ms-bar-track {
    flex: 1;
    height: 10px;
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
}
.yield-ms-bar-fill { height: 100%; border-radius: 6px; transition: width .3s; }
.yield-ms-bar-actual { background: #94a3b8; }
.yield-ms-bar-target { background: var(--clr-primary, #2563eb); }
.yield-ms-bar-amount { font-size: .8rem; font-weight: 600; white-space: nowrap; min-width: 90px; text-align: right; }

/* ── Nettomietrendite-Hervorhebung ── */
.yield-stat-net { background: #ecfdf5; border-color: #a7f3d0; }
.yield-stat-net .yield-stat-icon { background: #d1fae5; color: #047857; }

/* ── Nettomietrendite-Hervorhebung ── */
.yield-stat-net { background: #ecfdf5; border-color: #a7f3d0; }
.yield-stat-net .yield-stat-icon { background: #d1fae5; color: #047857; }

/* ── Nettomietrendite-Hervorhebung ── */
.yield-stat-net { background: #ecfdf5; border-color: #a7f3d0; }
.yield-stat-net .yield-stat-icon { background: #d1fae5; color: #047857; }

/* ── Tooltips fuer Renditeberechnung-Kacheln ── */
.yield-stat {
    position: relative;
    cursor: help;
}
.yield-stat[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #1f2937;
    color: #fff;
    font-size: .72rem;
    font-weight: 500;
    line-height: 1.4;
    padding: .5rem .65rem;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity .15s, transform .15s;
    z-index: 20;
}
.yield-stat[data-tooltip]::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 3px);
    left: 16px;
    border: 5px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s;
    z-index: 20;
}
.yield-stat[data-tooltip]:hover::after,
.yield-stat[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* ── Buchung aufteilen (Bankimport) ── */
.split-toggle {
    display: inline-block;
    margin-top: .35rem;
    font-size: .75rem;
    color: var(--clr-primary, #2563eb);
}
.split-row td { background: #f8fafc; padding: .9rem 1rem; }
.split-box { max-width: 520px; }
.split-line {
    display: flex;
    gap: .5rem;
    margin-bottom: .4rem;
}
.split-line .form-control { flex: 1; }
