/**
 * CSS Mega Tournament - Torneio 30K dos Campeões
 * v1.0
 */

/* Painel Principal */
.mega-tournament-panel {
    position: fixed;
    top: 70px;
    right: 10px;
    width: 280px;
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #ffd700;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(255, 215, 0, 0.3);
    z-index: 9999;
    font-family: 'Segoe UI', sans-serif;
    overflow: hidden;
}

.mega-tournament-panel.minimized {
    width: 200px;
}

/* Header */
.mt-header {
    background: linear-gradient(90deg, #ffd700 0%, #ffaa00 100%);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mt-icon {
    font-size: 20px;
}

.mt-title {
    font-weight: 700;
    color: #1a1a2e;
    font-size: 14px;
    flex-grow: 1;
}

.mt-timer {
    background: #1a1a2e;
    color: #ffd700;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.mt-minimize-btn {
    background: none;
    border: none;
    color: #1a1a2e;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
}

/* Content */
.mt-content {
    padding: 15px;
}

.mt-balance-section {
    text-align: center;
    margin-bottom: 15px;
}

.mt-balance-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.mt-balance-value {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.mt-profit {
    font-size: 14px;
    font-weight: 600;
}

.mt-profit.positive {
    color: #00e676;
}

.mt-profit.negative {
    color: #ff5252;
}

.mt-position-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #aaa;
    margin-bottom: 10px;
}

.mt-position-section strong {
    color: #ffd700;
}

.mt-stats {
    display: flex;
    gap: 10px;
}

.mt-wins {
    color: #00e676;
    font-weight: 600;
}

.mt-losses {
    color: #ff5252;
    font-weight: 600;
}

.mt-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    margin: 10px 0;
}

/* Trade Section */
.mt-input-row {
    margin-bottom: 10px;
}

.mt-input-group label {
    font-size: 11px;
    color: #888;
    display: block;
    margin-bottom: 5px;
}

.mt-time-buttons {
    display: flex;
    gap: 5px;
}

.mt-time-btn {
    flex: 1;
    padding: 8px;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.mt-time-btn:hover {
    background: #3a3a5a;
}

.mt-time-btn.active {
    background: #ffd700;
    color: #1a1a2e;
    border-color: #ffd700;
    font-weight: 600;
}

.mt-amount-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mt-amount-btn {
    width: 35px;
    height: 35px;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.mt-amount-btn:hover {
    background: #ffd700;
    color: #1a1a2e;
}

#mt-amount {
    flex: 1;
    padding: 8px;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    color: #fff;
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

.mt-payout-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}

.mt-payout-info strong {
    color: #ffd700;
}

/* Trade Buttons */
.mt-trade-buttons {
    display: flex;
    gap: 10px;
}

.mt-trade-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: all 0.2s;
}

