@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900');

/* ============================================
   HERO
   ============================================ */
.hero {
    position: relative;
    width: 100%;
    height: 50vh;
    background-image: url('Pokemon\ Trading.jpg');
    background-size: cover;
    background-position: center 30%;
    background-repeat: no-repeat;
    border-bottom: 2px solid #D4AF37;
    flex-shrink: 0;
}

/* ============================================
   PAGE LAYOUT
   ============================================ */
.trade-page-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    flex: 1 0 auto;
    margin-top: 20px;
}

/* ============================================
   LEFT PANEL — Trade Listings
   ============================================ */
.trade-section {
    flex: 1 1 0%;
    min-width: 0;
    padding: 40px;
    background: black;
    border-right: 2px solid #D4AF37;
}

#trade-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    align-content: start;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 6px;
}

#trade-listings-grid::-webkit-scrollbar       { width: 6px; }
#trade-listings-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 4px; }
#trade-listings-grid::-webkit-scrollbar-thumb { background: #D4AF37; border-radius: 4px; }

/* Card grid item */
.trading-row {
    position: relative;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
    cursor: pointer;
}

.trading-row .card-image { width: 100%; margin-top: 8px; }
.trading-row .card-image img { width: 100%; border-radius: 8px; display: block; }
.trading-row .card-info { width: 100%; }

/* Add tile */
.trading-row--add {
    min-height: 200px;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: 2px dashed #D4AF37;
    opacity: 0.7;
    transition: opacity 0.2s;
    background: #1E2329;
}
.trading-row--add:hover { opacity: 1; }
.add-card-icon  { font-size: 32px; color: #ffd700; }
.add-card-label { font-size: 14px; color: #F8F9FA; margin-top: 6px; font-weight: 600; }

/* Remove button */
.remove-listing-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #1E2329;
    border: 2px solid #ff6b6b;
    color: #ff6b6b;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

/* Card info */
.card-info {
    text-align: center;
    flex: 1;
    width: 100%;
}
.card-info h3 {
    margin: 6px 0 2px;
    font-size: 0.85rem;
    color: #D4AF37;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-info .rarity {
    margin: 2px 0 4px;
    font-size: 0.75rem;
    color: #F8F9FA;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-tag {
    font-size: 0.7rem;
    background: #4caf50;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.card-image { width: 100%; }
.card-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* ============================================
   RIGHT PANEL — Chat & Proposal
   ============================================ */
.trade-main-container {
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    background-color: black;
}

.trade-console {
    width: 100%;
    max-width: 750px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    background: black;
}

/* ============================================
   EMAIL-STYLE CHAT PANEL
   ============================================ */
.chat-panel {
    display: flex;
    width: 100%;
    border: 2px solid #D4AF37;
    border-radius: 12px;
    overflow: hidden;
    background: #1E2329;
    min-height: 420px;
    box-shadow: 0 8px 32px #d4af37;
}

/* ---- Conversation Sidebar (left) ---- */
.conversation-sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 2px solid #D4AF37;
    display: flex;
    flex-direction: column;
}

.conversation-sidebar-header {
    padding: 14px 16px;
    border-bottom: 2px solid #D4AF37;
}
.conversation-sidebar-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #d4af37;
    letter-spacing: 1px;
}

.conversation-sidebar-header button {
    background: transparent;
    border: 2px solid #D4AF37;
    color: #F8F9FA;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 5px;
    margin-left: 50px;
}

.conversation-sidebar-header button:hover {
    background: black;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
}
.conversation-list::-webkit-scrollbar       { width: 4px; }
.conversation-list::-webkit-scrollbar-thumb { background: #8B6A18; border-radius: 4px; }

.conv-empty {
    color: #F8F9FA;
    font-size: 14px;
    text-align: center;
    padding: 24px 16px;
    line-height: 1.6;
    margin: 0;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 2px solid #D4AF37;
    transition: background 0.15s;
}
.conversation-item:hover  { background: rgba(255, 215, 0, 0.05); }
.conversation-item.active {
    background: rgba(255, 215, 0, 0.1);
    border-left: 2px solid #d4af37;
}

.conv-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #D4AF37;
}

.conv-info { flex: 1; overflow: hidden; }
.conv-name {
    font-size: 14px;
    font-weight: 600;
    color: #F8F9FA;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conv-preview {
    font-size: 14px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.conv-preview.conv-unread { color: rgba(255,255,255,0.75); font-weight: 600; }

.conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.conv-time { font-size: 10px; color: #F8F9FA; }
.conv-dot  { width: 8px; height: 8px; border-radius: 50%; background: #d4af37; }

/* ---- Chat Window (right) ---- */
.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-window-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #F8F9FA;
    gap: 12px;
    padding: 40px;
}
.chat-empty-icon { font-size: 48px; color: #F8F9FA; }

.chat-window-active {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Chat header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 2px solid #D4AF37;
}
.chat-header h4 { margin: 0; font-size: 0.8rem; color: #d4af37; letter-spacing: 1px; }

.chat-partner { display: flex; align-items: center; gap: 10px; }

.chat-avatar-small {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #D4AF37;
    flex-shrink: 0;
}

/* Message received avatar */
.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #D4AF37;
    flex-shrink: 0;
    align-self: flex-end;
}

/* Message feed */
.message-feed {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 150px;
    max-height: 280px;
}

.message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    margin-bottom: 4px;
}
.message.msg-received { align-items: flex-end; align-self: flex-start; }
.message.msg-sent     { align-self: flex-end; flex-direction: row-reverse; }

.bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.4;
    color: #F8F9FA;
    word-wrap: break-word;
}
.msg-received .bubble {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #D4AF37;
    border-bottom-left-radius: 4px;
}
.msg-sent .bubble {
    background: #6f2da8;
    border: 2px solid #D4AF37;
    border-bottom-right-radius: 4px;
    text-align: right;
}

.timestamp {
    display: block;
    font-size: 10px;
    opacity: 0.5;
    margin-top: 4px;
}

.chat-empty-hint {
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
    font-size: 14px;
    padding: 20px;
    margin: 0;
}

/* Chat input */
.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 2px solid #D4AF37;
}
.chat-input input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #D4AF37;
    padding: 10px 16px;
    border-radius: 50px;
    color: #F8F9FA;
    outline: none;
    font-size: 14px;
}
.chat-input input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}
.chat-input input::placeholder { color: rgba(255,255,255,0.4); }

