/* =============================================
   Eastside Market Widget — Styles
   White background, HUD-safe, clean design
   ============================================= */

/* ── Wrapper ──────────────────────────────── */
.emw-wrap {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    padding: 2rem 2.25rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1a1a2e;
    max-width: 1100px;
    margin: 0 auto 2rem;
    box-sizing: border-box;
}

/* ── Headings ─────────────────────────────── */
.emw-title {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: #0a2342;
    letter-spacing: -0.3px;
}
.emw-subtitle {
    color: #5b6470;
    font-size: 0.93rem;
    margin: 0 0 1.5rem;
}

/* ── Narrative ────────────────────────────── */
.emw-narrative {
    background: #f5f8ff;
    border-left: 4px solid #1a6fc4;
    border-radius: 0 8px 8px 0;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    font-size: 0.95rem;
    line-height: 1.75;
    color: #2d3748;
}
.emw-narrative p {
    margin: 0 0 1em;
}
.emw-narrative p:last-child {
    margin-bottom: 0;
}
.emw-narrative strong {
    color: #0a2342;
}

/* ── Table wrapper ────────────────────────── */
.emw-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    border: 1px solid #e8edf3;
}

/* ── Main table ───────────────────────────── */
.emw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    min-width: 580px;
}
.emw-table thead tr {
    background: #0a2342;
    color: #ffffff;
}
.emw-table thead th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.emw-row {
    border-bottom: 1px solid #eef1f6;
    transition: background 0.15s;
}
.emw-row:last-child {
    border-bottom: none;
}
.emw-row:hover {
    background: #f0f7ff;
}
.emw-row:nth-child(even) {
    background: #fafbfd;
}
.emw-row:nth-child(even):hover {
    background: #f0f7ff;
}
.emw-table td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
}

/* Rank badge */
.emw-rank {
    font-weight: 700;
    color: #1a6fc4;
    font-size: 0.85rem;
    min-width: 28px;
}
.emw-row:first-child .emw-rank { color: #c5960a; }
.emw-row:nth-child(2) .emw-rank { color: #7b8794; }
.emw-row:nth-child(3) .emw-rank { color: #a0522d; }

/* City link */
.emw-city a {
    color: #0a2342;
    text-decoration: none;
    font-weight: 600;
}
.emw-city a:hover {
    color: #1a6fc4;
    text-decoration: underline;
}

/* Price bar */
.emw-price-wrap {
    position: relative;
}
.emw-price-wrap strong {
    font-size: 1rem;
    color: #0a2342;
    position: relative;
    z-index: 1;
}
.emw-bar {
    position: absolute;
    top: 50%;
    left: -4px;
    transform: translateY(-50%);
    height: 28px;
    background: linear-gradient(90deg, rgba(26,111,196,0.12) 0%, rgba(26,111,196,0.05) 100%);
    border-radius: 4px;
    transition: width 0.6s ease;
    pointer-events: none;
}

/* Other cells */
.emw-dom, .emw-supply, .emw-pct {
    color: #4a5568;
    white-space: nowrap;
}

/* Updated line */
.emw-updated {
    margin: 1rem 0 0;
    font-size: 0.8rem;
    color: #8592a3;
    display: flex;
    align-items: center;
    gap: 6px;
}
.emw-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: emw-pulse 2s infinite;
    flex-shrink: 0;
}
@keyframes emw-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── City Cards ───────────────────────────── */
.emw-city-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
    box-sizing: border-box;
}
.emw-city-card:hover {
    box-shadow: 0 4px 20px rgba(10,35,66,0.12);
    transform: translateY(-2px);
}
.emw-city-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}
.emw-city-card__name {
    font-size: 1rem;
    font-weight: 700;
    color: #0a2342;
    text-decoration: none;
}
.emw-city-card__name:hover {
    color: #1a6fc4;
}
.emw-city-card__tag {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1a6fc4;
    background: #e8f1fb;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.emw-city-card__price {
    font-size: 1.9rem;
    font-weight: 800;
    color: #0a2342;
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 1rem;
}
.emw-city-card__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    border-top: 1px solid #eef1f6;
    padding-top: 0.75rem;
}
.emw-city-card__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.emw-city-card__stat-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #8592a3;
    font-weight: 600;
}
.emw-city-card__stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2d3748;
}
.emw-city-card__updated {
    margin: 0.75rem 0 0;
    font-size: 0.73rem;
    color: #b0bac7;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── City Grid ────────────────────────────── */
.emw-city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin: 0 auto;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 720px) {
    .emw-wrap {
        padding: 1.25rem 1rem;
    }
    .emw-title {
        font-size: 1.3rem;
    }
    .emw-city-card__stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .emw-city-card__price {
        font-size: 1.55rem;
    }
    .emw-city-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Loading shimmer ──────────────────────── */
.emw-loading {
    animation: emw-shimmer 1.5s infinite linear;
    background: linear-gradient(90deg, #f0f4f8 25%, #e2e8f0 50%, #f0f4f8 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    color: transparent !important;
}
@keyframes emw-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
