/* Market Page Styles */
:root {
    --primary-color: #00CED1;
    --secondary-color: #40E0D0;
    --accent-color: #00BCD4;
    --background-color: #ffffff;
    --card-color: #ffffff;
    --text-color: #2d3436;
    --text-secondary: #636e72;
    --success-color: #00b894;
    --error-color: #d63031;
    --shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* New Leverage Options Styling */
.leverage-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 56px;
    background: #f8f9f9;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.leverage-loading.hidden {
    display: none;
}

.leverage-loading .loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(87, 253, 178, 0.2);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.leverage-options {
    display: none; /* Hidden by default until database loads */
    gap: 16px;
    height: 56px;
    align-items: stretch;
}

.leverage-options.loaded {
    display: flex; /* Show after database loads */
}

.leverage-option {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
    border-radius: 10px;
    border: 1.5px solid #eee;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: border 0.2s, background 0.2s;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
}

.leverage-option:hover {
    border-color: var(--primary-color);
    background-color: rgba(253, 200, 87, 0.1);
}

.leverage-option.selected {
    background: #e0f7fa;
    border: 1.5px solid #00CED1;
}

.leverage-value {
    font-weight: bold;
    font-size: 1.1rem;
}

.leverage-time {
    font-size: 0.95rem;
    color: #888;
    font-weight: 400;
}

@media (max-width: 700px) {
    .trade-inputs {
        flex-direction: column;
        gap: 12px;
    }
    .leverage-options {
        flex-direction: row;
        gap: 8px;
    }
    .leverage-loading {
        height: 48px;
        font-size: 0.85rem;
    }
    .input-group input[type="number"] {
        height: 48px;
        font-size: 1rem;
    }
    #trade-amount {
        height: 40px;
        font-size: 1rem;
    }
    #currency-select {
        width: 100%;
    }
    label{
        margin-left: 5px;
        margin-bottom: 5px;
    }
    .leverage-option {
        font-size: 1rem;
        height: 48px;
    }
}

/* Existing CSS continues below */
.market-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px; /* Reduced padding for mobile */
    font-family: 'Poppins', sans-serif;
    /* animation: fadeIn 0.5s ease-out; */ /* REMOVE animation on load */
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Market Header - IMPROVED FOR MOBILE */
.market-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px; /* Further reduced padding for mobile */
    margin-bottom: 15px;
    background-color: var(--primary-color);
    border-radius: 10px; /* Reduced border radius for mobile */
    box-shadow: var(--shadow);
    /* animation: slideInDown 0.5s ease-out; */ /* REMOVE animation on load */
    flex-wrap: wrap; /* Allow wrap on very small screens */
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.market-title h1 {
    color: #333;
    font-size: 1.2rem; /* Smaller for mobile */
    margin: 0;
    font-weight: 700;
    white-space: nowrap; /* Prevent awkward wrapping */
}

.market-title h1 span {
    color: var(--accent-color);
    font-weight: 600;
}

.market-controls {
    display: flex;
    gap: 8px; /* Further reduced gap for tighter spacing */
    align-items: center;
    height: 42px; /* Fixed height for better alignment */
}

/* Improved dropdown for mobile */
.market-filter select {
    background-color: white;
    border: none;
    border-radius: 50px;
    padding: 8px 10px; /* Adjusted padding */
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    min-width: 60px; /* Reduced but still touch-friendly */
    min-height: 36px; /* Touch-friendly height */
    -webkit-appearance: none; /* Remove default styling */
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center; /* Position the arrow */
    padding-right: 30px; /* Space for the arrow */
}

.market-filter select:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px); /* Reduced movement on mobile */
}

/* Improved toggle buttons for mobile */
.market-view-toggle {
    display: flex;
    background: white;
    border-radius: 50px;
    padding: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    height: 36px; /* Fixed height for better mobile appearance */
    align-items: center;
}

.market-view-toggle button {
    border: none;
    background: transparent;
    border-radius: 50%;
    width: 30px; /* Optimized size - not too small */
    height: 30px;
    margin: 0 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
    cursor: pointer;
    min-width: 30px; /* Matched to width */
    min-height: 30px; /* Matched to height */
    padding: 0; /* Remove any padding */
}

.market-view-toggle button.active {
    background-color: var(--primary-color);
    color: #333;
}

.market-view-toggle button i {
    font-size: 16px; /* Appropriate icon size for mobile */
}

/* Market Overview Panel */
.market-overview-panel {
    background-color: white;
    border-radius: 15px;
    padding: 15px; /* Reduced padding */
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    /* animation: slideInLeft 0.6s ease-out; */ /* REMOVE animation on load */
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.asset-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    position: relative;
}

