/* Markets Page - Enhanced Redesign */

/* Header and Search Section */
.markets-header {
    padding: 20px;
    background: #0f172a;
    border-bottom: 2px solid #1e293b;
}

.search-filter-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 1400px;
    margin: 0 auto;
}

.token-search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid #334155;
    background: #1e293b;
    color: #fff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.token-search-input:focus {
    outline: none;
    border-color: #facc15;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.filter-btn:hover {
    background: #334155;
    color: #fff;
}

.filter-btn.active {
    background: #facc15;
    color: #0f172a;
    border-color: #facc15;
}

.view-toggle {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.view-btn {
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #1e293b;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn:hover {
    background: #334155;
    color: #fff;
}

.view-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* Live Ticker */
.live-ticker-container {
    background: #1e293b;
    padding: 15px 20px;
    overflow: hidden;
    border-bottom: 1px solid #334155;
}

.live-ticker {
    display: flex;
    gap: 30px;
    animation: ticker-scroll 30s linear infinite;
    white-space: nowrap;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #fff;
}

.ticker-symbol {
    font-weight: 600;
    color: #facc15;
}

.ticker-price {
    color: #e2e8f0;
}

.ticker-change {
    font-weight: 600;
}

.ticker-change.up {
    color: #22c55e;
}

.ticker-change.down {
    color: #ef4444;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* Market Movers Section */
.market-movers-section {
    margin: 20px;
    padding: 20px;
    background: #1e293b;
    border-radius: 12px;
}

.section-header {
    font-size: 24px;
    font-weight: bold;
    color: #facc15;
    margin-bottom: 15px;
}

.movers-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #334155;
}

.movers-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.movers-tab:hover {
    color: #fff;
}

.movers-tab.active {
    color: #facc15;
    border-bottom-color: #facc15;
}

.movers-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.mover-card {
    background: #334155;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mover-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.mover-rank {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #1e293b;
    color: #facc15;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.mover-symbol {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
    padding-left: 32px;
}

.mover-price {
    font-size: 14px;
    color: #e2e8f0;
    margin-bottom: 5px;
}

.mover-change {
    font-size: 16px;
    font-weight: 600;
}

.mover-change.up {
    color: #22c55e;
}

.mover-change.down {
    color: #ef4444;
}

/* Watchlist */
.watchlist-container {
    margin: 20px;
    padding: 20px;
    background: #1e293b;
    border-radius: 12px;
}

.watchlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.watchlist-header span {
    font-size: 20px;
    font-weight: bold;
    color: #facc15;
}

.portfolio-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid #3b82f6;
    background: #3b82f6;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.portfolio-btn:hover {
    background: #2563eb;
}

.watchlist-tokens {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.watchlist-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 16px;
}

.watchlist-card {
    background: #334155;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.watchlist-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.watchlist-card .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s;
}

.watchlist-card .remove-btn:hover {
    transform: scale(1.2);
}

.watchlist-symbol {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.watchlist-price {
    font-size: 14px;
    color: #e2e8f0;
    margin-bottom: 5px;
}

.watchlist-change {
    font-size: 14px;
    font-weight: 600;
}

.watchlist-change.up {
    color: #22c55e;
}

.watchlist-change.down {
    color: #ef4444;
}

.watchlist-sparkline {
    height: 30px;
    margin-top: 10px;
}

/* Portfolio Panel */
.portfolio-panel {
    margin-top: 20px;
    padding: 20px;
    background: #0f172a;
    border-radius: 8px;
}

.portfolio-panel h3 {
    color: #facc15;
    margin-bottom: 15px;
}

.portfolio-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.portfolio-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    color: #94a3b8;
    font-size: 14px;
}

.stat-value {
    color: #fff;
    font-size: 20px;
    font-weight: 600;
}

.portfolio-holdings {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.holding-item {
    background: #1e293b;
    padding: 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.holding-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.holding-symbol {
    font-weight: 600;
    color: #fff;
}

.holding-amount {
    color: #94a3b8;
    font-size: 14px;
}

.holding-value {
    text-align: right;
}

.holding-price {
    color: #e2e8f0;
    font-size: 14px;
}

.holding-pnl {
    font-weight: 600;
    font-size: 16px;
}

.holding-pnl.up {
    color: #22c55e;
}

.holding-pnl.down {
    color: #ef4444;
}

/* Sort Container */
.sort-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px;
    padding: 15px;
    background: #1e293b;
    border-radius: 8px;
}

.sort-container label {
    color: #94a3b8;
    font-weight: 500;
}

.sort-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #fff;
    cursor: pointer;
}

.sort-order-btn {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sort-order-btn:hover {
    background: #334155;
}

.sort-order-btn[data-order="asc"] i {
    transform: rotate(180deg);
}

/* Market Overview Section */
.market-overview-section {
    margin: 20px;
}

/* Grid View */
.tokens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.token-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
}

