/*
 * ⟐ MOROCOTA — Interfaz de cartera clandestina
 * Estética: terminal soviético dañado · ledger analógico · BBS 1993
 */

:root {
    --mrc-green:     #20c20e;
    --mrc-amber:     #ffb000;
    --mrc-red:       #ff3333;
    --mrc-corrupt:   #ff6b35;
    --mrc-dim:       #1a3a1a;
    --mrc-border:    rgba(32, 194, 14, .18);
    --mrc-bg:        #050f05;
    --mrc-bg-card:   rgba(10, 25, 10, .95);
    --mrc-espectral: #c084fc;
    --mrc-unico:     #ffd700;
    --mrc-clasificado: #94a3b8;
    --mrc-raro:      #60a5fa;
    --mrc-comun:     #4ade80;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */

.mrc-page {
    min-height: 100vh;
    background: var(--mrc-bg);
    color: var(--mrc-green);
    font-family: 'Courier New', Courier, monospace;
    font-size: .82rem;
    line-height: 1.55;
    padding: 1rem;
    box-sizing: border-box;
}

.mrc-page * { box-sizing: border-box; }

/* CRT scanline overlay */
.mrc-page::before {
    content: '';
    position: fixed; inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,.07) 2px,
        rgba(0,0,0,.07) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

/* ── Boot header ────────────────────────────────────────────────────────────── */

.mrc-boot-header {
    border-bottom: 1px solid var(--mrc-border);
    padding-bottom: .6rem;
    margin-bottom: 1.2rem;
    color: rgba(32, 194, 14, .55);
    font-size: .72rem;
    letter-spacing: .06em;
}

.mrc-boot-line { animation: mrc-fadein .4s ease both; }
.mrc-boot-line:nth-child(2) { animation-delay: .15s; }
.mrc-boot-line:nth-child(3) { animation-delay: .30s; }

.mrc-title {
    color: var(--mrc-amber);
    font-size: 1.15rem;
    letter-spacing: .14em;
    font-weight: bold;
    margin: .4rem 0 .1rem;
    animation: mrc-fadein .6s ease both;
    text-shadow: 0 0 12px rgba(255,176,0,.35);
}

.mrc-subtitle {
    color: rgba(32,194,14,.5);
    font-size: .7rem;
    letter-spacing: .08em;
}

/* ── Balance display ────────────────────────────────────────────────────────── */

.mrc-balance-section {
    background: var(--mrc-bg-card);
    border: 1px solid var(--mrc-border);
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.mrc-balance-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--mrc-amber), transparent);
    animation: mrc-scan 4s linear infinite;
}

.mrc-balance-label {
    font-size: .65rem;
    color: rgba(32,194,14,.5);
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: .3rem;
}

.mrc-balance-row {
    display: flex;
    align-items: baseline;
    gap: .4rem;
    margin-bottom: .4rem;
}

.mrc-symbol-big {
    font-size: 1.5rem;
    color: var(--mrc-amber);
    text-shadow: 0 0 18px rgba(255,176,0,.5);
    animation: mrc-flicker 8s ease-in-out infinite;
}

.mrc-amount-big {
    font-size: 2rem;
    font-weight: bold;
    color: var(--mrc-green);
    text-shadow: 0 0 20px rgba(32,194,14,.4);
    letter-spacing: .05em;
    animation: mrc-flicker 11s ease-in-out infinite;
    font-variant-numeric: tabular-nums;
}

.mrc-amount-big.mrc-updating {
    animation: mrc-credit-flash .6s ease;
}
.mrc-amount-big.mrc-debit {
    animation: mrc-debit-flash .6s ease;
}

.mrc-balance-sub {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: .4rem;
}

.mrc-corrupted-label {
    font-size: .7rem;
    color: var(--mrc-corrupt);
}

.mrc-corrupted-val {
    color: var(--mrc-corrupt);
    font-weight: bold;
}

/* Anomaly bar */
.mrc-anomaly-row {
    font-size: .7rem;
    color: rgba(32,194,14,.55);
}

.mrc-anomaly-bar {
    display: inline-block;
    width: 80px;
    height: 8px;
    background: rgba(255,51,51,.15);
    border: 1px solid rgba(255,51,51,.25);
    vertical-align: middle;
    margin: 0 .3rem;
    position: relative;
    overflow: hidden;
}

.mrc-anomaly-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ff8800);
    transition: width .8s ease;
    min-width: 0;
}

.mrc-anomaly-bar::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
    animation: mrc-scan 2.5s linear infinite;
}