.mt-trade-btn.buy {
    background: linear-gradient(145deg, #00e676, #00c853);
    color: #fff;
}

.mt-trade-btn.sell {
    background: linear-gradient(145deg, #ff5252, #d32f2f);
    color: #fff;
}

.mt-trade-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.mt-trade-btn .btn-icon {
    font-size: 20px;
}

.mt-trade-btn .btn-text {
    font-size: 13px;
}

/* Pending Trade */
.mt-pending-trade {
    text-align: center;
    padding: 10px;
}

.mt-entry-box {
    background: #2a2a4a;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
}

.mt-entry-box.buy {
    border-left: 4px solid #00e676;
}

.mt-entry-box.sell {
    border-left: 4px solid #ff5252;
}

.mt-entry-dir {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
}

.mt-entry-asset {
    font-size: 12px;
    color: #888;
}

.mt-entry-price, .mt-entry-amount, .mt-entry-current {
    font-size: 12px;
    color: #aaa;
    margin-top: 3px;
}

.mt-entry-status {
    font-size: 14px;
    font-weight: 600;
    margin-top: 5px;
}

.mt-entry-status.winning {
    color: #00e676;
}

.mt-entry-status.losing {
    color: #ff5252;
}

.mt-pending-countdown {
    font-size: 32px;
    font-weight: 700;
    color: #ffd700;
}

.mt-pending-text {
    font-size: 12px;
    color: #888;
}

/* Actions */
.mt-actions {
    display: flex;
    gap: 8px;
}

.mt-action-btn {
    flex: 1;
    padding: 8px;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.mt-action-btn:hover {
    background: #3a3a5a;
}

.mt-action-btn.leave {
    flex: 0;
    width: 35px;
    color: #ff5252;
}

/* Modals */
.mt-modal-overlay, .mt-winner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s;
}

.mt-modal-overlay.show, .mt-winner-overlay.show {
    opacity: 1;
}

.mt-modal {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #ffd700;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
}

.mt-modal-header {
    background: linear-gradient(90deg, #ffd700 0%, #ffaa00 100%);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mt-modal-header h3 {
    margin: 0;
    color: #1a1a2e;
    font-size: 16px;
}

.mt-modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #1a1a2e;
}

.mt-prizes-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: #2a2a4a;
}

.mt-prize {
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.mt-prize.gold {
    background: linear-gradient(145deg, #ffd700, #ffaa00);
    color: #1a1a2e;
}

.mt-prize.silver {
    background: linear-gradient(145deg, #c0c0c0, #a0a0a0);
    color: #1a1a2e;
}

.mt-prize.bronze {
    background: linear-gradient(145deg, #cd7f32, #b8860b);
    color: #fff;
}

.mt-stats-bar {
    text-align: center;
    padding: 10px;
    color: #888;
    font-size: 13px;
    border-bottom: 1px solid #3a3a5a;
}

.mt-my-position {
    text-align: center;
    padding: 10px;
    background: rgba(255, 215, 0, 0.1);
    color: #ffd700;
    font-size: 13px;
}

.mt-modal-body {
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.mt-rank-header, .mt-history-header {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #3a3a5a;
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

.mt-rank-header span:nth-child(1) { width: 15%; }
.mt-rank-header span:nth-child(2) { width: 35%; }
.mt-rank-header span:nth-child(3) { width: 25%; text-align: right; }
.mt-rank-header span:nth-child(4) { width: 25%; text-align: right; }

.mt-rank-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #2a2a4a;
    align-items: center;
    font-size: 13px;
}

.mt-rank-item.my-row {
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    padding: 10px 5px;
}

.mt-rank-item .rank-pos { width: 15%; font-weight: 700; }
.mt-rank-item .rank-name { width: 35%; color: #fff; }
.mt-rank-item .rank-balance { width: 25%; text-align: right; color: #fff; font-weight: 600; }
.mt-rank-item .rank-profit { width: 25%; text-align: right; }

.rank-profit.profit-positive { color: #00e676; }
.rank-profit.profit-negative { color: #ff5252; }

.mt-modal-footer {
    padding: 15px;
    text-align: center;
    border-top: 1px solid #3a3a5a;
}

.mt-modal-footer button {
    background: linear-gradient(90deg, #ffd700 0%, #ffaa00 100%);
    border: none;
    padding: 12px 40px;
    border-radius: 25px;
    color: #1a1a2e;
    font-weight: 700;
    cursor: pointer;
}

/* Winner Popup */
.mt-winner-modal {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
}

.mt-winner-confetti {
    font-size: 30px;
    margin-bottom: 10px;
}

.mt-winner-medal {
    font-size: 80px;
    margin-bottom: 10px;
}

.mt-winner-modal h2 {
    color: #ffd700;
    font-size: 28px;
    margin: 0;
}

.mt-winner-modal h3 {
    color: #fff;
    font-size: 18px;
    margin: 10px 0;
}

.mt-winner-details {
    margin: 20px 0;
    color: #aaa;
}

.mt-winner-prize {
    font-size: 24px !important;
    color: #00e676 !important;
    margin: 15px 0 !important;
}

.mt-winner-credited {
    color: #00e676;
    font-size: 14px;
}

.mt-winner-btn {
    background: linear-gradient(90deg, #ffd700 0%, #ffaa00 100%);
    border: none;
    padding: 15px 50px;
    border-radius: 25px;
    color: #1a1a2e;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
}

/* Eliminated Popup */
.mt-eliminated-modal {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #ff5252;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
}

.mt-eliminated-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.mt-eliminated-modal h2 {
    color: #ff5252;
    margin: 0 0 10px 0;
}

.mt-rebuy-section {
    margin: 20px 0;
    padding: 20px;
    background: #2a2a4a;
    border-radius: 15px;
}

.mt-rebuy-btn {
    background: linear-gradient(145deg, #00e676, #00c853);
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    margin: 10px 0;
    width: 100%;
}

.mt-rebuy-btn:hover {
    transform: scale(1.02);
}

.mt-rebuy-info {
    color: #00e676;
    font-size: 13px;
    margin-top: 10px;
}

.mt-rebuy-warning {
    color: #ffd700;
    font-size: 12px;
    margin-top: 5px;
}

.mt-eliminated-close {
    background: #3a3a5a;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    color: #888;
    cursor: pointer;
    margin-top: 10px;
}

/* History */
.mt-history-header span:nth-child(1) { width: 15%; }
.mt-history-header span:nth-child(2) { width: 10%; }
.mt-history-header span:nth-child(3) { width: 25%; }
.mt-history-header span:nth-child(4) { width: 20%; text-align: right; }
.mt-history-header span:nth-child(5) { width: 30%; text-align: right; }

.mt-history-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #2a2a4a;
    align-items: center;
    font-size: 12px;
}

.mt-history-item.win { border-left: 3px solid #00e676; padding-left: 5px; }
.mt-history-item.loss { border-left: 3px solid #ff5252; padding-left: 5px; }

.mt-history-time { width: 15%; color: #888; }
.mt-history-dir { width: 10%; }
.mt-history-asset { width: 25%; color: #fff; }
.mt-history-amount { width: 20%; text-align: right; color: #aaa; }
.mt-history-result { width: 30%; text-align: right; font-weight: 600; }

.mt-no-history {
    text-align: center;
    padding: 30px;
    color: #888;
}

/* Notifications */
.mt-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 15px 30px;
    border-radius: 10px;
    font-weight: 600;
    z-index: 999999;
    opacity: 0;
    transition: all 0.3s;
}

.mt-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.mt-notification.success {
    background: linear-gradient(145deg, #00e676, #00c853);
    color: #fff;
}

.mt-notification.error {
    background: linear-gradient(145deg, #ff5252, #d32f2f);
    color: #fff;
}

.mt-notification.info {
    background: linear-gradient(145deg, #ffd700, #ffaa00);
    color: #1a1a2e;
}

/* Responsive */
@media (max-width: 768px) {
    .mega-tournament-panel {
        width: 260px;
        right: 5px;
        top: 60px;
    }
    
    .mega-tournament-panel.minimized {
        width: 180px;
    }
}

/* FIX: Texto dos botões de trade visíveis */
.mt-entry-box .mt-entry-dir {
    color: #fff !important;
}

.mt-entry-box.buy .mt-entry-dir {
    color: #00e676 !important;
}

.mt-entry-box.sell .mt-entry-dir {
    color: #ff5252 !important;
}

/* FIX: Área de pending trade */
.mt-pending-trade .mt-entry-box {
    background: rgba(0, 0, 0, 0.3) !important;
}

.mt-entry-status {
    color: #ffd700 !important;
}

.mt-entry-price strong,
.mt-entry-amount,
.mt-entry-current,
.mt-entry-asset {
    color: #fff !important;
}

/* =====================================================
   MODAIS DE RANKING E HISTÓRICO - FIX
   ===================================================== */

/* Overlay do modal */
.mt-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.85) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
}

/* Modal container */
.mt-modal {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%) !important;
    border: 2px solid #ffd700 !important;
    border-radius: 15px !important;
    width: 90% !important;
    max-width: 500px !important;
    max-height: 80vh !important;
    overflow: hidden !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

/* Modal header */
.mt-modal-header {
    background: linear-gradient(90deg, #ffd700 0%, #ffaa00 100%) !important;
    padding: 15px 20px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.mt-modal-header h3 {
    margin: 0 !important;
    color: #1a1a2e !important;
    font-size: 16px !important;
    font-weight: 700 !important;
}

.mt-modal-close {
    font-size: 24px !important;
    cursor: pointer !important;
    color: #1a1a2e !important;
    line-height: 1 !important;
}

.mt-modal-close:hover {
    color: #ff5252 !important;
}

/* Prizes bar */
.mt-prizes-bar {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 12px !important;
    background: rgba(0, 0, 0, 0.3) !important;
}

.mt-prizes-bar .mt-prize {
    padding: 6px 12px !important;
    border-radius: 20px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

.mt-prizes-bar .mt-prize.gold {
    background: linear-gradient(145deg, #ffd700, #ffaa00) !important;
    color: #1a1a2e !important;
}

.mt-prizes-bar .mt-prize.silver {
    background: linear-gradient(145deg, #c0c0c0, #a0a0a0) !important;
    color: #1a1a2e !important;
}

.mt-prizes-bar .mt-prize.bronze {
    background: linear-gradient(145deg, #cd7f32, #b8860b) !important;
    color: #fff !important;
}

/* Stats bar */
.mt-stats-bar {
    text-align: center !important;
    padding: 10px !important;
    color: #888 !important;
    font-size: 13px !important;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2) !important;
}

/* My position */
.mt-my-position {
    text-align: center !important;
    padding: 10px !important;
    background: rgba(255, 215, 0, 0.1) !important;
    color: #ffd700 !important;
    font-size: 13px !important;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2) !important;
}

/* Modal body */
.mt-modal-body {
    padding: 15px !important;
    max-height: 350px !important;
    overflow-y: auto !important;
}

/* Ranking header */
.mt-rank-header {
    display: flex !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3) !important;
    font-size: 11px !important;
    color: #888 !important;
    text-transform: uppercase !important;
}

.mt-rank-header span:nth-child(1) { width: 15% !important; }
.mt-rank-header span:nth-child(2) { width: 35% !important; }
.mt-rank-header span:nth-child(3) { width: 25% !important; text-align: right !important; }
.mt-rank-header span:nth-child(4) { width: 25% !important; text-align: right !important; }

/* Ranking item */
.mt-rank-item {
    display: flex !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    align-items: center !important;
    font-size: 13px !important;
}

.mt-rank-item.my-row {
    background: rgba(255, 215, 0, 0.15) !important;
    border-radius: 8px !important;
    padding: 10px 5px !important;
    margin: 2px 0 !important;
}

.mt-rank-item .rank-pos { 
    width: 15% !important; 
    font-weight: 700 !important; 
    font-size: 14px !important;
}

.mt-rank-item .rank-name { 
    width: 35% !important; 
    color: #fff !important; 
}

.mt-rank-item .rank-balance { 
    width: 25% !important; 
    text-align: right !important; 
    color: #fff !important; 
    font-weight: 600 !important; 
}

.mt-rank-item .rank-profit { 
    width: 25% !important; 
    text-align: right !important; 
}

.mt-rank-item .rank-profit.profit-positive { color: #00e676 !important; }
.mt-rank-item .rank-profit.profit-negative { color: #ff5252 !important; }

/* History header */
.mt-history-header {
    display: flex !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3) !important;
    font-size: 10px !important;
    color: #888 !important;
    text-transform: uppercase !important;
}

.mt-history-header span:nth-child(1) { width: 15% !important; }
.mt-history-header span:nth-child(2) { width: 10% !important; }
.mt-history-header span:nth-child(3) { width: 25% !important; }
.mt-history-header span:nth-child(4) { width: 20% !important; text-align: right !important; }
.mt-history-header span:nth-child(5) { width: 30% !important; text-align: right !important; }

/* History item */
.mt-history-item {
    display: flex !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    align-items: center !important;
    font-size: 12px !important;
}

.mt-history-item.win { 
    border-left: 3px solid #00e676 !important; 
    padding-left: 8px !important; 
}

.mt-history-item.loss { 
    border-left: 3px solid #ff5252 !important; 
    padding-left: 8px !important; 
}

.mt-history-item.pending { 
    border-left: 3px solid #ffd700 !important; 
    padding-left: 8px !important; 
}

.mt-history-time { width: 15% !important; color: #888 !important; }
.mt-history-dir { width: 10% !important; font-size: 16px !important; }
.mt-history-asset { width: 25% !important; color: #fff !important; }
.mt-history-amount { width: 20% !important; text-align: right !important; color: #aaa !important; }
.mt-history-result { width: 30% !important; text-align: right !important; font-weight: 600 !important; }

.mt-history-item.win .mt-history-result { color: #00e676 !important; }
.mt-history-item.loss .mt-history-result { color: #ff5252 !important; }

.mt-no-history {
    text-align: center !important;
    padding: 40px 20px !important;
    color: #888 !important;
    font-size: 14px !important;
}

/* Modal footer */
.mt-modal-footer {
    padding: 15px !important;
    text-align: center !important;
    border-top: 1px solid rgba(255, 215, 0, 0.2) !important;
}

.mt-modal-footer button {
    background: linear-gradient(90deg, #ffd700 0%, #ffaa00 100%) !important;
    border: none !important;
    padding: 12px 40px !important;
    border-radius: 25px !important;
    color: #1a1a2e !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: transform 0.2s !important;
}

.mt-modal-footer button:hover {
    transform: scale(1.05) !important;
}

/* Scrollbar personalizada */
.mt-modal-body::-webkit-scrollbar {
    width: 6px;
}

.mt-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.mt-modal-body::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 3px;
}

/* FIX: Forçar modal visível */
#mt-ranking-modal.mt-modal-overlay,
#mt-history-modal.mt-modal-overlay {
    opacity: 1 !important;
    display: flex !important;
    visibility: visible !important;
}
