/* public/pages/market/market.css */
* {
    font-family: Arial, sans-serif;
}


/* Global box sizing */
*, *:before, *:after {
    box-sizing: border-box;
}

/* Prevent horizontal scroll on body/html */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Container for all content */
.content {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}



.collection-card {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    padding: 12px;
    margin: 0 12px 12px 12px;
    position: relative;
}

.collection-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.collection-preview {
    width: 50px;
    height: 50px;
    position: relative;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
}

.collection-info {
    flex: 1;
    min-width: 0;
}

.collection-title-row {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.collection-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-text-color);
    text-decoration: none;
}

.collection-title:hover {
    text-decoration: underline;
}

.stats-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.stats-badge {
    padding: 4px 12px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    position: relative;
    cursor: pointer;
}

/* Tooltip styles */
.stats-badge[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--tg-theme-bg-color);
    border: 1px solid var(--tg-theme-hint-color);
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    color: var(--tg-theme-text-color);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 8px;
}

.stats-badge[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
}


.stats-badge-icon {
    font-size: 14px;
}

.stats-badge-value {
    font-weight: 500;
    font-size: 14px;
}

/* Different colors for floor and listed badges */
.stats-badge.floor {
    background: rgba(157, 234, 190, 0.2);
}

.stats-badge.floor .stats-badge-icon,
.stats-badge.floor .stats-badge-value {
    color: rgb(75, 181, 120);
}

.stats-badge.listed {
    background: rgba(255, 183, 77, 0.2);
}

.stats-badge.listed .stats-badge-icon,
.stats-badge.listed .stats-badge-value {
    color: rgb(255, 152, 0);
}


.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Make buy floor button take full width */
.action-button[data-action="buy-floor"] {
    flex: 0 0 100%;
    margin-bottom: 8px;
}

/* Keep other buttons on one line */
.action-button[data-action="limit-buy"],
.action-button[data-action="m-orders"] {
    flex: 1 1 calc(50% - 4px);
}
.action-button {
    flex: 1;
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-button.secondary {
    background: rgba(47, 128, 237, 0.1);
    color: #2F80ED;
}


.close-button {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--tg-theme-hint-color);
    cursor: pointer;
    padding: 4px;
}

.input-group {
    margin-bottom: 10px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--tg-theme-hint-color);
}

.input-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--tg-theme-hint-color);
    border-radius: 8px;
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    box-sizing: border-box;
}

.slider-container {
    margin-bottom: 10px;
}

.slider-container label {
    display: block;
    margin-bottom: 8px;
    color: var(--tg-theme-hint-color);
}

.slider-container input[type="range"] {
    width: 100%;
    margin: 8px 0;
}

.modal-actions {
    display: flex;
    gap: 8px;
}

.modal-button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.modal-button.primary {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

.modal-button.secondary {
    background: rgba(0, 0, 0, 0.1);
    color: var(--tg-theme-text-color);
}

.modal-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* No collections message */
.no-collections {
    text-align: center;
    padding: 32px 16px;
    color: var(--tg-theme-hint-color);
    font-size: 16px;
}

/* Price summary styles */
.price-summary {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.price-label {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    line-height: 1.5;
}

.price-value,
.limit-price-value,
.limit-total-value {
    color: var(--tg-theme-text-color);
    font-weight: 600;
    font-size: 16px;
}

/* Modal explanation style */
.modal-explanation {
    margin: 16px 0;
    padding: 12px;
    background: rgba(47, 128, 237, 0.1);
    border-radius: 8px;
    color: var(--tg-theme-text-color);
    font-size: 14px;
    line-height: 1.4;
}

/* Updated button styles for better dark theme visibility */
.modal-button.secondary {
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    border: 1px solid var(--tg-theme-button-color);
}

/* Improved slider container spacing */
.slider-container {
    margin-bottom: 10px;
}

.slider-container label {
    display: block;
    margin-bottom: 10px;
    color: var(--tg-theme-hint-color);
    font-size: 14px;
}

/* Improve slider value display */
#limitAmountValue,
#discountValue {
    margin-top: 8px;
    font-size: 14px;
    color: var(--tg-theme-text-color);
}


/* Update these styles in market.css */

/* Make price and amount values more visible */
#floorAmountValue,
#limitAmountValue,
#discountValue,
#floorTotalPrice,
#limitPrice,
#limitTotalPrice {
    color: var(--tg-theme-text-color);
    font-weight: 500;
    font-size: 16px;
    margin-top: 8px;
}

