/* ==========================================================================
   Akinita Price Tools — frontend styles
   v2.1.0 — Glassmorphism / Messinian coastal palette
   ========================================================================== */

/* Shared design tokens, scoped to our own blocks only (no global :root leak) */
.apt-history,
.apt-chart-block,
.apt-area-avg,
.apt-badge,
.apt-estimate,
.apt-comps,
.apt-gauge,
.apt-dom,
.apt-stale-list,
.apt-heatmap {
	--apt-teal-900: #0b3536;
	--apt-teal-700: #0e7490;
	--apt-teal-500: #14b8a6;
	--apt-sand-400: #e8c99b;
	--apt-sand-300: #f2ddb8;
	--apt-terracotta-500: #c1694f;
	--apt-terracotta-600: #a85640;
	--apt-ink: #0f2a2b;
	--apt-muted: #4b6668;
	--apt-glass-bg: rgba(255, 255, 255, 0.55);
	--apt-glass-bg-strong: rgba(255, 255, 255, 0.72);
	--apt-glass-border: rgba(255, 255, 255, 0.65);
	--apt-glass-shadow: 0 10px 30px rgba(11, 53, 54, 0.14), 0 2px 8px rgba(11, 53, 54, 0.06);
	--apt-radius: 18px;
	font-family: inherit;
	box-sizing: border-box;
}
.apt-history *, .apt-chart-block *, .apt-area-avg *, .apt-estimate *,
.apt-comps *, .apt-gauge *, .apt-stale-list *, .apt-heatmap * { box-sizing: border-box; }

.apt-h4 {
	margin: 0 0 12px 0;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.01em;
	color: var(--apt-teal-900);
}

