/* Market Overview Page Styles - Table styling for market data pages */

/* Main container for market tables */
.market-container {
    max-width: 1230px;
    margin: 0 auto;
    padding: 20px 15px;
}


/* Table styling to match existing design */
.market-table-wrapper {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 0;
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Prevent horizontal scroll on forecast table */
#crypto-forecast-table {
    table-layout: fixed;
    width: 100%;
}

/* Set column widths for forecast table */
#crypto-forecast-table th:first-child,
#crypto-forecast-table td:first-child {
    width: 25%; /* Name column */
}

#crypto-forecast-table th:nth-child(2),
#crypto-forecast-table td:nth-child(2),
#crypto-forecast-table th:nth-child(3),
#crypto-forecast-table td:nth-child(3),
#crypto-forecast-table th:nth-child(4),
#crypto-forecast-table td:nth-child(4),
#crypto-forecast-table th:nth-child(5),
#crypto-forecast-table td:nth-child(5) {
    width: 12.5%; /* Percentage columns - narrow */
}

#crypto-forecast-table th:last-child,
#crypto-forecast-table td:last-child {
    width: 25%; /* Price Graph column - wide for future image */
}

.market-table-wrapper table {
    margin: 0;
    border: none;
    width: 100%;
    border-collapse: collapse;
}

.market-table-wrapper th {
    background: #0073aa;
    color: #fff;
    font-weight: 600;
    padding: 12px 15px;
    border: none;
    white-space: nowrap;
    text-align: left;
}

/* Allow word break for forecast table headers */
#crypto-forecast-table th {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}

.market-table-wrapper th:first-child {
    border-top-left-radius: 8px;
}

.market-table-wrapper th:last-child {
    border-top-right-radius: 8px;
}

