/* ============================================================
   Asuntotutka design system
   CSS custom properties + at-* component classes
   ============================================================ */

:root {
  --color-brand:          #213864;
  --color-brand-dark:     #192d52;
  --color-bg-muted:       #f0f2f5;
  --color-text-primary:   #213864;
  --color-text-secondary: #6b7280;
  --color-border:         #e5e7eb;
  --color-green:          #16a34a;
  --color-red:            #dc2626;
  --color-amber:          #d97706;
  --radius-md:            12px;
  --radius-sm:            8px;
}

/* ── Hero ─────────────────────────────────────────────────── */

.at-hero {
  background: #ffffff;
  padding: 36px 20px 48px;
  text-align: center;
}

.at-hero-headline {
  color: var(--color-text-primary);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.2;
  text-align: center;
}

@media (max-width: 600px) {
  .at-hero-headline { font-size: 1.35rem; }
}

.at-hero-subtext {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin: 0 auto 22px;
  text-align: center;
  max-width: 480px;
}

/* ── Tab container ────────────────────────────────────────── */

.at-tab-container .tab--selected { /* handled by tab_selected_style inline */ }

/* ── URL input row (tab 1) ────────────────────────────────── */

.at-input-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 14px 16px 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
}

.at-input-label {
  display: block;
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  text-align: left;
}

/* Row: input flex-grows, button stays fixed height */
.at-url-input-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

/* dbc.Input renders as <input class="form-control"> directly */
.at-url-input-row input {
  flex: 1 1 0;
  min-width: 0;
  height: 40px !important;
  border-radius: var(--radius-sm) !important;
}

.at-cta-button {
  height: 40px;
  flex-shrink: 0;
  padding: 0 18px;
  background-color: var(--color-brand);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s;
}

.at-cta-button:hover { background-color: var(--color-brand-dark); }

/* ── Manual input form (tab 2) ────────────────────────────── */

.at-form-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
}

.at-form-field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  text-align: left;
}

.at-form-field-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  width: 110px;
  flex: 0 0 110px;
  text-align: left;
}

/* Any control next to a label fills the remaining width of the row */
.at-form-field-row > *:not(.at-form-field-label) {
  flex: 1 1 auto;
  min-width: 0;
}

/* Mantine inputs/segmented-controls render their root with display:flex by default;
   ensure the input element itself stretches to 100% of the cell width. */
.at-form-field-row .mantine-Select-root,
.at-form-field-row .mantine-NumberInput-root,
.at-form-field-row .mantine-SegmentedControl-root,
.at-form-field-row .mantine-TextInput-root {
  width: 100%;
}

.at-form-field-row .mantine-Select-input,
.at-form-field-row .mantine-NumberInput-input,
.at-form-field-row .mantine-TextInput-input {
  width: 100%;
}

.at-cta-button-full {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 16px;
  background-color: var(--color-brand);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 14px;
  transition: background-color 0.15s;
}

.at-cta-button-full:hover { background-color: var(--color-brand-dark); }

/* ── Info section (below hero) ────────────────────────────── */

.at-info-section {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  padding: 22px 24px;
  text-align: left;
}

.at-info-heading {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0 0 12px;
}

.at-info-body {
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
  margin: 0 0 10px;
}

/* ── Result layout ────────────────────────────────────────── */

.at-result-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 768px) {
  .at-result-grid { grid-template-columns: 1fr; }
}

.at-result-col-main,
.at-result-col-side {
  display: flex;
  flex-direction: column;
}

/* ── Cards ────────────────────────────────────────────────── */

.at-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}

/* analysis_card (with CardSection border) gets the same outer look */
.at-analysis-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* Inner content wrapper for content_card. No horizontal padding so the
   content (icons / table cells) aligns with the title indent above. */
.at-card-content {
  padding: 12px 0 0;
}

/* Map card: extend the inner content edge-to-edge using negative margins
   that cancel the parent Card's 20px CSS padding. */
.at-map-card .at-card-content {
  padding: 0;
  margin: 0 -20px -20px;
}

/* Compact tables (Vuokratiedot, Myynti-ilmoitus) inside cards.
   First column has no left padding so its left edge aligns with the
   card title above; other columns get a small left padding for gap. */
.at-card-content .mantine-Table-table td,
.at-card-content table td {
  padding: 4px 6px !important;
  white-space: nowrap;
}
.at-card-content .mantine-Table-table td:first-child,
.at-card-content table td:first-child {
  padding-left: 0 !important;
}
.at-card-content .mantine-Table-table td:nth-child(2),
.at-card-content table td:nth-child(2) {
  font-weight: 400;
  color: var(--color-text-primary);
}

/* ── Price display ────────────────────────────────────────── */

.at-price-block { margin-bottom: 4px; }

.at-price-main {
  font-size: 1.6rem;
  font-weight: 800 !important;
  color: var(--color-brand);
  margin: 0 0 4px;
  line-height: 1.2;
}

.at-price-range {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.at-apt-description {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 8px;
}

/* ── Signal / Huomioitavaa ────────────────────────────────── */

.at-signals-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
  text-align: left;
}

.at-signal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 4px 0 !important;
}

/* Icon container size (DashIconify ThemeIcon replacement) */
.at-signal-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.at-signal-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.4;
  text-align: left;
}