/* ── Delta notification ─────────────────────────────────────────────────────── */

.mrc-delta {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: rgba(5, 15, 5, .95);
    border: 1px solid var(--mrc-border);
    padding: .5rem .9rem;
    font-size: .78rem;
    animation: mrc-delta-in .3s ease, mrc-delta-out .4s ease 2.5s forwards;
    z-index: 500;
}

.mrc-delta.credit { border-color: rgba(32,194,14,.5); color: var(--mrc-green); }
.mrc-delta.debit  { border-color: rgba(255,51,51,.4); color: var(--mrc-red);   }
.mrc-delta.ritual { border-color: rgba(192,132,252,.4); color: var(--mrc-espectral); }

/* ── Transfer form ──────────────────────────────────────────────────────────── */

.mrc-section {
    background: var(--mrc-bg-card);
    border: 1px solid var(--mrc-border);
    padding: .9rem 1.1rem;
    margin-bottom: 1rem;
}

.mrc-section-header {
    font-size: .68rem;
    letter-spacing: .1em;
    color: rgba(32,194,14,.5);
    border-bottom: 1px solid var(--mrc-border);
    padding-bottom: .35rem;
    margin-bottom: .75rem;
    text-transform: uppercase;
}

.mrc-form { display: flex; flex-direction: column; gap: .5rem; }

.mrc-input-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.mrc-input {
    background: transparent;
    border: 1px solid rgba(32,194,14,.25);
    color: var(--mrc-green);
    font-family: inherit;
    font-size: .8rem;
    padding: .35rem .55rem;
    outline: none;
    flex: 1;
    min-width: 120px;
    transition: border-color .2s;
}

.mrc-input::placeholder { color: rgba(32,194,14,.3); }
.mrc-input:focus { border-color: rgba(32,194,14,.6); }

.mrc-input[type="number"] { max-width: 100px; }

.mrc-btn {
    background: transparent;
    border: 1px solid rgba(32,194,14,.4);
    color: var(--mrc-green);
    font-family: inherit;
    font-size: .78rem;
    padding: .35rem .9rem;
    cursor: pointer;
    letter-spacing: .06em;
    transition: background .2s, border-color .2s;
}

.mrc-btn:hover { background: rgba(32,194,14,.1); border-color: rgba(32,194,14,.7); }
.mrc-btn:active { background: rgba(32,194,14,.2); }
.mrc-btn:disabled { opacity: .4; cursor: default; }

.mrc-btn-amber {
    border-color: rgba(255,176,0,.4);
    color: var(--mrc-amber);
}
.mrc-btn-amber:hover { background: rgba(255,176,0,.1); border-color: rgba(255,176,0,.7); }

.mrc-btn-danger {
    border-color: rgba(255,51,51,.35);
    color: var(--mrc-red);
}

.mrc-fee-note {
    font-size: .65rem;
    color: rgba(255,176,0,.5);
    margin-top: .2rem;
}

.mrc-msg { font-size: .72rem; margin-top: .3rem; min-height: 1.1rem; }
.mrc-msg.ok  { color: var(--mrc-green); }
.mrc-msg.err { color: var(--mrc-red);   }

/* ── Transaction history ────────────────────────────────────────────────────── */

.mrc-history-list {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    max-height: 260px;
    overflow-y: auto;
}

.mrc-tx {
    display: flex;
    gap: .6rem;
    align-items: baseline;
    font-size: .73rem;
    padding: .15rem 0;
    border-bottom: 1px solid rgba(32,194,14,.06);
    animation: mrc-fadein .3s ease;
}

.mrc-tx-dir {
    font-weight: bold;
    width: 1.2rem;
    text-align: center;
    flex-shrink: 0;
}

.mrc-tx.credit .mrc-tx-dir { color: var(--mrc-green); }
.mrc-tx.debit  .mrc-tx-dir { color: var(--mrc-red); }
.mrc-tx.ritual .mrc-tx-dir { color: var(--mrc-espectral); }

.mrc-tx-amount {
    font-variant-numeric: tabular-nums;
    width: 4ch;
    text-align: right;
    flex-shrink: 0;
    color: inherit;
}

.mrc-tx.credit .mrc-tx-amount { color: var(--mrc-green); }
.mrc-tx.debit  .mrc-tx-amount { color: var(--mrc-red); }

.mrc-tx-reason { color: rgba(32,194,14,.65); flex: 1; }

.mrc-tx-ts {
    color: rgba(32,194,14,.3);
    font-size: .65rem;
    white-space: nowrap;
}