/* Generic "glass card" base, reused via individual selectors below */
@keyframes apt-rise {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ============ ΙΣΤΟΡΙΚΟ ΤΙΜΗΣ ============ */
.apt-history {
	margin: 16px 0;
	font-size: 14px;
	padding: 16px 18px;
	background: linear-gradient(155deg, var(--apt-glass-bg), rgba(232, 201, 155, 0.18));
	backdrop-filter: blur(14px) saturate(140%);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	border: 1px solid var(--apt-glass-border);
	border-radius: var(--apt-radius);
	box-shadow: var(--apt-glass-shadow);
	animation: apt-rise 0.35s ease-out;
}
.apt-history ul { list-style: none; padding: 0; margin: 0; }
.apt-history li {
	display: flex; align-items: center; gap: 10px;
	padding: 10px 0; border-bottom: 1px solid rgba(11, 53, 54, 0.08);
}
.apt-history li:last-child { border-bottom: 0; padding-bottom: 2px; }
.apt-history .apt-date { color: var(--apt-muted); min-width: 92px; font-size: 12.5px; }
.apt-history .apt-arrow { font-weight: 700; font-size: 15px; }
.apt-history .apt-down, .apt-history .apt-pct.apt-down { color: var(--apt-teal-500); }
.apt-history .apt-up, .apt-history .apt-pct.apt-up { color: var(--apt-terracotta-500); }
.apt-history .apt-initial { color: var(--apt-muted); }
.apt-history .apt-old { color: #94a3a3; text-decoration: line-through; font-size: 12.5px; }
.apt-history .apt-new { font-weight: 700; color: var(--apt-ink); }
.apt-history .apt-pct {
	font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
	background: rgba(11, 53, 54, 0.06);
}

/* ============ CHART ============ */
.apt-chart-block {
	margin: 16px 0; padding: 16px 18px 18px;
	background: linear-gradient(155deg, var(--apt-glass-bg), rgba(20, 184, 166, 0.10));
	backdrop-filter: blur(14px) saturate(140%);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	border: 1px solid var(--apt-glass-border);
	border-radius: var(--apt-radius);
	box-shadow: var(--apt-glass-shadow);
	animation: apt-rise 0.35s ease-out;
}
.apt-chart-wrap { margin-top: 10px; }

/* ============ ΜΕΣΟΣ ΟΡΟΣ ΠΕΡΙΟΧΗΣ ============ */
.apt-area-avg {
	padding: 16px 18px; border-radius: var(--apt-radius);
	background: linear-gradient(155deg, var(--apt-glass-bg), rgba(14, 116, 144, 0.10));
	backdrop-filter: blur(14px) saturate(140%);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	border: 1px solid var(--apt-glass-border);
	box-shadow: var(--apt-glass-shadow);
	font-size: 14px; margin: 16px 0; color: var(--apt-ink);
	animation: apt-rise 0.35s ease-out;
}
.apt-area-avg .apt-row { display: flex; justify-content: space-between; padding: 5px 0; }
.apt-area-avg .apt-row strong { color: var(--apt-teal-900); }
.apt-area-avg .apt-meta {
	color: var(--apt-muted); font-size: 12px; padding-top: 8px;
	border-top: 1px dashed rgba(11, 53, 54, 0.15); margin-top: 6px;
}
.apt-area-avg.apt-empty { color: var(--apt-muted); background: rgba(255,255,255,0.4); }

/* ============ BADGE ============ */
.apt-badge {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 6px 14px; border-radius: 999px;
	font-size: 12px; font-weight: 700; letter-spacing: 0.01em;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.5);
}
.apt-badge.apt-fair  { background: rgba(232, 201, 155, 0.35); color: #7a5a1e; }
.apt-badge.apt-below { background: rgba(20, 184, 166, 0.18);  color: #0b6d5f; }
.apt-badge.apt-above { background: rgba(193, 105, 79, 0.18);  color: var(--apt-terracotta-600); }

/* ============ GAUGE (νέο) ============ */
.apt-gauge {
	margin: 16px 0; padding: 20px 20px 18px;
	max-width: 340px;
	text-align: center;
	border-radius: var(--apt-radius);
	background: linear-gradient(160deg, var(--apt-glass-bg-strong), rgba(14, 116, 144, 0.12));
	backdrop-filter: blur(16px) saturate(150%);
	-webkit-backdrop-filter: blur(16px) saturate(150%);
	border: 1px solid var(--apt-glass-border);
	box-shadow: var(--apt-glass-shadow);
	animation: apt-rise 0.4s ease-out;
}
.apt-gauge.apt-gauge-empty {
	max-width: none; text-align: left; color: var(--apt-muted);
	background: rgba(255,255,255,0.4); font-size: 13.5px;
}
.apt-gauge-svg { width: 100%; height: auto; overflow: visible; }
.apt-gauge-track {
	fill: none; stroke: rgba(11, 53, 54, 0.08); stroke-width: 14; stroke-linecap: round;
}
.apt-gauge-arc { fill: none; stroke-width: 14; stroke-linecap: round; }
.apt-gauge-needle line {
	stroke: var(--apt-teal-900); stroke-width: 3.5; stroke-linecap: round;
	transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.apt-gauge-hub { fill: var(--apt-teal-900); }
.apt-gauge-median-tick { stroke: rgba(11, 53, 54, 0.45); stroke-width: 2.5; stroke-dasharray: 2 2; }
.apt-gauge-value {
	margin-top: -8px; font-size: 26px; font-weight: 800; color: var(--apt-teal-900); line-height: 1.1;
}
.apt-gauge-value span { font-size: 14px; font-weight: 600; color: var(--apt-muted); margin-left: 2px; }
.apt-gauge-label {
	display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 999px;
	font-size: 12px; font-weight: 700;
}
.apt-gauge-good  .apt-gauge-label { background: rgba(20, 184, 166, 0.18); color: #0b6d5f; }
.apt-gauge-fair  .apt-gauge-label { background: rgba(232, 201, 155, 0.4); color: #7a5a1e; }
.apt-gauge-high  .apt-gauge-label { background: rgba(193, 105, 79, 0.18); color: var(--apt-terracotta-600); }
.apt-gauge-scale {
	display: flex; justify-content: space-between; align-items: center;
	margin-top: 14px; font-size: 11px; color: var(--apt-muted);
}
.apt-gauge-scale-median { font-weight: 700; color: var(--apt-teal-700); }
.apt-gauge-meta { margin-top: 8px; font-size: 11px; color: var(--apt-muted); opacity: 0.85; }

/* ============ ESTIMATE ============ */
.apt-estimate {
	padding: 20px 22px; border-radius: var(--apt-radius);
	background: linear-gradient(155deg, rgba(255,255,255,0.7), rgba(20, 184, 166, 0.14));
	backdrop-filter: blur(16px) saturate(150%);
	-webkit-backdrop-filter: blur(16px) saturate(150%);
	border: 1px solid var(--apt-glass-border);
	box-shadow: var(--apt-glass-shadow);
	margin: 18px 0;
	animation: apt-rise 0.4s ease-out;
}
.apt-est-label { font-size: 11.5px; color: var(--apt-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.apt-est-value { font-size: 30px; font-weight: 800; color: var(--apt-teal-900); margin: 6px 0 2px; }
.apt-est-range { font-size: 14px; color: var(--apt-ink); }
.apt-est-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.apt-est-pill {
	display: inline-block; padding: 5px 12px; border-radius: 999px;
	font-size: 12px; font-weight: 700;
	background: rgba(14, 116, 144, 0.14); color: var(--apt-teal-700);
}
.apt-est-conf-high { background: rgba(20, 184, 166, 0.18); color: #0b6d5f; }
.apt-est-conf-mid  { background: rgba(232, 201, 155, 0.4); color: #7a5a1e; }
.apt-est-conf-low  { background: rgba(193, 105, 79, 0.18); color: var(--apt-terracotta-600); }
.apt-est-explainer {
	display: flex; gap: 9px; align-items: flex-start;
	margin-top: 14px; padding-top: 14px;
	border-top: 1px solid rgba(14, 116, 144, 0.18);
	font-size: 12px; color: var(--apt-muted); line-height: 1.55;
}
.apt-est-explainer svg { flex-shrink: 0; margin-top: 2px; color: var(--apt-teal-700); }
.apt-estimate.apt-empty {
	border-color: rgba(11, 53, 54, 0.12);
	background: rgba(255,255,255,0.45); color: var(--apt-muted);
}

/* ============ COMPARABLES ============ */
.apt-comps { margin: 18px 0; }
.apt-comps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.apt-comp {
	display: block; border-radius: 16px; overflow: hidden;
	text-decoration: none; color: inherit;
	background: var(--apt-glass-bg);
	backdrop-filter: blur(12px) saturate(140%);
	-webkit-backdrop-filter: blur(12px) saturate(140%);
	border: 1px solid var(--apt-glass-border);
	box-shadow: 0 4px 14px rgba(11, 53, 54, 0.08);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.apt-comp:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(11, 53, 54, 0.16); }
.apt-comp-img {
	width: 100%; height: 140px;
	background-size: cover; background-position: center;
	background-color: rgba(11, 53, 54, 0.06);
	display: flex; align-items: center; justify-content: center;
}
.apt-comp-noimg { color: var(--apt-muted); font-size: 12px; }
.apt-comp-info { padding: 12px 14px 14px; }
.apt-comp-title {
	font-weight: 700; font-size: 13px; line-height: 1.35; color: var(--apt-ink);
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
	overflow: hidden; min-height: 36px;
}
.apt-comp-price { font-size: 16px; font-weight: 800; color: var(--apt-teal-900); margin: 8px 0 2px; }
.apt-comp-meta { font-size: 11px; color: var(--apt-muted); }

/* ============ DAYS ON MARKET ============ */
.apt-dom {
	display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px;
	font-size: 12px; font-weight: 700;
	backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
	border: 1px solid rgba(255,255,255,0.5);
}
.apt-dom.apt-fresh { background: rgba(20, 184, 166, 0.18); color: #0b6d5f; }
.apt-dom.apt-warm  { background: rgba(232, 201, 155, 0.4); color: #7a5a1e; }
.apt-dom.apt-stale { background: rgba(193, 105, 79, 0.18); color: var(--apt-terracotta-600); }

/* ============ STALE LISTINGS ============ */
.apt-stale-list {
	margin: 16px 0; padding: 16px 18px; border-radius: var(--apt-radius);
	background: var(--apt-glass-bg);
	backdrop-filter: blur(14px) saturate(140%);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	border: 1px solid var(--apt-glass-border);
	box-shadow: var(--apt-glass-shadow);
}
.apt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.apt-table th, .apt-table td { padding: 10px 8px; border-bottom: 1px solid rgba(11, 53, 54, 0.08); text-align: left; }
.apt-table th { color: var(--apt-teal-900); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.apt-table tbody tr:hover { background: rgba(20, 184, 166, 0.06); }

/* ============ HEATMAP ============ */
.apt-heatmap {
	width: 100%; border-radius: var(--apt-radius); overflow: hidden;
	border: 1px solid var(--apt-glass-border);
	box-shadow: var(--apt-glass-shadow);
}

/* ============ POPUP DYNAMIC CONTENT (loading state) ============ */
.apt-popup-dynamic { min-height: 40px; }
.apt-popup-loading {
	display: flex; align-items: center; justify-content: center;
	padding: 24px 0; color: var(--apt-muted, #4b6668);
	font-size: 13px;
}

/* ============ SUMMARY GRID (ενιαίο, χωρίς κενά όταν λείπουν δεδομένα) ============ */
.apt-popup-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 12px;
	margin: 14px auto;
	max-width: 560px; /* περιορίζει το πλάτος ακόμα κι αν το popup box είναι πολύ φαρδύ */
}
.apt-popup-summary.apt-empty {
	display: block; margin: 14px auto; max-width: 560px;
	padding: 22px; text-align: center;
	color: #4b6668; background: rgba(14,116,144,0.06); border-radius: 14px;
	font-size: 13.5px;
}
.apt-popup-summary .apt-tile-wide { grid-column: 1 / -1; }
.apt-tile {
	background: rgba(14, 116, 144, 0.06);
	border: 1px solid rgba(11, 53, 54, 0.10);
	border-radius: 14px;
	padding: 14px 16px;
}
/* Όταν το tile "τυλίγει" ένα ήδη πλήρες widget (π.χ. gauge), δεν βάζουμε
   δεύτερο background/border πάνω στο δικό του — αποφεύγει το "διπλό κουτί". */
.apt-tile.apt-tile-plain {
	background: none; border: none; padding: 0;
	display: flex; justify-content: center;
}
.apt-tile-label {
	font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
	color: #4b6668; font-weight: 700; margin-bottom: 4px;
}
.apt-tile-value { font-size: 18px; font-weight: 800; color: #0b3536; }
.apt-tile-value .apt-tile-unit { font-size: 12px; font-weight: 600; color: #4b6668; }
.apt-tile-sub { font-size: 11px; color: #4b6668; margin-top: 3px; }
.apt-tile-dom.apt-fresh { color: #0b6d5f; }
.apt-tile-dom.apt-warm  { color: #7a5a1e; }
.apt-tile-dom.apt-stale { color: #a85640; }

.apt-mini-comps { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.apt-mini-comp {
	display: flex; justify-content: space-between; align-items: center; gap: 10px;
	text-decoration: none; color: inherit; font-size: 13px;
	padding: 9px 12px; border-radius: 10px;
	background: rgba(14, 116, 144, 0.05);
	border: 1px solid rgba(11, 53, 54, 0.08);
	transition: background 0.15s ease;
}
.apt-mini-comp:hover { background: rgba(14, 116, 144, 0.12); }
.apt-mini-comp-title { font-weight: 600; color: #0b3536; }
.apt-mini-comp-price { font-weight: 700; color: #0b3536; white-space: nowrap; }

/* ============ RESPONSIVE ============ */
@media (max-width: 480px) {
	.apt-gauge { max-width: none; }
	.apt-comps-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
	.apt-est-value { font-size: 24px; }
}
