/*
 * Mieterportal – Prototype shared styles (Click-Dummy)
 * Brand tokens taken from owner-dashboard.css (Panely brand system),
 * modernised for an end-customer (Mieter) portal. Variant files add their
 * own scoped skins on top of these neutral, reusable components.
 */

:root {
  --mp-green: #244941;
  --mp-green-600: #1a3630;
  --mp-highlight: #1eb97a;
  --mp-highlight-10: rgba(30, 185, 122, 0.1);
  --mp-highlight-20: rgba(30, 185, 122, 0.2);
  --mp-yellow: #eea54e;
  --mp-yellow-10: rgba(238, 165, 78, 0.12);
  --mp-soft: #e7efee;

  --mp-bg: #f4f7f6;
  --mp-card: #ffffff;
  --mp-text: #17241f;
  --mp-muted: #5b6b66;
  --mp-faint: #93a29d;
  --mp-border: #e4ece9;

  --mp-pv-color: #1eb97a;
  --mp-grid-color: #cbd5e1;
  --mp-axis-color: #94a3b8;

  --mp-radius-sm: 10px;
  --mp-radius: 16px;
  --mp-radius-lg: 22px;
  --mp-radius-full: 999px;

  --mp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --mp-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --mp-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);

  --mp-font: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

.mp-body {
  margin: 0;
  font-family: var(--mp-font);
  background: var(--mp-bg);
  color: var(--mp-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mp-body .material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  vertical-align: middle;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
}

/* --- Layout primitives --- */
.mp-container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.mp-page { display: none; }
.mp-page.is-active { display: block; animation: mpFade 0.28s ease; }
@keyframes mpFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .mp-page.is-active { animation: none; }
  * { scroll-behavior: auto !important; }
}

.mp-grid { display: grid; gap: 14px; }
.mp-grid-2 { grid-template-columns: repeat(2, 1fr); }
.mp-grid-3 { grid-template-columns: repeat(3, 1fr); }
.mp-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) {
  .mp-grid-3, .mp-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

.mp-section-title {
  font-size: 0.8125rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--mp-faint); margin: 22px 4px 10px;
}
.mp-h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 4px; }
.mp-h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 2px; }
.mp-lead { color: var(--mp-muted); margin: 0; }

/* --- Cards --- */
.mp-card {
  background: var(--mp-card);
  border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius);
  padding: 18px;
  box-shadow: var(--mp-shadow-sm);
}
.mp-card--pad-lg { padding: 24px; }

/* --- KPI --- */
.mp-kpi { display: flex; flex-direction: column; gap: 6px; }
.mp-kpi__icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--mp-highlight-10); color: var(--mp-green);
}
.mp-kpi__label { font-size: 0.8125rem; color: var(--mp-muted); }
.mp-kpi__value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.mp-kpi__sub { font-size: 0.75rem; color: var(--mp-faint); }

/* --- Status pill / badges --- */
.mp-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--mp-radius-full);
  font-size: 0.8125rem; font-weight: 600;
  background: var(--mp-highlight-10); color: #0d7a52;
}
.mp-pill--dot::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; display: inline-block;
}
.mp-badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: var(--mp-radius-full); font-size: 0.75rem; font-weight: 600;
  background: #f1f5f4; color: var(--mp-muted);
}
.mp-badge--paid { background: #ecfdf5; color: #047857; }
.mp-badge--open { background: #fff7ed; color: #c2660c; }

/* --- Buttons --- */
.mp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--mp-radius-full);
  border: none; cursor: pointer; font-family: inherit; font-size: 0.9375rem;
  font-weight: 600; background: var(--mp-green); color: #fff;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.mp-btn:hover { background: var(--mp-green-600); box-shadow: var(--mp-shadow); }
.mp-btn:active { transform: scale(0.98); }
.mp-btn--accent { background: var(--mp-highlight); }
.mp-btn--accent:hover { background: #17a06a; }
.mp-btn--ghost { background: transparent; color: var(--mp-green); border: 1.5px solid var(--mp-border); }
.mp-btn--ghost:hover { background: var(--mp-soft); box-shadow: none; }
.mp-btn--block { width: 100%; }
.mp-btn--sm { min-height: 36px; font-size: 0.8125rem; padding: 0 14px; }

/* --- Quick action tiles --- */
.mp-quick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px; background: var(--mp-card); border: 1px solid var(--mp-border);
  border-radius: var(--mp-radius); cursor: pointer; text-align: left;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  width: 100%; font-family: inherit; color: inherit;
}
.mp-quick:hover { transform: translateY(-2px); box-shadow: var(--mp-shadow); border-color: var(--mp-highlight-20); }
.mp-quick__icon {
  width: 42px; height: 42px; border-radius: 12px; display: inline-flex;
  align-items: center; justify-content: center; background: var(--mp-highlight-10);
  color: var(--mp-green);
}
.mp-quick__label { font-weight: 600; font-size: 0.9375rem; }
.mp-quick__desc { font-size: 0.8125rem; color: var(--mp-muted); }

/* --- Chart + legend --- */
.mp-chart { width: 100%; height: 170px; }
.mp-chart[data-chart="range"] { height: 220px; min-height: 220px; }
.mp-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 0.8125rem; color: var(--mp-muted); }
.mp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mp-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.mp-legend .is-pv { background: var(--mp-pv-color); }
.mp-legend .is-grid { background: var(--mp-grid-color); }