.mrc-tx.corrupted .mrc-tx-reason { color: rgba(255,107,53,.7); }

/* ── Market ─────────────────────────────────────────────────────────────────── */

.mrc-market-filters {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin-bottom: .8rem;
}

.mrc-filter {
    background: transparent;
    border: 1px solid rgba(32,194,14,.2);
    color: rgba(32,194,14,.5);
    font-family: inherit;
    font-size: .65rem;
    padding: .2rem .55rem;
    cursor: pointer;
    letter-spacing: .06em;
    transition: all .15s;
}

.mrc-filter:hover,
.mrc-filter.active {
    border-color: rgba(32,194,14,.6);
    color: var(--mrc-green);
    background: rgba(32,194,14,.08);
}

.mrc-market-grid {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.mrc-item {
    background: rgba(5, 20, 5, .8);
    border: 1px solid rgba(32,194,14,.12);
    padding: .7rem .9rem;
    transition: border-color .2s;
    position: relative;
    animation: mrc-fadein .35s ease both;
}

.mrc-item:hover { border-color: rgba(32,194,14,.3); }
.mrc-item.owned { opacity: .55; }
.mrc-item.unavailable { opacity: .4; pointer-events: none; }

/* Rarity accent bars */
.mrc-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
}

.mrc-item[data-rarity="COMÚN"]      ::before,
.mrc-item[data-rarity="COMÚN"]::before      { background: var(--mrc-comun); }
.mrc-item[data-rarity="RARO"]::before       { background: var(--mrc-raro); }
.mrc-item[data-rarity="CLASIFICADO"]::before { background: var(--mrc-clasificado); }
.mrc-item[data-rarity="ESPECTRAL"]::before  { background: var(--mrc-espectral); }
.mrc-item[data-rarity="ÚNICO"]::before      { background: var(--mrc-unico); }

.mrc-item-top {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    margin-bottom: .3rem;
    flex-wrap: wrap;
}

.mrc-item-rarity {
    font-size: .6rem;
    letter-spacing: .07em;
    padding: .05rem .28rem;
    border-radius: 2px;
    border: 1px solid currentColor;
    flex-shrink: 0;
}

.mrc-item-rarity-COMÚN       { color: var(--mrc-comun);        border-color: rgba(74,222,128,.3); }
.mrc-item-rarity-RARO        { color: var(--mrc-raro);         border-color: rgba(96,165,250,.3); }
.mrc-item-rarity-CLASIFICADO { color: var(--mrc-clasificado);  border-color: rgba(148,163,184,.25); }
.mrc-item-rarity-ESPECTRAL   { color: var(--mrc-espectral);    border-color: rgba(192,132,252,.3); }
.mrc-item-rarity-ÚNICO       { color: var(--mrc-unico);        border-color: rgba(255,215,0,.35);
                                animation: mrc-unico-pulse 3s ease-in-out infinite; }

.mrc-item-name {
    font-size: .8rem;
    color: rgba(32,194,14,.9);
    flex: 1;
}

.mrc-item-price {
    font-size: .78rem;
    color: var(--mrc-amber);
    font-weight: bold;
    white-space: nowrap;
}

.mrc-item-price-corrupt {
    font-size: .68rem;
    color: var(--mrc-corrupt);
    margin-left: .3rem;
}

.mrc-item-lore {
    font-size: .67rem;
    color: rgba(32,194,14,.45);
    line-height: 1.4;
    margin-bottom: .5rem;
    font-style: italic;
}

.mrc-item-bottom {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}

.mrc-item-stock {
    font-size: .62rem;
    color: rgba(255,176,0,.5);
}
.mrc-item-stock.low { color: var(--mrc-red); animation: mrc-blink 2s step-end infinite; }

.mrc-owned-badge {
    font-size: .62rem;
    color: rgba(32,194,14,.45);
    border: 1px solid rgba(32,194,14,.2);
    padding: .05rem .25rem;
    border-radius: 2px;
}

/* ── Content modal (purchased lore) ────────────────────────────────────────── */

.mrc-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.85);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mrc-fadein .2s ease;
}

.mrc-modal {
    background: #050f05;
    border: 1px solid rgba(32,194,14,.3);
    max-width: 600px;
    width: 95%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.2rem;
    position: relative;
}

.mrc-modal-title {
    color: var(--mrc-amber);
    font-size: .85rem;
    letter-spacing: .08em;
    margin-bottom: .6rem;
    border-bottom: 1px solid rgba(32,194,14,.15);
    padding-bottom: .4rem;
}