.market-table-wrapper th a {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.market-table-wrapper th a:hover {
    opacity: 0.8;
}

.market-table-wrapper td {
    padding: 12px 15px;
    border-bottom: 1px solid #e1e1e1;
    vertical-align: middle;
}

/* Ensure all table cells are vertically centered */
.market-table-wrapper th,
.market-table-wrapper td {
    vertical-align: middle !important;
}

/* Ensure images in cells are also centered */
.market-table-wrapper td img {
    vertical-align: middle;
    display: inline-block;
}

.market-table-wrapper tbody tr {
    transition: background-color 0.2s ease;
}

.market-table-wrapper tbody tr:hover {
    background: #f9f9f9;
}

.market-table-wrapper tbody tr:last-child td {
    border-bottom: none;
}

/* Asset name column */
.asset-name-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.asset-name-link:hover {
    color: #0073aa;
}

.asset-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

/* Symbol/ticker styling */
.asset-symbol {
    color: #999;
    font-weight: 400;
    text-transform: uppercase;
    font-size: 0.9em;
}

/* Price styling */
.price-cell {
    text-align: right;
    font-weight: 500;
}

/* Change percentage styling */
.change-cell {
    text-align: right;
}

.change-value {
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
}

.change-value.green {
    color: #0da059;
    background: rgba(13, 160, 89, 0.1);
}

.change-value.red {
    color: #ea3323;
    background: rgba(234, 51, 35, 0.1);
}

/* Market cap styling */
.market-cap-cell {
    text-align: right;
}

/* Supply/Coins styling */
.supply-cell {
    text-align: right;
    font-weight: 500;
    color: #666;
}

/* Volume cell styling */
.volume-cell {
    text-align: right;
    font-weight: 500;
}

/* Chart link styling */
.chart-link-cell {
    text-align: center;
}

.chart-link {
    font-size: 12px;
    color: #0073aa;
    text-decoration: none;
    padding: 4px 8px;
    border: 1px solid #0073aa;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-block;
}

.chart-link:hover {
    background: #0073aa;
    color: #fff;
}

.no-chart {
    font-size: 12px;
    color: #999;
}

/* Pagination styling */
.pagination-wrapper {
    text-align: center;
    margin: 30px 0;
}

/* Remove list styles from pagination ul */
.pagination-wrapper ul {
    list-style: none;
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.pagination-wrapper ul li {
    list-style: none;
    list-style-type: none;
    display: inline-block;
}

.pagination {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    list-style: none;
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.pagination li {
    list-style: none;
    list-style-type: none;
}

.pagination a, .pagination span {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    background: #fff;
    border-radius: 4px;
    transition: all 0.2s;
    min-width: 40px;
    text-align: center;
    display: inline-block;
}

.pagination a:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.pagination .current,
.pagination span.current,
.pagination li.active span {
    background: #0073aa;
    color: #fff !important;
    border-color: #0073aa;
    font-weight: 600;
    cursor: default;
}

.pagination .prev, .pagination .next {
    font-weight: 500;
    padding: 8px 16px;
}

.pagination span.dots {
    border: none;
    background: none;
}

/* Info section styling */
.info-section {
    margin-top: 40px;
    padding: 30px;
    background: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
}

.info-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
}

.info-section p {
    color: #666;
    line-height: 1.6;
    margin: 10px 0;
}

/* Responsive */
@media (max-width: 1260px) {
    .market-container,
    .panel-body {
        padding: 20px;
    }
}

@media (max-width: 991px) {
    .market-table-wrapper {
        font-size: 14px;
    }
    
    .market-table-wrapper th, 
    .market-table-wrapper td {
        padding: 10px 12px;
    }
}

@media (max-width: 767px) {
    .market-container {
        padding: 10px;
    }
    
    .market-table-wrapper {
        font-size: 12px;
        border-radius: 0;
        overflow-x: visible;
    }
    
    .market-table-wrapper th, 
    .market-table-wrapper td {
        padding: 8px 4px;
    }
    
    /* Smaller headers for forecast table on mobile */
    #crypto-forecast-table th {
        font-size: 11px;
        padding: 6px 4px;
    }
    
    /* Ensure all forecast table cells are properly aligned */
    #crypto-forecast-table td {
        vertical-align: middle !important;
    }
    
    /* Right-align percentage columns, center only the last column */
    #crypto-forecast-table td:nth-child(2),
    #crypto-forecast-table td:nth-child(3),
    #crypto-forecast-table td:nth-child(4),
    #crypto-forecast-table td:nth-child(5) {
        text-align: right;
    }
    
    #crypto-forecast-table td:last-child {
        text-align: center;
    }
    
    /* Set max-width for forecast table columns on mobile */
    #crypto-forecast-table th,
    #crypto-forecast-table td {
        max-width: 80px;
    }
    
    /* Name column gets more space */
    #crypto-forecast-table th:first-child,
    #crypto-forecast-table td:first-child {
        max-width: 110px;
    }
    
    /* Prevent word-break in name columns */
    .market-table-wrapper td:first-child {
        word-break: normal;
        overflow-wrap: normal;
    }
    
    /* Percentage columns (2nd to 5th) are narrower */
    #crypto-forecast-table th:nth-child(2),
    #crypto-forecast-table td:nth-child(2),
    #crypto-forecast-table th:nth-child(3),
    #crypto-forecast-table td:nth-child(3),
    #crypto-forecast-table th:nth-child(4),
    #crypto-forecast-table td:nth-child(4),
    #crypto-forecast-table th:nth-child(5),
    #crypto-forecast-table td:nth-child(5) {
        max-width: 55px;
        white-space: normal;
        word-break: break-word;
        line-height: 1.2;
    }
    
    /* Last column (Price Graph) gets the most space */
    #crypto-forecast-table th:last-child,
    #crypto-forecast-table td:last-child {
        max-width: 85px;
        text-align: center;
        vertical-align: middle !important;
    }
    
    /* Ensure forecast images are centered */
    #crypto-forecast-table td:last-child img {
        display: block;
        margin: 0 auto;
        max-width: 100%;
        height: auto;
    }
    
    /* Handle asset names on mobile - allow wrapping for market table */
    .market-table-wrapper table:not(#crypto-forecast-table) .asset-name-link {
        white-space: normal;
        flex-wrap: wrap;
        line-height: 1.3;
        gap: 4px;
    }
    
    /* Show full name on mobile */
    .market-table-wrapper table:not(#crypto-forecast-table) .asset-name-link span {
        font-size: 12px;
    }
    
    /* Keep symbol visible but smaller */
    .market-table-wrapper table:not(#crypto-forecast-table) .asset-symbol {
        font-size: 10px;
        color: #666;
    }
    
    /* Make icon smaller */
    .market-table-wrapper table:not(#crypto-forecast-table) .asset-icon {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    /* Only for forecast table - stack vertically */
    #crypto-forecast-table .asset-name-link {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    /* Prevent character-by-character breaking */
    .asset-name-link span,
    .asset-name-link .asset-symbol {
        word-break: keep-all;
        display: inline-block;
    }
    
    #crypto-forecast-table .asset-icon {
        width: 20px;
        height: 20px;
    }
    
    /* Ensure change values fit */
    #crypto-forecast-table .change-value {
        font-size: 11px;
        padding: 1px 3px;
    }
    
    /* Hide volume, market cap and coins columns on mobile for market table only */
    /* Note: column indices increased by 1 due to rating column */
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(6),
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(6),
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(7),
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(7),
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(8),
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(8) {
        display: none;
    }
    
    /* Make all columns fit better on mobile */
    .market-table-wrapper table:not(#crypto-forecast-table) {
        table-layout: fixed;
        width: 100%;
    }
    
    /* Reduce padding and font size */
    .market-table-wrapper table:not(#crypto-forecast-table) td,
    .market-table-wrapper table:not(#crypto-forecast-table) th {
        font-size: 11px;
        padding: 6px 2px;
    }
    
    /* Adjust column widths for mobile - prioritize name readability */
    .market-table-wrapper table:not(#crypto-forecast-table) td:first-child,
    .market-table-wrapper table:not(#crypto-forecast-table) th:first-child {
        width: 40%; /* Name - much wider */
    }
    
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(2),
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(2) {
        width: 8%; /* Rating - smaller */
    }
    
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(3),
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(3) {
        width: 14%; /* Price */
    }
    
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(4),
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(4),
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(5),
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(5) {
        width: 10%; /* 24h%, 7d% - smaller */
    }
    
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(9),
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(9) {
        width: 18%; /* Price Graph - smaller */
    }
    
    /* Make graph images smaller on mobile */
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(9) img {
        max-width: 100%;
        height: auto;
        max-height: 30px;
    }
    
    .page-header__title h1 {
        font-size: 1.5rem;
    }
    
    .info-section {
        padding: 20px;
    }
    
    .pagination a, .pagination span {
        padding: 6px 8px;
        font-size: 14px;
        min-width: 30px;
    }
    
    .pagination .prev, .pagination .next {
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    /* Also hide price graph column on very small screens for market table only */
    /* Note: column index increased by 1 due to rating column */
    .market-table-wrapper table:not(#crypto-forecast-table) th:nth-child(9),
    .market-table-wrapper table:not(#crypto-forecast-table) td:nth-child(9) {
        display: none;
    }
    
    /* Even smaller widths for very small screens */
    #crypto-forecast-table th,
    #crypto-forecast-table td {
        max-width: 60px;
        font-size: 11px;
    }
    
    /* Even smaller headers on very small screens */
    #crypto-forecast-table th {
        font-size: 10px;
        padding: 5px 3px;
    }
    
    /* Name column adjustment */
    #crypto-forecast-table th:first-child,
    #crypto-forecast-table td:first-child {
        max-width: 90px;
    }
    
    /* Percentage columns even narrower on very small screens */
    #crypto-forecast-table th:nth-child(2),
    #crypto-forecast-table td:nth-child(2),
    #crypto-forecast-table th:nth-child(3),
    #crypto-forecast-table td:nth-child(3),
    #crypto-forecast-table th:nth-child(4),
    #crypto-forecast-table td:nth-child(4),
    #crypto-forecast-table th:nth-child(5),
    #crypto-forecast-table td:nth-child(5) {
        max-width: 45px;
    }
    
    /* Price Graph column stays wider for future image */
    #crypto-forecast-table th:last-child,
    #crypto-forecast-table td:last-child {
        max-width: 70px;
    }
    
    .asset-icon {
        width: 20px;
        height: 20px;
    }
}

