/* ═══════════════════════════════════════════════════════════════════════════
   HFB Prediction Markets — CSS
   Architecture Polymarket style
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Markets section ─────────────────────────────────────────────────────── */
.pm-section {
    margin: 40px 0;
}
.pm-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.pm-section-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}
.pm-section-header h2 i { color: #FF6B00; }

/* Filter tags */
.pm-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.pm-filter-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #2a2a2a;
    background: transparent;
    color: #666;
    font-size: .78rem;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    letter-spacing: .03em;
}
.pm-filter-btn:hover { border-color: #555; color: #ccc; }
.pm-filter-btn.active {
    background: rgba(255,107,0,.12);
    border-color: rgba(255,107,0,.5);
    color: #FF8C00;
}

/* ── Market Grid ─────────────────────────────────────────────────────────── */
.pm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

/* ── Market Card ─────────────────────────────────────────────────────────── */
.pm-card {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 14px;
    padding: 18px;
    cursor: pointer;
    transition: border-color .18s, transform .18s, box-shadow .18s;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    overflow: hidden;
}
.pm-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #FF6B00, transparent);
    opacity: 0;
    transition: opacity .2s;
}
.pm-card:hover {
    border-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
.pm-card:hover::before { opacity: 1; }

/* Card header */
.pm-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.pm-cat-tag {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #FF8C00;
    background: rgba(255,107,0,.1);
    padding: 3px 9px;
    border-radius: 20px;
}
.pm-vol {
    font-size: .72rem;
    color: #555;
    font-family: 'JetBrains Mono', monospace;
}
.pm-end-date {
    font-size: .7rem;
    color: #444;
}

/* Title */
.pm-card-title {
    font-size: .95rem;
    font-weight: 700;
    color: #eee;
    line-height: 1.4;
    flex: 1;
}

/* ── Binary outcome bar (Polymarket style) ───────────────────────────────── */
.pm-prob-bar {
    height: 6px;
    border-radius: 3px;
    background: #1a1a1a;
    overflow: hidden;
    margin: 2px 0;
}
.pm-prob-fill {
    height: 100%;
    background: linear-gradient(90deg, #14F195, #0ea472);
    border-radius: 3px;
    transition: width .4s ease;
}

/* YES/NO buttons */
.pm-binary-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.pm-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: 'Rajdhani', sans-serif;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    letter-spacing: .03em;
}
.pm-btn-yes {
    background: rgba(20,241,149,.07);
    border-color: rgba(20,241,149,.2);
    color: #14F195;
}
.pm-btn-yes:hover {
    background: rgba(20,241,149,.15);
    border-color: rgba(20,241,149,.5);
    box-shadow: 0 0 12px rgba(20,241,149,.15);
}
.pm-btn-no {
    background: rgba(255,68,68,.07);
    border-color: rgba(255,68,68,.2);
    color: #ff4444;
}
.pm-btn-no:hover {
    background: rgba(255,68,68,.15);
    border-color: rgba(255,68,68,.4);
    box-shadow: 0 0 12px rgba(255,68,68,.12);
}
.pm-btn-label { font-size: .78rem; opacity: .7; }
.pm-btn-price { font-size: 1rem; font-family: 'Orbitron', sans-serif; }

/* Multi-outcome list */
.pm-multi-list { display: flex; flex-direction: column; gap: 6px; }
.pm-multi-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #1e1e1e;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.pm-multi-row:hover { background: rgba(255,255,255,.03); border-color: #333; }
.pm-multi-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pm-multi-label { flex: 1; font-size: .85rem; color: #ccc; font-weight: 600; }
.pm-multi-bar-wrap {
    width: 80px; height: 4px;
    background: #1a1a1a; border-radius: 2px;
    overflow: hidden;
}
.pm-multi-bar-fill { height: 100%; border-radius: 2px; transition: width .3s; }
.pm-multi-price {
    font-family: 'Orbitron', sans-serif;
    font-size: .78rem;
    color: #fff;
    min-width: 38px;
    text-align: right;
}
.pm-multi-bet-btn {
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255,107,0,.1);
    border: 1px solid rgba(255,107,0,.3);
    color: #FF8C00;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    font-family: 'Rajdhani', sans-serif;
}
.pm-multi-bet-btn:hover { background: rgba(255,107,0,.2); border-color: #FF8C00; }

/* User position badge */
.pm-my-pos {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .72rem;
    color: #555;
    padding-top: 8px;
    border-top: 1px solid #1a1a1a;
}
.pm-my-pos .pos-tag {
    background: rgba(20,241,149,.08);
    color: #14F195;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}

/* ── Trade Modal ─────────────────────────────────────────────────────────── */
.pm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: pmFadeIn .2s ease;
}
@keyframes pmFadeIn { from { opacity:0; } to { opacity:1; } }

.pm-modal {
    background: #0f0f0f;
    border: 1px solid #222;
    border-radius: 18px;
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    animation: pmSlideUp .22s ease;
}
@keyframes pmSlideUp { from { transform:translateY(20px); opacity:0; } to { transform:translateY(0); opacity:1; } }

.pm-modal-header {
    padding: 20px 22px 16px;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.pm-modal-header h3 {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.4;
    flex: 1;
}
.pm-modal-close {
    background: none;
    border: none;
    color: #444;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px;
    transition: color .15s;
    flex-shrink: 0;
}
.pm-modal-close:hover { color: #fff; }

.pm-modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; }

/* Buy/Sell tabs */
.pm-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #0a0a0a;
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}
.pm-tab {
    padding: 9px;
    border-radius: 8px;
    border: none;
    font-family: 'Rajdhani', sans-serif;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    color: #444;
    background: none;
}
.pm-tab.active-buy  { background: rgba(20,241,149,.1); color: #14F195; }
.pm-tab.active-sell { background: rgba(255,68,68,.1); color: #ff4444; }

/* Outcome selector */
.pm-outcome-btns { display: grid; gap: 6px; }
.pm-outcome-btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #1e1e1e;
    background: #0a0a0a;
    color: #888;
    font-family: 'Rajdhani', sans-serif;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all .15s;
}
.pm-outcome-btn:hover { border-color: #333; color: #ccc; }
.pm-outcome-btn.selected-yes { border-color: rgba(20,241,149,.5); color: #14F195; background: rgba(20,241,149,.06); }
.pm-outcome-btn.selected-no  { border-color: rgba(255,68,68,.4); color: #ff4444; background: rgba(255,68,68,.05); }
.pm-outcome-btn.selected-multi { border-color: rgba(255,107,0,.5); color: #FF8C00; background: rgba(255,107,0,.06); }
.pm-outcome-price { font-family: 'Orbitron', sans-serif; font-size: .85rem; }

/* Amount input */
.pm-amount-wrap { display: flex; flex-direction: column; gap: 8px; }
.pm-amount-label {
    font-size: .75rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.pm-amount-input-row {
    display: flex;
    align-items: center;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 4px 4px 4px 14px;
    gap: 8px;
    transition: border-color .15s;
}
.pm-amount-input-row:focus-within { border-color: #FF6B00; }
.pm-usdc-icon {
    font-size: .85rem;
    color: #2775CA;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    flex-shrink: 0;
}
.pm-amount-input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    outline: none;
    padding: 8px 0;
    min-width: 0;
}
.pm-amount-input::placeholder { color: #333; }
.pm-max-btn {
    padding: 7px 12px;
    border-radius: 7px;
    background: rgba(255,107,0,.1);
    border: none;
    color: #FF8C00;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    transition: background .15s;
    white-space: nowrap;
}
.pm-max-btn:hover { background: rgba(255,107,0,.2); }

/* Quick amount chips */
.pm-quick-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pm-chip {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #222;
    background: none;
    color: #555;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    transition: all .12s;
}
.pm-chip:hover { border-color: #444; color: #ccc; }

/* Quote preview */
.pm-quote-box {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pm-quote-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .83rem;
}
.pm-quote-row .ql { color: #555; }
.pm-quote-row .qr { color: #ccc; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.pm-quote-row .qr.green { color: #14F195; }
.pm-quote-row .qr.red   { color: #ff4444; }
.pm-quote-divider { height: 1px; background: #1a1a1a; margin: 2px 0; }

/* Potential profit highlight */
.pm-potential {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(20,241,149,.05);
    border: 1px solid rgba(20,241,149,.15);
    border-radius: 10px;
}
.pm-potential .pl { font-size: .82rem; color: #888; }
.pm-potential .pr { font-family: 'Orbitron', sans-serif; font-size: 1rem; font-weight: 700; color: #14F195; }

/* Submit button */
.pm-submit-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-family: 'Orbitron', sans-serif;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .06em;
    cursor: pointer;
    transition: all .18s;
}
.pm-submit-btn.buy-btn {
    background: linear-gradient(135deg, #14F195, #0ea472);
    color: #000;
}
.pm-submit-btn.buy-btn:hover { box-shadow: 0 0 20px rgba(20,241,149,.3); transform: translateY(-1px); }
.pm-submit-btn.sell-btn {
    background: linear-gradient(135deg, #ff4444, #cc2222);
    color: #fff;
}
.pm-submit-btn.sell-btn:hover { box-shadow: 0 0 20px rgba(255,68,68,.25); transform: translateY(-1px); }
.pm-submit-btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Connect required */
.pm-connect-required {
    text-align: center;
    padding: 20px;
    color: #555;
    font-size: .88rem;
}
.pm-connect-required button {
    margin-top: 12px;
    padding: 10px 24px;
    border-radius: 10px;
    background: rgba(153,69,255,.12);
    border: 1px solid rgba(153,69,255,.3);
    color: #9945FF;
    font-family: 'Rajdhani', sans-serif;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}
.pm-connect-required button:hover { background: rgba(153,69,255,.2); }

/* Balance bar */
.pm-balance-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 10px;
    font-size: .8rem;
}
.pm-balance-label { color: #444; }
.pm-balance-val { color: #14F195; font-family: 'Orbitron', sans-serif; font-size: .85rem; font-weight: 700; }

/* Toast notification */
.pm-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #111;
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .88rem;
    color: #fff;
    z-index: 9999;
    transform: translateY(20px);
    opacity: 0;
    transition: all .25s ease;
    max-width: 340px;
    border: 1px solid #222;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.pm-toast.show { transform: translateY(0); opacity: 1; }
.pm-toast.success { border-color: rgba(20,241,149,.4); }
.pm-toast.success i { color: #14F195; }
.pm-toast.error { border-color: rgba(255,68,68,.4); }
.pm-toast.error i { color: #ff4444; }
.pm-toast.info { border-color: rgba(255,107,0,.3); }
.pm-toast.info i { color: #FF8C00; }

/* ── Portfolio panel ─────────────────────────────────────────────────────── */
.pm-portfolio {
    background: #0f0f0f;
    border: 1px solid #1a1a1a;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.pm-portfolio-header { display: flex; align-items: center; justify-content: space-between; }
.pm-portfolio-title {
    font-family: 'Orbitron', sans-serif;
    font-size: .8rem;
    color: #555;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.pm-portfolio-total {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}
.pm-portfolio-sub { font-size: .78rem; color: #555; margin-top: 2px; }

.pm-position-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #1a1a1a;
}
.pm-position-row:last-child { border-bottom: none; }
.pm-pos-outcome {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 900;
    flex-shrink: 0;
}
.pm-pos-outcome.yes { background: rgba(20,241,149,.12); color: #14F195; }
.pm-pos-outcome.no  { background: rgba(255,68,68,.1); color: #ff4444; }
.pm-pos-outcome.multi { background: rgba(255,107,0,.1); color: #FF8C00; }
.pm-pos-info { flex: 1; min-width: 0; }
.pm-pos-title { font-size: .82rem; color: #ccc; font-weight: 600; line-height: 1.3; 
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pm-pos-sub { font-size: .72rem; color: #555; margin-top: 2px; }
.pm-pos-val { text-align: right; }
.pm-pos-value { font-family: 'Orbitron', sans-serif; font-size: .88rem; font-weight: 700; color: #fff; }
.pm-pos-pnl { font-size: .72rem; margin-top: 2px; }
.pm-pos-pnl.pos { color: #14F195; }
.pm-pos-pnl.neg { color: #ff4444; }

/* ── Activity feed ───────────────────────────────────────────────────────── */
.pm-activity { display: flex; flex-direction: column; gap: 0; }
.pm-activity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #111;
    font-size: .8rem;
}
.pm-activity-row:last-child { border-bottom: none; }
.pm-act-side {
    padding: 3px 8px;
    border-radius: 5px;
    font-weight: 700;
    font-size: .7rem;
    flex-shrink: 0;
}
.pm-act-side.buy  { background: rgba(20,241,149,.1); color: #14F195; }
.pm-act-side.sell { background: rgba(255,68,68,.1); color: #ff4444; }
.pm-act-outcome { color: #888; flex-shrink: 0; }
.pm-act-shares { color: #ccc; font-family: 'JetBrains Mono', monospace; flex: 1; }
.pm-act-price { color: #555; }
.pm-act-time { color: #333; flex-shrink: 0; }

/* ── Resolved market ─────────────────────────────────────────────────────── */
.pm-resolved-banner {
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(20,241,149,.07);
    border: 1px solid rgba(20,241,149,.2);
    color: #14F195;
    font-size: .82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Loading skeleton ────────────────────────────────────────────────────── */
.pm-skeleton {
    background: linear-gradient(90deg, #111 25%, #1a1a1a 50%, #111 75%);
    background-size: 200% 100%;
    animation: pmSkel 1.5s infinite;
    border-radius: 8px;
}
@keyframes pmSkel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .pm-grid { grid-template-columns: 1fr; }
    .pm-modal { border-radius: 14px 14px 0 0; }
    .pm-modal-overlay { align-items: flex-end; padding: 0; }
    .pm-toast { right: 16px; bottom: 90px; }
}
