/* Custom styles for Marketplace TMA */

:root {
    --color-primary: #3b82f6;
    --color-primary-dark: #1e40af;
    --color-bg: #111827;
    --color-bg-secondary: #1f2937;
    --color-border: #374151;
    --color-text: #f3f4f6;
    --color-text-secondary: #d1d5db;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

body {
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Ensure bottom nav is safe from notch */
@supports (padding: max(0px)) {
    nav:last-of-type {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Scrolling areas */
#main-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5rem;
}

/* Listing cards */
.listing-card {
    transition: all 0.2s ease;
}

.listing-card:active {
    transform: scale(0.98);
}

/* Forms */
input, textarea, select {
    font-size: 16px; /* Prevent zoom on iOS */
}

/* Loading spinner */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

/* Dark mode (Telegram theme aware) */
@media (prefers-color-scheme: dark) {
    /* Already dark by default */
}

/* Light mode fallback */
@media (prefers-color-scheme: light) {
    :root {
        --color-bg: #f9fafb;
        --color-bg-secondary: #f3f4f6;
        --color-border: #d1d5db;
        --color-text: #111827;
        --color-text-secondary: #4b5563;
    }
}