.asset-icon {
    width: 40px; /* Smaller for mobile */
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    background-color: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.asset-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.asset-details h2 {
    font-size: 1.2rem; /* Smaller for mobile */
    font-weight: 700;
    margin: 0 0 5px 0;
    color: var(--text-color);
}

.asset-details h2 span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 6px;
    font-weight: 500;
}

.price-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-price {
    font-size: 1.3rem; /* Adjusted for mobile */
    font-weight: 700;
    color: var(--text-color);
}

.price-change {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    background-color: rgba(0, 184, 148, 0.1);
    color: var(--success-color);
}

.price-change.down {
    background-color: rgba(214, 48, 49, 0.1);
    color: var(--error-color);
}

.market-stats-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px; /* Reduced gap */
}

.market-stat {
    flex: 1;
    background-color: #f9f9f9;
    padding: 10px 12px; /* Smaller padding */
    border-radius: 10px;
    min-width: 120px; /* Adjusted for mobile */
    transition: var(--transition);
}

.market-stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    background-color: #fff;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem; /* Smaller for mobile */
    margin-bottom: 3px;
}

.stat-value {
    font-size: 1rem; /* Smaller for mobile */
    font-weight: 600;
    color: var(--text-color);
}

/* Chart and Orderbook Container */
.market-content {
    background-color: white;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    /* animation: slideInRight 0.7s ease-out; */ /* REMOVE animation on load */
    min-height: 300px; /* Reduced height for mobile */
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px; /* Reduced height */
    padding: 15px; /* Reduced padding */
}

.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 10;
}

.loading-spinner {
    width: 30px; /* Smaller for mobile */
    height: 30px;
    border: 3px solid rgba(253, 200, 87, 0.2);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
    margin-right: 10px;
}
#data-loading-indicator {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    background-color: rgba(253, 200, 87, 0.5); /* Added transparency */
    border-radius: 12px; /* Added rounded corners */
    padding: 15px; /* Added padding */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Optional: adds a subtle shadow */
}


@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.orderbook-container {
    width: 100%;
    height: 300px; /* Reduced height */
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.orderbook-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background-color: #f5f5f5;
    padding: 8px 10px; /* Reduced padding */
    font-size: 0.8rem; /* Smaller font */
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid #eee;
}

.orderbook-body {
    flex: 1;
    overflow: auto;
    position: relative;
}

.asks, .bids {
    max-height: 130px; /* Reduced height for mobile */
    overflow: auto;
}

.ask-row, .bid-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 6px 10px; /* Reduced padding */
    font-size: 0.85rem; /* Smaller font */
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s;
    cursor: pointer;
}

.ask-row:hover, .bid-row:hover {
    background-color: #f9f9f9;
}

.ask-row {
    color: var(--error-color);
}

.bid-row {
    color: var(--success-color);
}

.ask-row div:last-child, .bid-row div:last-child {
    text-align: right;
}

.ask-row div:nth-child(2), .bid-row div:nth-child(2) {
    text-align: center;
    color: var(--text-secondary);
}

