/* Market template */
.market-page {
    padding-bottom: 40px;
}

.markets-hero,
.markets-cards,
.markets-table,
.advanced-chart,
.market-widgets {
    padding: 56px 0;
}

.markets-title {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 0 0 10px;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    color: var(--text-primary);
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(42, 157, 143, 0.14);
    color: var(--jungle-green);
    font-size: 0.9rem;
    font-weight: 700;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.16);
}

.markets-subtitle {
    max-width: 720px;
    margin-bottom: 28px;
}

.live-stats-grid,
.cards-grid,
.widgets-grid {
    display: grid;
    gap: 20px;
}

.live-stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 28px;
}

.stat-card,
.market-card,
.widget,
.table-wrapper,
.chart-container,
.advanced-chart-container {
    border-radius: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.stat-card,
.market-card,
.widget {
    padding: 22px;
}

.stat-card,
.card-header,
.widget-header,
.gainer-item,
.loser-item,
.coin-cell-compact,
.table-toolbar,
.table-footer,
.pagination,
.search-box,
.chart-tabs,
.time-filter,
.chart-header,
.chart-controls,
.gainer-info,
.loser-info {
    display: flex;
    align-items: center;
}

.stat-card,
.table-toolbar,
.table-footer,
.chart-header {
    justify-content: space-between;
}

.stat-card,
.card-header,
.widget-header,
.gainer-item,
.loser-item,
.coin-cell-compact,
.search-box,
.chart-tabs,
.time-filter,
.pagination,
.chart-controls,
.gainer-info,
.loser-info {
    gap: 14px;
}

.stat-icon,
.coin-icon,
.coin-icon-small,
.action-btn,
.refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stat-icon,
.coin-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--jungle-green), var(--tropical-turquoise));
    color: #fff;
}

.stat-label,
.coin-symbol,
.coin-symbol-table,
.text-small,
.text-muted,
.results-info {
    color: var(--text-secondary);
}

.stat-label,
.coin-symbol,
.coin-symbol-table,
.text-small {
    font-size: 0.9rem;
}

.stat-value,
.card-price,
.fear-greed-value,
.font-bold {
    font-weight: 700;
}

.stat-value,
.card-price,
.fear-greed-value {
    font-size: 1.45rem;
    color: var(--text-primary);
}

.chart-tabs,
.time-filter {
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.chart-tab,
.time-btn,
.page-btn,
.action-btn,
.refresh-btn,
.sort-select,
.interval-select {
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
}

.chart-tab,
.time-btn,
.page-btn,
.action-btn,
.refresh-btn {
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
}

.chart-tab.active,
.time-btn.active {
    background: linear-gradient(135deg, var(--jungle-green), var(--tropical-turquoise));
    color: #fff;
    border-color: transparent;
}

.chart-container,
.advanced-chart-container {
    min-height: 480px;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.market-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.market-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.14);
}

.coin-icon {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
    font-weight: 700;
}

.card-header {
    margin-bottom: 18px;
}

.card-price {
    margin-bottom: 8px;
}

.change-positive,
.text-success,
.gainer-change {
    color: #22c55e;
}

.change-negative,
.text-danger,
.loser-change {
    color: #ef4444;
}

.search-box,
.sort-select,
.interval-select {
    padding: 12px 16px;
    border-radius: 14px;
}

.search-box {
    min-width: 280px;
}

.search-box input,
.sort-select,
.interval-select {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
}

.table-wrapper {
    overflow-x: auto;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
}

.market-table th,
.market-table td {
    padding: 18px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.market-table th {
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.coin-cell-compact {
    gap: 12px;
}

.coin-icon-small {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
}

.coin-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.action-btn,
.refresh-btn {
    width: 40px;
    height: 40px;
}

.page-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.advanced-chart-container {
    padding: 10px;
}

.widgets-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.widget-header {
    justify-content: space-between;
    margin-bottom: 18px;
}

.widget-content {
    display: grid;
    gap: 16px;
}

.fear-greed-value {
    text-align: center;
}

.meter {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e);
}

.meter-indicator {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--forest-dark);
    transform: translate(-50%, -50%);
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.gainers-list,
.losers-list {
    display: grid;
    gap: 12px;
}

.gainer-item,
.loser-item {
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.gainer-item:last-child,
.loser-item:last-child {
    border-bottom: 0;
}

.notification {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    min-width: 220px;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--forest-dark);
    color: #fff;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    background: #166534;
}

.notification.error {
    background: #991b1b;
}

.notification.info {
    background: var(--canopy-dark);
}

@media (max-width: 1024px) {
    .live-stats-grid,
    .cards-grid,
    .widgets-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .markets-hero,
    .markets-cards,
    .markets-table,
    .advanced-chart,
    .market-widgets {
        padding: 40px 0;
    }

    .live-stats-grid,
    .cards-grid,
    .widgets-grid {
        grid-template-columns: 1fr;
    }

    .search-box,
    .sort-select,
    .interval-select {
        width: 100%;
    }

    .table-toolbar,
    .table-footer,
    .section-header,
    .chart-header {
        flex-direction: column;
        align-items: stretch;
    }

    .chart-container,
    .advanced-chart-container {
        min-height: 360px;
    }
}