.mrc-modal-content {
    font-size: .73rem;
    color: rgba(32,194,14,.8);
    white-space: pre-wrap;
    line-height: 1.7;
}

.mrc-modal-close {
    position: absolute;
    top: .6rem; right: .7rem;
    background: transparent;
    border: none;
    color: rgba(32,194,14,.4);
    font-size: .9rem;
    cursor: pointer;
}
.mrc-modal-close:hover { color: var(--mrc-green); }

/* ── Discovery event banner ─────────────────────────────────────────────────── */

.mrc-discovery-banner {
    background: rgba(255,176,0,.06);
    border: 1px solid rgba(255,176,0,.25);
    padding: .6rem .9rem;
    margin-bottom: .7rem;
    font-size: .73rem;
    animation: mrc-fadein .4s ease, mrc-blink-border 2s step-end 3;
    display: none;
}

.mrc-discovery-banner.visible { display: block; }
.mrc-discovery-banner .mrc-disc-title { color: var(--mrc-amber); font-weight: bold; margin-bottom: .2rem; }
.mrc-discovery-banner .mrc-disc-note  { color: rgba(255,176,0,.6); font-size: .67rem; }
.mrc-discovery-banner .mrc-disc-amount { color: var(--mrc-green); font-weight: bold; }

/* ── Anomaly alert ──────────────────────────────────────────────────────────── */

.mrc-anomaly-alert {
    background: rgba(255,51,51,.06);
    border: 1px solid rgba(255,51,51,.3);
    padding: .5rem .9rem;
    margin-bottom: .7rem;
    font-size: .72rem;
    color: var(--mrc-red);
    animation: mrc-fadein .3s ease;
    display: none;
}
.mrc-anomaly-alert.visible { display: block; }

/* ── Keyframes ──────────────────────────────────────────────────────────────── */

@keyframes mrc-fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@keyframes mrc-flicker {
    0%, 94%, 100% { opacity: 1; }
    95%           { opacity: .85; }
    96%           { opacity: .92; }
    97%           { opacity: .78; }
    98%           { opacity: 1; }
}

@keyframes mrc-scan {
    from { left: -100%; }
    to   { left: 200%; }
}

@keyframes mrc-credit-flash {
    0%   { color: var(--mrc-green); text-shadow: 0 0 20px rgba(32,194,14,.4); }
    30%  { color: #ffffff;          text-shadow: 0 0 30px rgba(32,255,32,.8); }
    100% { color: var(--mrc-green); text-shadow: 0 0 20px rgba(32,194,14,.4); }
}

@keyframes mrc-debit-flash {
    0%   { color: var(--mrc-green); }
    30%  { color: var(--mrc-red);   text-shadow: 0 0 20px rgba(255,51,51,.5); }
    100% { color: var(--mrc-green); }
}

@keyframes mrc-delta-in  { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
@keyframes mrc-delta-out { to   { opacity: 0; transform: translateX(10px); } }

@keyframes mrc-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: .3; }
}

@keyframes mrc-blink-border {
    0%, 100% { border-color: rgba(255,176,0,.25); }
    50%      { border-color: rgba(255,176,0,.6); }
}

@keyframes mrc-unico-pulse {
    0%, 100% { border-color: rgba(255,215,0,.35); color: var(--mrc-unico); }
    50%      { border-color: rgba(255,215,0,.7);  color: #ffe55c; }
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .mrc-page { padding: .6rem; font-size: .78rem; }
    .mrc-amount-big { font-size: 1.5rem; }
    .mrc-balance-sub { gap: .8rem; }
    .mrc-input-row { flex-direction: column; }
    .mrc-input[type="number"] { max-width: 100%; }
    .mrc-history-list { max-height: 180px; }
}

/* ── Chat HUD — inline MOROCOTA indicator ────────────────────────────────────
   (These rules apply in the main chat panel, not on cartera.html)           */

.cp-mrc-indicator {
    font-size: .62rem;
    color: rgba(255, 176, 0, .65);
    letter-spacing: .04em;
    cursor: pointer;
    transition: color .2s;
    user-select: none;
    white-space: nowrap;
}

.cp-mrc-indicator:hover { color: var(--mrc-amber, #ffb000); }

.cp-mrc-indicator.mrc-credit-pulse {
    animation: mrc-credit-flash .5s ease;
}
.cp-mrc-indicator.mrc-debit-pulse {
    animation: mrc-debit-flash .5s ease;
}