.current-price-bar {
    padding: 8px; /* Reduced padding */
    background-color: #f8f8f8;
    text-align: center;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.current-price-bar .current-price {
    font-size: 1rem; /* Smaller for mobile */
    font-weight: 600;
}

/* Trading Panel */
.trading-panel {
    background-color: white;
    border-radius: 15px;
    padding: 15px; /* Reduced padding */
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    /* animation: slideInUp 0.8s ease-out; */ /* REMOVE animation on load */
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.trading-panel h3 {
    font-size: 1.1rem; /* Smaller for mobile */
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.trade-inputs {
    display: flex;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 18px;
}
.input-group {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
}
.input-group input[type="number"] {
    height: 56px;
    font-size: 1.2rem;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}

.potential-profit {
    margin-bottom: 15px;
    padding: 10px 12px; /* Reduced padding */
    background-color: #f9f9f9;
    border-radius: 8px;
}

.current-balance {
    margin-bottom: 12px;
    padding: 10px 12px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.bitcoin-price-display {
    margin-bottom: 12px;
    padding: 10px 12px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #f3ba2f;
}

.price-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-details span:first-child {
    font-size: 0.8rem; /* Smaller for mobile */
    color: var(--text-secondary);
}

.price-details span:last-child {
    font-size: 1rem; /* Smaller for mobile */
    font-weight: 600;
    color: var(--text-color);
}

.balance-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-details span:first-child {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.balance-note {
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-top: 6px;
    line-height: 1.3;
}

.balance-details span:last-child {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.profit-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profit-details span:first-child {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.profit-details span:last-child {
    font-size: 1rem;
    font-weight: 600;
    color: var(--success-color);
}

.trading-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px; /* Reduced gap */
}

.buy-button, .sell-button {
    padding: 10px; /* Reduced padding */
    border: none;
    border-radius: 8px;
    font-size: 0.9rem; /* Smaller font */
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transform-origin: center;
    min-height: 44px; /* Touch-friendly height */
}

.buy-button {
    background-color: var(--success-color);
    color: white;
}

.sell-button {
    background-color: var(--error-color);
    color: white;
}

.buy-button:hover, .sell-button:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 7px 15px rgba(0, 0, 0, 0.1);
}

.buy-button:active, .sell-button:active {
    transform: translateY(2px);
}

.buy-button i, .sell-button i {
    font-size: 1.1rem; /* Slightly smaller */
}

/* Button Loader Animation */
.button-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

.buy-button.loading, .sell-button.loading {
    position: relative;
    cursor: wait;
}

.buy-button.loading i, .sell-button.loading i {
    opacity: 0;
}

.buy-button.loading .button-text, .sell-button.loading .button-text {
    display: none;
}

.buy-button .button-text, .sell-button .button-text {
    display: inline;
}

.buy-button .loading-container, .sell-button .loading-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    justify-content: center;
}

.buy-button.loading:hover, .sell-button.loading:hover {
    transform: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.buy-button.loading:active, .sell-button.loading:active {
    transform: none;
}

/* Last Updated Time */
.last-update {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem; /* Smaller for mobile */
    font-style: italic;
}

/* Animations for Data Updates */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes highlight {
    0% { background-color: rgba(253, 200, 87, 0.4); }
    100% { background-color: transparent; }
}

.price-pulse {
    animation: pulse 0.5s ease-out;
}

.data-highlight {
    animation: highlight 1s ease-out;
}

/* Star Icon Styling */
.favorite-star {
    position: absolute;
    top: 0;
    right: 0;
    color: #00CED1;
    font-size: 1.3rem; /* Smaller for mobile */
    cursor: pointer;
    transition: transform 0.3s, color 0.3s;
    min-width: 40px; /* Touch-friendly area */
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-star:hover {
    transform: scale(1.1);
    color: #40E0D0;
}

.favorite-star.active {
    color: #00CED1;
}

/* Trade Error Container */
.trade-error-container {
    margin-bottom: 12px;
    padding: 8px 12px; /* Reduced padding */
    background-color: rgba(214, 48, 49, 0.1);
    border-left: 4px solid var(--error-color);
    border-radius: 8px;
    color: var(--error-color);
    font-size: 0.85rem; /* Smaller for mobile */
    font-weight: 500;
}

.trade-error-container p {
    margin: 0;
}

/* Success Popup */
.success-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px 25px; /* Reduced padding */
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 95%; /* Wider for mobile */
    width: 320px; /* Smaller max width */
    text-align: center;
    animation: fadeInPopup 0.3s ease-out forwards;
}

@keyframes fadeInPopup {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.success-popup .success-icon {
    font-size: 2.5rem; /* Smaller for mobile */
    color: var(--success-color);
    margin-bottom: 12px;
}

.success-popup h3 {
    font-size: 1.2rem; /* Smaller for mobile */
    margin: 0 0 8px 0;
    color: var(--text-color);
}

.success-popup p {
    margin: 0 0 12px 0;
    color: var(--text-secondary);
    font-size: 0.9rem; /* Smaller for mobile */
}

.success-popup .countdown {
    font-size: 1.1rem; /* Smaller for mobile */
    font-weight: 600;
    color: var(--primary-color);
    margin: 12px 0;
}

.success-popup .details {
    background-color: #f8f8f8;
    padding: 10px;
    border-radius: 8px;
    margin: 12px 0;
    text-align: left;
}

.success-popup .details p {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    font-size: 0.85rem; /* Smaller for mobile */
}

.success-popup .details p span:last-child {
    font-weight: 600;
    color: var(--text-color);
}

/* Overlay for popup */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeInOverlay 0.3s ease-out forwards;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Design with Strict Mobile Rules */
@media (max-width: 768px) {
    .market-container {
        padding: 0 8px; /* Tighter padding */
    }

    /* IMPROVED MARKET HEADER FOR MOBILE */
    .market-header {
        padding: 8px 10px;
        margin-bottom: 12px;
        border-radius: 8px; /* Even smaller radius */
    }

    .market-title h1 {
        font-size: 1.1rem;
        width: 100%; /* Full width on smaller screens */
        margin-bottom: 6px; /* Add space before controls */
    }

    .market-controls {
        width: 100%; /* Full width */
        justify-content: space-between; /* Space elements evenly */
        height: 36px; /* Slightly smaller height */
    }

    .market-filter select {
        font-size: 0.8rem;
        padding: 6px 8px;
        min-width: 80px; /* Ensure enough width for text */
        padding-right: 24px; /* Space for smaller arrow */
        background-position: right 6px center;
        background-size: 16px; /* Smaller arrow icon */
    }

    .market-view-toggle {
        height: 32px; /* Even smaller height */
        padding: 2px;
    }

    .market-view-toggle button {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }

    .market-view-toggle button i {
        font-size: 14px;
    }

    .market-stats-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .trade-inputs {
        flex-direction: column;
        gap: 10px;
    }

    .market-stat {
        min-width: unset;
        padding: 8px 10px;
    }

    .chart-container {
        height: 280px; /* Further reduced */
    }

    .orderbook-container {
        height: 280px;
    }

    .asks, .bids {
        max-height: 120px;
    }

    .trading-buttons {
        gap: 8px;
    }

    .buy-button, .sell-button {
        min-height: 40px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    /* EXTREMELY MOBILE-FRIENDLY MARKET HEADER */
    .market-header {
        padding: 8px;
        flex-direction: column;
        align-items: flex-start;
    }

    .market-title h1 {
        font-size: 1rem;
        margin-bottom: 8px;
        width: 100%;
        text-align: center; /* Center title */
    }

    .market-controls {
        width: 100%;
        justify-content: center; /* Center controls */
        gap: 10px; /* Better spacing */
    }

    .market-filter {
        flex: 1; /* Take available space */
        max-width: 50%; /* Limit width */
    }

    .market-filter select {
        width: 100%;
        text-align: center; /* Center text */
        padding-right: 20px; /* Maintain space for arrow */
        font-size: 0.75rem;
    }

    .market-view-toggle {
        flex: 0 0 auto; /* Don't grow */
    }

    .market-stats-row {
        grid-template-columns: 1fr; /* Stack vertically */
        gap: 6px;
    }

    .trading-buttons {
        grid-template-columns: 1fr; /* Stack buttons */
        gap: 6px;
    }

    .market-title h1 {
        font-size: 1.1rem;
    }

    .asset-details h2 {
        font-size: 1.1rem;
    }

    .current-price {
        font-size: 1.2rem;
    }

    .success-popup {
        width: 300px; /* Even smaller */
        padding: 15px 20px;
    }

    .success-popup .success-icon {
        font-size: 2rem;
    }

    .success-popup h3 {
        font-size: 1.1rem;
    }

    .orderbook-header {
        font-size: 0.75rem;
        padding: 6px 8px;
    }

    .ask-row, .bid-row {
        font-size: 0.8rem;
        padding: 5px 8px;
    }
}

/* Extra small screens (like iPhone SE) */
@media (max-width: 375px) {
    .market-header {
        padding: 6px;
    }
    
    .market-title h1 {
        font-size: 0.95rem;
    }
    
    .market-filter select {
        font-size: 0.7rem;
        min-width: 60px;
        padding: 6px;
        padding-right: 18px;
    }
    
    .market-view-toggle {
        height: 30px;
    }
    
    .market-view-toggle button {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
    }
    
    .market-view-toggle button i {
        font-size: 12px;
    }
}

.currency-price-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    padding: 16px 20px;
    margin: 18px 0 10px 0;
    gap: 18px;
    flex-wrap: wrap;
}

.currency-select-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.currency-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f5f5f5;
    object-fit: contain;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

#currency-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    font-size: 1rem;
    background: #fafbfc;
    min-width: 120px;
    outline: none;
    transition: border 0.2s;
}
#currency-select:focus {
    border: 1.5px solid #00b894;
}

.price-details {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #222;
}

.info-tooltip {
    color: #888;
    cursor: pointer;
    font-size: 1rem;
    margin-left: 2px;
    display: flex;
    align-items: center;
}
.info-tooltip:hover {
    color: #00b894;
}

@media (max-width: 600px) {
    .currency-price-card {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 10px;
        gap: 10px;
    }
    .price-details {
        font-size: 1rem;
        justify-content: flex-start;
    }
    .currency-icon {
        width: 26px;
        height: 26px;
    }
}

/* Balance update animation */
@keyframes balance-highlight {
    0% {
        background-color: rgba(46, 204, 113, 0);
    }
    30% {
        background-color: rgba(46, 204, 113, 0.3);
    }
    100% {
        background-color: rgba(46, 204, 113, 0);
    }
}

.balance-updated {
    animation: balance-highlight 1.5s ease-out;
    border-radius: 3px;
}

/* Global Loader */
#global-market-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

#global-market-loader.fade-out {
    opacity: 0;
}

.global-loader-content {
    text-align: center;
    padding: 20px;
}

.global-loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px auto;
    border: 4px solid rgba(87, 178, 253, 0.9);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.global-loading-text {
    font-size: 18px;
    color: #333;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
}

@media (max-width: 768px) {
    .global-loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 3px;
    }
    
    .global-loading-text {
        font-size: 16px;
    }
}
