/* =============================================================
   PRODUCT-DETAIL.CSS
   Layout, app shell, product detail modal, market overlay
   ============================================================= */


/* ── 1. GLOBAL RESET ─────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}


/* ── 2. BODY ─────────────────────────────────────────────── */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ── 3. APP SHELL ────────────────────────────────────────── */

.app {
    max-width: 428px;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    position: relative;
}

.content {
    flex: 1;
    padding: 20px;
    padding-bottom: 90px;
}


/* ── 4. HEADER ───────────────────────────────────────────── */

.header {
    background: var(--bg-elevated);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}


/* ── 5. BOTTOM NAVIGATION ────────────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 428px;
    height: 70px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.fab-circle {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: 50%;
    margin-top: -35px;
    border: 5px solid var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
}

.fab-circle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}


/* ── 6. EMPTY STATE ──────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state svg {
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}


/* ── 7. PRODUCT DETAIL MODAL ─────────────────────────────── */

/* Bottom-sheet drag handle */
.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 20px;
}

/* ── Header ── */

.detail-header {
    margin-bottom: 20px;
}

.detail-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.detail-product-info {
    margin-bottom: 12px;
}

.detail-product-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.detail-product-market {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Price section ── */

.detail-price-section {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-current-price {
    display: flex;
    align-items: baseline;
}

.detail-price {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
}

.detail-change {
    font-size: 13px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.detail-change.up {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.detail-change.down {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.detail-change.same {
    background: var(--primary-subtle);
    color: var(--primary-dark);
}

/* ── Watch button ── */

.watch-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.watch-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: var(--transition);
}

.watch-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

.watch-btn.watching {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: #0f172a;
}

.watch-btn.watching svg {
    fill: #0f172a;
    stroke: #0f172a;
}

/* Guest variant */
.watch-btn-guest {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1.5px dashed var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.75;
    transition: var(--transition);
}

.watch-btn-guest svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Close button */
.close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.close-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.close-btn svg {
    width: 14px;
    height: 14px;
}


/* ── 8. CHART SECTION ────────────────────────────────────── */

.chart-section {
    margin-bottom: 20px;
}

.chart-header {
    margin-bottom: 10px;
}

.chart-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
}

.area-chart-container {
    position: relative;
}

.area-chart {
    width: 100%;
    height: 120px;
    display: block;
    border-radius: 10px;
}

.chart-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.chart-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
}

.chart-stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.chart-stat-value {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.chart-stat-value.high { color: var(--danger); }
.chart-stat-value.low  { color: var(--success); }


/* ── 9. MARKET LIST ──────────────────────────────────────── */

.markets-section {
    margin-top: 4px;
}

.markets-header {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.market-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.market-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.market-item:hover {
    border-color: var(--primary);
    background: var(--primary-subtle);
}

.market-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.market-item-name::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.market-item-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.4px;
}

/* Loading / empty states */
.market-loading,
.market-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.market-loading::after {
    content: ' ⋯';
    animation: blink 1.2s steps(1) infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}


/* ── 10. VERIFIED BADGES ─────────────────────────────────── */

.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: var(--success);
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
}

.verified-badge svg { color: #fff; }

.reporter-verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: var(--success);
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
    margin-left: 2px;
}

.reporter-verified svg { color: #fff; }


/* ── 11. DARK MODE ───────────────────────────────────────── */

[data-theme="dark"] .market-item {
    background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .market-item:hover {
    background: var(--primary-subtle);
}

[data-theme="dark"] .chart-stat {
    background: rgba(255, 255, 255, 0.04);
}