.send-btn {
    background: #d4af37;
    color: #061428;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    white-space: nowrap;
}
.send-btn:hover  { transform: scale(1.05); }
.send-btn:active { transform: translateY(1px); }

/* ============================================
   PROPOSAL SECTION
   ============================================ */
.glass-panel {
    background-color: #1E2329;
    border: 2px solid #D4AF37;
    border-radius: 20px;
    padding: 35px;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    box-shadow: 0 8px 32px #d4af37;
}

.box-title {
    color: #d4af37;
    font-size: 1.2rem;
    text-transform: uppercase;
    margin-bottom: 12px;
    text-align: left;
}

.trade-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.trade-column      { flex: 1; text-align: center; }
.trade-column h4   { color: #F8F9FA; font-size: 1.25rem; margin-bottom: 10px; }

.drop-zone {
    border: 2px dotted #F8F9FA;
    border-radius: 15px;
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    overflow: hidden;
    position: relative;
    padding: 8px;
    box-sizing: border-box;
}

.trade-icon { color: #D4AF37; font-size: 1.5rem; }

.selected-card-img {
    width: 100%;        
    height: 100%;       
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    position: absolute; 
    top: 0;
    left: 0;
    padding: 8px;       
    box-sizing: border-box;
}

.placeholder-text { color: #F8F9FA; font-size: 0.85rem; text-align: center; }

.proposal-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }

.yellow-btn {
    background-color: #d4af37;
    color: #1E2329;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
}
.yellow-btn:hover { transform: scale(1.05); }

.green-btn { background: #2d7a2d; color: #fff; border: none; padding: 10px 24px; border-radius: 8px; cursor: pointer; font-weight: 700; }
.red-btn   { background: #7a2d2d; color: #fff; border: none; padding: 10px 24px; border-radius: 8px; cursor: pointer; font-weight: 700; }
.grey-btn  { background: #3a3a3a; color: #fff; border: none; padding: 10px 24px; border-radius: 8px; cursor: pointer; font-weight: 700; }

.add-trade-card-btn {
    background: transparent;
    border: 2px dashed #D4AF37;
    color: #D4AF37;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.add-trade-card-btn:hover { border-color: #d4af37; color: #d4af37; }

.remove-card-btn {
    background: rgba(255, 0, 0, 0.15);
    border: 2px solid #ff6b6b;
    color: #ff6b6b;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    transition: background 0.2s;
}
.remove-card-btn:hover {
    background: #ff6b6b;
}

#trade-success-banner button:hover {
    border-color: rgba(255,255,255,0.5);
    color: #F8F9FA;
}

.status-tag.traded,
.status-tag[data-status="traded"] {
    background: #555;
    color: rgba(255,255,255,0.5);
}

.yellow-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   MULTI-CARD TRADE
   Append to trades.css
   ============================================ */

/* ── Trade type toggle ── */
.trade-type-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.trade-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 7px 16px;
    border-radius: 8px;
    border: 2px solid #D4AF37;
    color: #5a4a2a;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.trade-type-btn:hover {
    border-color: #8B6A18;
    color: #b8860b;
}

.trade-type-btn.active {
    border-color: #D4AF37;
    color: #D4AF37;
    background: rgba(255, 215, 0, 0.08);
}

/* ── Multi card zone ── */
.trade-grid--multi .trade-column {
    flex: 1;
}

.multi-zone {
    min-height: 160px;
    max-height: 320px;
    overflow-y: auto;
    border: 2px dotted #F8F9FA;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    background: rgba(0,0,0,0.2);
    transition: border-color 0.2s;
}

.multi-zone::-webkit-scrollbar { width: 4px; }
.multi-zone::-webkit-scrollbar-thumb { background: #3a2a10; border-radius: 99px; }

.multi-zone .placeholder-text {
    width: 100%;
    text-align: center;
    color: #F8F9FA;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 500;
    align-self: center;
    padding: 20px 0;
}

/* ── Individual multi card tile ── */
.multi-card-item {
    position: relative;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.multi-card-img {
    width: 80px;
    aspect-ratio: 0.72;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #D4AF37;
    display: block;
    transition: border-color 0.15s;
}

.multi-card-item:hover .multi-card-img {
    border-color: rgba(255,215,0,0.4);
}

.multi-card-name {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    color: #F8F9FA;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.multi-card-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,50,50,0.8);
    border: none;
    color: #F8F9FA;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.multi-card-item:hover .multi-card-remove {
    opacity: 1;
}

/* ── Card count badge ── */
.multi-card-count {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    color: #D4AF37;
    font-weight: 600;
}

/* ============================================
   STATUS DOT
   ============================================ */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4caf50;
}
.status-dot.offline { background: #888; }

/* ============================================
   TOAST
   ============================================ */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1a1a1a;
    border: 2px solid #D4AF37;
    color: #D4AF37;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
}
.toast-notification.show { opacity: 1; transform: translateY(0); }

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 1024px) {
    .trade-page-layout { flex-direction: column; }
    .hero              { height: 250px; }
    .chat-panel        { flex-direction: column; }
    .conversation-sidebar { width: 100%; border-right: none; border-bottom: 1px solid rgba(255,215,0,0.15); }
    .conversation-list { max-height: 200px; }
}

@media (max-width: 600px) {
    .trade-section,
    .trade-main-container {
        padding: 16px;
    }

    .glass-panel {
        padding: 18px;
    }

    /* Let the offer/receive columns stack instead of squeezing side by side */
    .trade-grid {
        flex-wrap: wrap;
    }

    .trade-column {
        flex: 1 1 100%;
    }

    .drop-zone {
        height: 170px;
    }

    .conversation-sidebar-header button {
        margin-left: 0;
    }

    .trade-console {
        gap: 20px;
    }

    .multi-card-item,
    .multi-card-img {
        width: 64px;
    }
}

/* ============================================
   CUSTOM CURSOR — above modal, clicks pass through
   ============================================ */
#cursor {
    z-index: 10000 !important;
    pointer-events: none !important;
}

/* ============================================
   TRADE AGREED MODAL
   ============================================ */
.trade-agreed-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    padding: 1rem;
    box-sizing: border-box;
}

.trade-agreed-card {
    background: #1E2329;
    border: 2px solid #D4AF37;
    border-radius: 18px;
    padding: 2rem 1.75rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(212, 175, 55, 0.1);
    box-sizing: border-box;
}

.trade-agreed-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}
.trade-agreed-close:hover { color: #F8F9FA; }

.trade-agreed-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.trade-agreed-title {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #D4AF37;
    letter-spacing: 0.07em;
    margin: 0 0 0.6rem;
}

.trade-agreed-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 1.25rem;
}
.trade-agreed-subtitle strong { color: #D4AF37; }

.trade-agreed-info {
    background: rgba(212, 175, 55, 0.07);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin: 0 0 1.25rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: left;
    line-height: 1.5;
}

.trade-agreed-cta {
    display: block;
    background: #D4AF37;
    color: #1E2329;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    margin-bottom: 0.65rem;
    box-shadow: 0 4px 18px rgba(212, 175, 55, 0.3);
    transition: background 0.15s, transform 0.1s;
}
.trade-agreed-cta:hover  { background: #c9a227; }
.trade-agreed-cta:active { transform: scale(0.98); }

.trade-agreed-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.82rem;
    cursor: pointer;
    font-family: 'Rajdhani', sans-serif;
    padding: 0.25rem;
    display: block;
    margin: 0 auto;
    transition: color 0.15s;
}
.trade-agreed-dismiss:hover { color: rgba(255, 255, 255, 0.65); }

@media (max-width: 480px) {
    .trade-agreed-card  { padding: 1.5rem 1.25rem; }
    .trade-agreed-title { font-size: 1.1rem; }
}