/* Rating column styling */
.rating-cell {
    text-align: center;
}

.rating {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875em;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Rating color scheme */
.rating-aplus {
    background: #0f7938;
    color: #fff;
}

.rating-a {
    background: #14a350;
    color: #fff;
}

.rating-bplus {
    background: #4caf50;
    color: #fff;
}

.rating-b {
    background: #8bc34a;
    color: #fff;
}

.rating-c {
    background: #ffeb3b;
    color: #333;
}

.rating-d {
    background: #ff9800;
    color: #fff;
}

.rating-dminus {
    background: #ff5722;
    color: #fff;
}

.rating-e {
    background: #f44336;
    color: #fff;
}

.rating-eminus {
    background: #b71c1c;
    color: #fff;
}

.rating-none {
    background: #e0e0e0;
    color: #999;
}

/* Rating links - keep white in all states */
.rating-cell a.rating {
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    color: white !important;
}

.rating-cell a.rating:link,
.rating-cell a.rating:visited,
.rating-cell a.rating:hover,
.rating-cell a.rating:active {
    color: white !important;
}

.rating-cell a.rating:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Loading state */
.loading-message {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.125rem;
}

/* Error state */
.error-message {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    color: #c00;
    text-align: center;
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-weight-500 { font-weight: 500; }
.font-weight-600 { font-weight: 600; }
.text-muted { color: #999; }

/* Filter row styling */
.filter-row {
    background-color: #f9f9f9;
}

.filter-row th {
    background: #f5f5f5 !important;
    border-top: 1px solid #e1e1e1;
    border-radius: 0 !important;
    font-weight: normal !important;
    padding: 8px 15px !important;
}

.filter-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
}

.filter-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Remove rounded corners from main header when filter row is present */
.market-table-wrapper thead tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

.market-table-wrapper thead tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

.market-table-wrapper thead tr.filter-row th:first-child,
.market-table-wrapper thead tr.filter-row th:last-child {
    border-radius: 0 !important;
}

/* Additional table cell styling */
.market-table-wrapper a {
    color: #0073aa;
    text-decoration: none;
}

.market-table-wrapper a:hover {
    text-decoration: underline;
}

/* Button styling */
.btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: normal;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 3px;
}

.btn-primary {
    color: #fff;
    background-color: #0073aa;
    border-color: #0073aa;
}

.btn-primary:hover {
    color: #fff;
    background-color: #005177;
    border-color: #004766;
    text-decoration: none;
}

/* Pairs showing info */
.pairs-showing-info {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

/* No results styling */
.no-exchanges,
.no-pairs {
    text-align: center;
    padding: 40px 20px;
    background: #f5f5f5;
    border-radius: 8px;
}

.no-exchanges p,
.no-pairs p {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 16px;
}

.no-exchanges p:last-child,
.no-pairs p:last-child {
    margin-bottom: 0;
}