/* Add background for better readability */
.price-summary {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

/* Ensure price labels are visible */
.price-label {
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    line-height: 1.5;
}

.price-value {
    font-weight: 500;
    color: var(--tg-theme-text-color);
    font-size: 16px;
}

/* Style for slider labels */
.slider-container label {
    display: block;
    margin-bottom: 10px;
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    line-height: 1.5;
}

/* Style for input groups */
.input-group {
    margin-bottom: 10px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    line-height: 1.5;
}

/* Style for deposit message */
.deposit-message {
    background-color: rgba(244, 67, 54, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    color: rgb(244, 67, 54);
    font-size: 14px;
    line-height: 1.4;
}

/* Total price container */
#floorTotalPrice {
    padding: 12px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    color: var(--tg-theme-text-color);
    font-weight: 500;
}

.modal-button.primary:disabled {
    opacity: 0.7;
    cursor: wait;
}

.details-btn {
    color: #2F80ED;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.details-btn:hover {
    text-decoration: underline;
}

.modal-button.primary:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Add bottom padding to content */
.content {
    padding-bottom: 100px; /* Add significant padding at bottom */
}

/* Ensure menu doesn't overlap modal */
#menu-container {
    z-index: 100;
}

/* Give modal higher z-index */
.modal {
    z-index: 1000;
    padding-bottom: 100px; /* Add padding for better visibility on small screens */
}

.modal-content {
    margin: 20px;
    max-height: calc(100vh - 160px); /* Account for menu height */
    overflow-y: auto; /* Make modal content scrollable if needed */
}

/* Top Navigation - Two Rows */
.top-nav {
    display: flex;
    flex-direction: column;
    background: var(--tg-theme-secondary-bg-color);
    padding: 8px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    gap: 8px;
}

.nav-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.nav-link {
    color: var(--tg-theme-hint-color);
    text-decoration: none;
    padding: 8px 0;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.nav-link.active {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

/* Update all content below nav */
.content > *:not(.top-nav) {
    margin-top: 2px;
}

/* Adjustments for the second navigation menu */
.top-nav:nth-child(2) {
    margin-top: 8px;
}

/* Adjust space after the filter container */
#collection-filter-container {
    margin: 8px 12px;
}

/* Collection list spacing */
#collections-list {
    margin-top: 8px;
}



/* Success Popup Styles */
.success-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    background: rgba(46, 204, 113, 0.95);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    color: white;
    text-align: center;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease-out;
    max-width: 90%;
    width: 300px;
    backdrop-filter: blur(8px);
}

.success-popup.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.success-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
}

.success-popup-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.success-popup-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    animation: fadeInUp 0.4s ease-out 0.2s both;
}

.success-popup-message {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 16px;
    animation: fadeInUp 0.4s ease-out 0.3s both;
}

.success-popup-price {
    font-size: 24px;
    font-weight: 700;
    margin: 12px 0;
    animation: fadeInUp 0.4s ease-out 0.4s both;
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #fff;
    opacity: 0;
    pointer-events: none;
    border-radius: 50%;
    animation: confettiFall 1s ease-out forwards;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

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

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.buy-floor-container {
    margin-bottom: 2px;
}

.amount-slider {
    width: 100%;
    margin: 8px 0;
}

.amount-display {
    text-align: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--tg-theme-text-color);
}

.action-button[data-action="buy-floor"] {
    width: 100%;
}



.action-button:disabled {
    opacity: 0;
    cursor: not-allowed;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

.action-button.dissolving {
    animation: dissolveOut 0.3s ease-out forwards;
}

@keyframes dissolveOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.95);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

.action-button.reappearing {
    animation: dissolveIn 0.3s ease-out forwards;
}

@keyframes dissolveIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}



.limit-buy-container {
    margin-top: 4px;
}

.limit-buy-container .amount-display,
.limit-buy-container .discount-display {
    text-align: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--tg-theme-text-color);
}

.limit-buy-container .amount-slider,
.limit-buy-container .discount-slider {
    width: 100%;
    margin: 8px 0;
}

/* Add these CSS updates to market.css */

/* Update action buttons container layout */
.action-buttons {
    display: flex;
    flex-direction: column;  /* Change to column layout */
    gap: 8px;
    width: 100%;
}

/* Update buy floor container */
.buy-floor-container {
    width: 100%;
    margin-bottom: 16px;
}

/* Update limit buy container */
.limit-buy-container {
    width: 100%;
    background: rgba(47, 128, 237, 0.05);  /* Light blue background */
    border-radius: 8px;
    padding: 10px;
}

/* Update Orders button */
.action-button[data-action="m-orders"] {
    width: 100%;
    margin-top: 8px;
}

