/* ============================================================
   components.css – UI-Komponenten
   @package immokumpel
   @module  Core / Assets
   @since   2026-07-14
   ============================================================ */

/* ── 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;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    overflow: visible;
}
.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); }

/* ── Usage Progress-Bar ── */
.usage-bar { width: 100%; height: 6px; border-radius: 3px; background: var(--clr-border); overflow: hidden; margin-top: .5rem; }
.usage-bar-fill { height: 100%; border-radius: 3px; transition: width .3s ease; background: var(--clr-success); }
.usage-bar-fill.is-warning { background: var(--clr-warning); }
.usage-bar-fill.is-danger  { background: var(--clr-danger); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem 1rem; border-radius: var(--radius);
    font-size: .85rem; font-weight: 500; font-family: inherit;
    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; }
a.btn-primary:hover, .btn-primary:hover { background: var(--clr-primary-h); color: #fff !important; text-decoration: none; }
.btn-secondary      { background: #f1f5f9; color: var(--clr-text); border: 1px solid var(--clr-border); }
.btn-secondary:hover{ background: #e2e8f0; color: var(--clr-text) !important; text-decoration: none; }
.btn-danger         { background: var(--clr-danger);   color: #fff; }
.btn-danger:hover   { background: var(--clr-danger-h); color: #fff !important; text-decoration: none; }
.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-lg    { padding: .6rem 1.4rem; font-size: .95rem; }
.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; }
.form-control-lg { font-size: 1rem; padding: .65rem .9rem; }
.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; }

/* ── 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 ── */
.action-row { display: flex; gap: .4rem; align-items: center; }

/* ── Tarif-Auswahl ── */
.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; }

/* ── Filter-Tabs ── */
.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; }

/* ── 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); }

/* ── Detail-Grid ── */
.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 ── */
.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-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; }

/* ── Buchung aufteilen ── */
.split-toggle { display: inline-block; margin-top: .35rem; font-size: .75rem; color: var(--clr-primary); }
.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; }

/* ── Renditeberechnung ── */
.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; }
.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; }
.yield-ms-bar-range { font-size: .72rem; color: rgba(255,255,255,.55); margin-top: .3rem; }
.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; position: relative; cursor: help; }
.yield-stat-icon { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: #e0f2fe; color: var(--clr-primary); 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; }
.yield-stat-net { background: #ecfdf5; border-color: #a7f3d0; }
.yield-stat-net .yield-stat-icon { background: #d1fae5; color: #047857; }
.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; }
.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-amount { font-size: .8rem; font-weight: 600; white-space: nowrap; min-width: 90px; text-align: right; }

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