/* --- Segmented range tabs --- */
.mp-range {
  display: inline-flex; background: #eef3f1; border-radius: var(--mp-radius-full);
  padding: 4px; gap: 2px;
}
.mp-range button {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 0.8125rem; font-weight: 600; color: var(--mp-muted);
  padding: 7px 16px; border-radius: var(--mp-radius-full); transition: all 0.2s ease;
}
.mp-range button.is-active { background: #fff; color: var(--mp-green); box-shadow: var(--mp-shadow-sm); }

/* --- Data rows / lists --- */
.mp-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 4px;
  border-bottom: 1px solid var(--mp-border);
}
.mp-row:last-child { border-bottom: none; }
.mp-row__icon {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--mp-soft); color: var(--mp-green);
}
.mp-row__body { flex: 1; min-width: 0; }
.mp-row__title { font-weight: 600; font-size: 0.9375rem; }
.mp-row__meta { font-size: 0.8125rem; color: var(--mp-muted); }
.mp-row__end { margin-left: auto; text-align: right; flex-shrink: 0; }

.mp-def { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--mp-border); }
.mp-def:last-child { border-bottom: none; }
.mp-def dt { color: var(--mp-muted); font-size: 0.9375rem; }
.mp-def dd { margin: 0; font-weight: 600; text-align: right; }

/* --- Progress stepper (onboarding) --- */
.mp-steps { display: flex; gap: 6px; }
.mp-steps__seg { flex: 1; height: 6px; border-radius: var(--mp-radius-full); background: #e4ece9; overflow: hidden; }
.mp-steps__seg.is-done { background: var(--mp-highlight); }
.mp-steps__seg.is-current { background: var(--mp-highlight); position: relative; }
.mp-steps__seg.is-current::after {
  content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: mpShim 1.8s infinite;
}
@keyframes mpShim { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.mp-steps-labels { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.75rem; color: var(--mp-muted); }

/* --- Forms --- */
.mp-field { margin-bottom: 14px; }
.mp-field label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--mp-muted); margin-bottom: 6px; }
.mp-input, .mp-select, .mp-textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; font-family: inherit;
  font-size: 0.9375rem; border: 1.5px solid var(--mp-border); border-radius: var(--mp-radius-sm);
  background: #fff; color: var(--mp-text); transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mp-input:focus, .mp-select:focus, .mp-textarea:focus {
  outline: none; border-color: var(--mp-highlight); box-shadow: 0 0 0 3px var(--mp-highlight-10);
}
.mp-textarea { min-height: 90px; resize: vertical; }

/* --- FAQ accordion --- */
.mp-faq { border: 1px solid var(--mp-border); border-radius: var(--mp-radius-sm); margin-bottom: 10px; overflow: hidden; background: #fff; }
.mp-faq__q {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 16px; cursor: pointer; font-weight: 600; font-size: 0.9375rem; user-select: none;
}
.mp-faq__q .material-icons { transition: transform 0.25s ease; color: var(--mp-muted); }
.mp-faq.is-open .mp-faq__q .material-icons { transform: rotate(180deg); }
.mp-faq__a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding: 0 16px; color: var(--mp-muted); font-size: 0.9rem; }
.mp-faq.is-open .mp-faq__a { max-height: 260px; padding: 0 16px 16px; }

/* --- Bottom navigation (mobile) --- */
.mp-bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--mp-border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.mp-bottom-nav button {
  flex: 1; border: none; background: none; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; color: var(--mp-faint); font-size: 0.6875rem; font-weight: 600;
  border-radius: 12px; transition: color 0.2s ease;
}
.mp-bottom-nav button .material-icons { font-size: 22px; }
.mp-bottom-nav button.is-active { color: var(--mp-green); }
.mp-bottom-nav button.is-active .material-icons {
  background: var(--mp-highlight-10); border-radius: var(--mp-radius-full); padding: 4px 12px;
}

/* --- Sheets / modals --- */
.mp-sheet, .mp-modal {
  position: fixed; inset: 0; z-index: 60; display: none;
}
.mp-sheet.is-open, .mp-modal.is-open { display: block; }
.mp-sheet-backdrop {
  position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45);
  animation: mpFade 0.2s ease;
}
.mp-sheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: #fff; border-radius: 22px 22px 0 0; padding: 8px 18px 26px;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--mp-shadow-lg);
  animation: mpSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes mpSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.mp-sheet__handle { width: 44px; height: 5px; border-radius: 3px; background: #d7e0dc; margin: 6px auto 14px; }
.mp-modal__panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: calc(100% - 32px); max-width: 460px; background: #fff; border-radius: var(--mp-radius);
  padding: 24px; box-shadow: var(--mp-shadow-lg); animation: mpFade 0.25s ease;
}
.mp-sheet__title, .mp-modal__title { font-size: 1.1rem; font-weight: 700; margin: 0 0 4px; }

/* --- Toast --- */
.mp-toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px);
  background: var(--mp-green); color: #fff; padding: 12px 20px; border-radius: var(--mp-radius-full);
  font-size: 0.875rem; font-weight: 600; box-shadow: var(--mp-shadow-lg); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100% - 32px); text-align: center;
}
.mp-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Model toggle (dev: Mieterstrom <-> GGV) --- */
.mp-model-toggle {
  display: inline-flex; align-items: center; gap: 2px; padding: 4px;
  background: #eef3f1; border-radius: var(--mp-radius-full); border: none; cursor: pointer;
  font-family: inherit;
}
.mp-model-toggle [data-model-option] {
  padding: 6px 12px; border-radius: var(--mp-radius-full); font-size: 0.75rem; font-weight: 600;
  color: var(--mp-muted); transition: all 0.2s ease;
}
.mp-model-toggle [data-model-option].is-active { background: #fff; color: var(--mp-green); box-shadow: var(--mp-shadow-sm); }

.mp-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.mp-hidden { display: none !important; }
