/* ===================================
   Market Page Styles
   =================================== */

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.metric-card {
    padding: 1.25rem;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.3);
}

.metric-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.metric-card-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.metric-card-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-card-icon.orange {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
}

.metric-card-icon.green {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.metric-card-icon.yellow {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

.metric-card-icon.blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.metric-card-icon.cyan {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}

.metric-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
    color: white;
    margin-bottom: 0.25rem;
}

.metric-card-change {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.metric-card-change.positive {
    color: #4ade80;
}

.metric-card-change.negative {
    color: #f87171;
}

.metric-card-chart {
    height: 3rem;
    margin-top: 0.75rem;
}

/* Search Bar Redesigned */
.market-search-section {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.market-search-wrapper {
    position: relative;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.6);
    padding: 0.5rem;
    border: 1px solid rgba(51, 65, 85, 0.5);
    transition: all 0.3s ease;
}

.market-search-wrapper:focus-within {
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1);
    background: rgba(15, 23, 42, 0.8);
}

.search-glow {
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(249, 115, 22, 0);
    transition: box-shadow 0.3s ease;
}

.market-search-wrapper:focus-within .search-glow {
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.15);
}

.search-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 10;
}

.search-icon-box {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249, 115, 22, 0.1);
    border-radius: 0.75rem;
    flex-shrink: 0;
}

.search-input-field {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 0;
    min-width: 0;
}

.search-input-field::placeholder {
    color: var(--color-text-muted);
    font-weight: 400;
}

.search-input-field:focus {
    outline: none;
}

.search-actions {
    display: flex;
    align-items: center;
    padding-right: 0.5rem;
}

.search-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.search-action-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.search-refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.search-refresh-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: white;
}

.market-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

/* Crypto Table */
.crypto-table-container {
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.3);
    overflow: hidden;
}

.crypto-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.crypto-table-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
}

.crypto-table-title i {
    color: var(--color-primary);
}

.crypto-table-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.crypto-table-wrapper {
    overflow-x: auto;
}

.crypto-table {
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
}

.crypto-table thead {
    background: rgba(15, 23, 42, 0.5);
}

.crypto-table th {
    padding: 0.875rem 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    white-space: nowrap;
}

.crypto-table td {
    padding: 1rem;
    color: var(--color-text-secondary);
    border-bottom: 1px solid rgba(51, 65, 85, 0.2);
    white-space: nowrap;
}

.crypto-table tbody tr {
    transition: background 0.2s ease;
}

.crypto-table tbody tr:hover {
    background: rgba(51, 65, 85, 0.2);
}

.crypto-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.crypto-name img {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
}

.crypto-name-text {
    display: flex;
    flex-direction: column;
}

.crypto-name-text strong {
    font-weight: 600;
    color: white;
}

.crypto-name-text span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.crypto-price {
    font-family: 'Space Mono', monospace;
    font-weight: 600;
    color: white;
}

.crypto-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: 'Space Mono', monospace;
    font-weight: 500;
}

.crypto-change.positive {
    color: #4ade80;
}

.crypto-change.negative {
    color: #f87171;
}

.crypto-sparkline {
    width: 100px;
    height: 40px;
}

/* Top Performers */
.performers-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(51, 65, 85, 0.2);
    border-radius: 1rem;
    overflow: hidden;
}

.performers-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.2);
    background: rgba(15, 23, 42, 0.3);
}

.performers-list {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.performer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.performer-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.performer-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.performer-info img {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
}

.performer-name {
    display: flex;
    flex-direction: column;
}

.performer-name strong {
    font-size: 0.875rem;
    color: white;
}

.performer-name span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.performer-stats {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.performer-price {
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Space Mono', monospace;
    color: white;
}

.performer-change {
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'Space Mono', monospace;
}

/* Category Buttons */
.market-categories {
    margin-bottom: 1rem;
}

.market-cat-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.3);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.market-cat-btn:hover {
    background: rgba(51, 65, 85, 0.4);
    color: white;
}

.market-cat-btn.active {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(249, 115, 22, 0.4);
    color: #fb923c;
}

/* Pagination */
.crypto-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(51, 65, 85, 0.3);
    background: rgba(15, 23, 42, 0.5);
}

.pagination-info {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: rgba(51, 65, 85, 0.3);
    border: 1px solid rgba(51, 65, 85, 0.5);
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(51, 65, 85, 0.5);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    padding: 0 0.5rem;
}

/* Chart Tooltip */
.chart-tooltip {
    position: fixed;
    z-index: 9999;
    width: 280px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(249, 115, 22, 0.1);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.chart-tooltip.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.95);
}

.tooltip-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tooltip-header img {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
}

.tooltip-title {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tooltip-title strong {
    font-size: 1rem;
    color: white;
}

.tooltip-title span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.tooltip-price {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    color: white;
}

.tooltip-chart-container {
    height: 120px;
    margin-bottom: 0.75rem;
}

.tooltip-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.5rem;
}

.crypto-name {
    cursor: help;
}