/* Remove the previous flex rules that were causing side-by-side layout */
.action-button[data-action="limit-buy"],
.action-button[data-action="m-orders"] {
    flex: none;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.buy-floor-container {
    width: 100%;
}

.limit-buy-container {
    width: 100%;
    background: rgba(47, 128, 237, 0.05);
    border-radius: 8px;
    padding: 10px;
}

.amount-slider,
.limit-amount-slider,
.discount-slider {
    width: 100%;
    margin: 8px 0;
}

.bottom-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.bottom-buttons .action-button {
    flex: 1;
}

/* Remove old styles */
.separator {
    display: none;
}

.action-button[data-action="limit-buy"],
.action-button[data-action="m-orders"] {
    flex: 1;
    margin: 0;
}

/* Update price summary margins */
.price-summary {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    border: 1px solid var(--tg-theme-hint-color);
}


/* Welcome banner styling */
.welcome-banner {
    background: var(--tg-theme-secondary-bg-color);
    padding: 4px;
    text-align: center;
    margin: 0 6px;  /* Remove top margin, keep horizontal margins */
    border-radius: 10px;
}

.welcome-banner p {
    margin: 0;
    color: var(--tg-theme-text-color);
    font-size: 14px;
}

.bot-link {
    background: none;
    border: none;
    color: var(--tg-theme-button-color);
    font-weight: 500;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
}

.bot-link:hover {
    text-decoration: underline;
}

/* Update all content below nav */
.content > *:not(.top-nav) {
    margin-top: 2px;
}


.amount-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--tg-theme-hint-color);
    border-radius: 8px;
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    margin-bottom: 12px;
    font-size: 14px;
}

.loading-wheel {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 48px; /* Match button height */
    color: var(--tg-theme-button-color);
}

.buy-floor-button-container {
    width: 100%;
}

.limit-buy-header {
    color: var(--tg-theme-text-color);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.limit-buy-container {
    width: 100%;
    background: rgba(47, 128, 237, 0.05);
    border-radius: 8px;
    padding: 8px;
    margin-top: 8px;
}

.limit-buy-container .amount-display,
.limit-buy-container .discount-display {
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--tg-theme-hint-color);
}

.price-summary {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    padding: 8px;
    margin: 8px 0;
}

.bottom-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.bottom-buttons .action-button {
    flex: 1;
}

.discount-display {
    display: flex;
    align-items: center;
}

.price-row {
    padding: 4px 0;
}

.buy-floor-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.buy-floor-row .input-wrapper {
    width: 120px;
}

.buy-floor-row .action-button {
    flex: 1;
}


.input-wrapper {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
}

.input-wrapper .amount-input {
    width: 120px;
    margin-top: 4px;
}

.percentage-input {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.percentage-input .amount-input {
    width: 80px;
}

.percentage-input span {
    color: var(--tg-theme-text-color);
}

.amount-input {
    padding: 8px;
    border: 1px solid var(--tg-theme-hint-color);
    border-radius: 8px;
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    font-size: 14px;
}

.limit-buy-header {
    text-align: center;
    padding: 4px 0 8px;
}

.limit-input-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.limit-input-row .input-wrapper {
    flex: 1;
    font-size: 10px;
    color: var(--tg-theme-hint-color);
}

.input-wrapper .amount-input {
    width: 100%;
    margin-top: 2px;
}

.percentage-input {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.percentage-input .amount-input {
    width: calc(100% - 20px);
}

.percentage-input span {
    color: var(--tg-theme-text-color);
    width: 16px;
}

.limit-buy-container {
    margin-top: 8px;
    padding: 8px;
}

.limit-buy-header {
    text-align: center;
    font-weight: 600;
    margin-bottom: 8px;
}





/* Force transparent background with !important to override any other styles */
.collection-preview {
    width: 50px;
    height: 50px;
    position: relative;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background-color: transparent !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Ensure parent elements don't have backgrounds either */
.collection-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    background-color: transparent !important; /* Ensure parent is transparent too */
}

/* Remove any img tags if they're still being used */
.collection-preview img {
    display: none !important;
}

/* Add these styles to fix any possible theme-related issues */
.collection-card {
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 8px;
    padding: 12px;
    margin: 0 12px 12px 12px;
    position: relative;
}

.collection-info {
    flex: 1;
    min-width: 0;
    background-color: transparent !important;
}

.loading-wheel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: inherit;
}

.loading-wheel i {
    animation: spin 1s linear infinite;
}

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

/* Make spinner visible on any background */
.action-button .loading-wheel {
    color: var(--tg-theme-button-text-color);
}

.action-button.secondary .loading-wheel {
    color: #2F80ED;
}

/* Add these styles to market.css */
#collection-filter-container {
    margin: 8px 12px;
}

#collections-list {
    margin-top: 8px;
}

/* Improved collection filter positioning and width for market page */
#collection-filter-container.collection-filter {
    margin: 8px 12px;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
}

/* Make sure content within the filter doesn't overflow */
.collection-filter .collection-list {
    width: 100%;
    overflow-x: hidden;
    max-width: 100%;
}

/* Ensure each collection item fits within the available space */
.collection-filter .collection-item {
    width: 100%;
    box-sizing: border-box;
}

/* Make sure collection names don't overflow */
.collection-filter .collection-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Adjust preview size to fit better on small screens */
@media (max-width: 320px) {
    .collection-filter .collection-preview {
        width: 28px;
        height: 28px;
    }
}

/* Add space after the welcome banner */
.welcome-banner {
    margin-bottom: 12px;
}