.token-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

.token-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.token-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.token-symbol {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.token-name {
    font-size: 14px;
    color: #94a3b8;
}

.token-actions-mini {
    display: flex;
    gap: 8px;
}

.action-icon-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.action-icon-btn:hover {
    color: #facc15;
    transform: scale(1.1);
}

.action-icon-btn.active {
    color: #facc15;
}

.token-price-section {
    margin-bottom: 15px;
}

.token-price {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.token-change {
    font-size: 14px;
    font-weight: 600;
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
}

.token-change.up {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.token-change.down {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.token-sparkline {
    height: 60px;
    margin-bottom: 15px;
}

.token-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #334155;
}

.token-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.token-stat-label {
    font-size: 12px;
    color: #94a3b8;
}

.token-stat-value {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
}

/* List View */
.tokens-list {
    background: #1e293b;
    border-radius: 12px;
    overflow: hidden;
}

.tokens-table {
    width: 100%;
    border-collapse: collapse;
}

.tokens-table thead {
    background: #0f172a;
}

.tokens-table th {
    padding: 15px;
    text-align: left;
    color: #94a3b8;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid #334155;
}

.tokens-table tbody tr {
    border-bottom: 1px solid #334155;
    transition: background 0.2s ease;
    cursor: pointer;
}

.tokens-table tbody tr:hover {
    background: #334155;
}

.tokens-table td {
    padding: 15px;
    color: #fff;
}

.table-token-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-token-symbol {
    font-weight: 600;
}

.table-token-name {
    color: #94a3b8;
    font-size: 12px;
}

.table-sparkline {
    width: 100px;
    height: 40px;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-action-btn {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.table-action-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: #1e293b;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-large {
    max-width: 900px;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #ef4444;
}

.modal-content h3 {
    color: #facc15;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: #94a3b8;
    margin-bottom: 5px;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #fff;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: none;
    background: #3b82f6;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: #2563eb;
}

.active-alerts {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #334155;
}

.active-alerts h4 {
    color: #94a3b8;
    margin-bottom: 15px;
}

.alert-item {
    background: #0f172a;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-info {
    color: #e2e8f0;
}

.delete-alert-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 18px;
}

/* Token Detail Modal */
.token-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #334155;
}

.token-detail-info h2 {
    color: #fff;
    margin-bottom: 5px;
}

.token-detail-price {
    text-align: right;
}

.detail-price {
    display: block;
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.detail-change {
    font-size: 18px;
    font-weight: 600;
}

.detail-change.up {
    color: #22c55e;
}

.detail-change.down {
    color: #ef4444;
}

.token-detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: #0f172a;
    padding: 15px;
    border-radius: 8px;
}

.stat-item .stat-label {
    display: block;
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-item .stat-value {
    display: block;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.token-detail-chart {
    margin-bottom: 20px;
}

.chart-timeframes {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.timeframe-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeframe-btn:hover {
    background: #334155;
    color: #fff;
}

.timeframe-btn.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.token-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.action-btn {
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.buy-btn {
    background: #22c55e;
    color: #fff;
}

.buy-btn:hover {
    background: #16a34a;
}

.sell-btn {
    background: #ef4444;
    color: #fff;
}

.sell-btn:hover {
    background: #dc2626;
}

.alert-btn {
    background: #f59e0b;
    color: #fff;
}

.alert-btn:hover {
    background: #d97706;
}

.watchlist-btn {
    background: #3b82f6;
    color: #fff;
}

.watchlist-btn:hover {
    background: #2563eb;
}

/* Loading and Error States */
.loading-indicator {
    text-align: center;
    color: #facc15;
    padding: 40px;
    font-style: italic;
}

.error-indicator {
    text-align: center;
    color: #ef4444;
    padding: 40px;
    font-weight: 600;
}

/* Light Theme Adjustments */
body.light-theme .markets-header,
body.light-theme .live-ticker-container,
body.light-theme .market-movers-section,
body.light-theme .watchlist-container,
body.light-theme .sort-container,
body.light-theme .tokens-list {
    background: #e2e8f0;
    color: #1e293b;
}

body.light-theme .token-card,
body.light-theme .mover-card,
body.light-theme .watchlist-card {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.light-theme .modal-content {
    background: #fff;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-filter-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .token-search-input {
        min-width: 100%;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .view-toggle {
        margin-left: 0;
        justify-content: center;
    }
    
    .tokens-grid {
        grid-template-columns: 1fr;
    }
    
    .movers-content {
        grid-template-columns: 1fr;
    }
    
    .watchlist-tokens {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .token-detail-stats {
        grid-template-columns: 1fr;
    }
    
    .token-actions {
        grid-template-columns: 1fr;
    }
    
    .tokens-table {
        font-size: 12px;
    }
    
    .tokens-table th,
    .tokens-table td {
        padding: 10px 5px;
    }
}
