/* ==================== CSS Variables ==================== */
:root {
    /* Theme Colors */
    --bg-primary: #0f0f1a;
    --bg-secondary: #16213e;
    --bg-card: #1a1a2e;
    --bg-input: #252540;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;
    
    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    /* Gradient Presets */
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --gradient-6: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Fonts */
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    /* Safe areas */
    --safe-top: env(safe-area-inset-top, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    
    /* Tab bar height */
    --tab-bar-height: 64px;
}

/* ==================== Reset & Base ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Disable text and image selection */
*:not(input):not(textarea) {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Allow selection in input fields */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Disable image dragging */
img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* RTL Support for Persian */
[dir="rtl"] {
    direction: rtl;
}

/* ==================== App Container ==================== */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ==================== Header ==================== */
.header {
    background: var(--bg-card);
    padding: var(--space-md);
    padding-top: calc(var(--safe-top) + var(--space-md));
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-md);
    padding-bottom: calc(var(--tab-bar-height) + var(--space-md));
    -webkit-overflow-scrolling: touch;
}

/* ==================== Tab Content ==================== */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* ==================== Security Banner ==================== */
.security-banner {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.4s ease;
}

.security-banner-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.15));
    border-radius: var(--radius-md);
    color: var(--accent-success);
}

.security-banner-icon svg {
    width: 24px;
    height: 24px;
}

.security-banner-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.security-banner-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.security-banner-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.security-banner-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    padding: 0;
}

.security-banner-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.security-banner-close svg {
    width: 18px;
    height: 18px;
}

.security-banner.hidden {
    display: none;
}

.intro-modal-text {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ==================== Search ==================== */
.search-container {
    margin-bottom: var(--space-md);
    position: relative;
}

.filter-toggle-btn {
    position: absolute;
    right: var(--space-sm);
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: var(--space-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-toggle-btn:hover {
    color: var(--text-primary);
}

.filter-toggle-btn.active {
    color: var(--accent-primary);
}

.filter-toggle-btn svg {
    width: 20px;
    height: 20px;
}

.filters-dropdown {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    animation: slideDown 0.3s ease;
}

.filters-dropdown.hidden {
    display: none;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.filter-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.price-filter-input {
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.price-filter-input::placeholder {
    color: var(--text-muted);
}

.sort-select {
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23c6cbff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-sm) center;
    padding-right: calc(var(--space-md) + 16px);
    transition: all 0.2s;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.sort-select:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.sort-select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    font-weight: 500;
}

/* Стили для iOS/Safari */
@supports (-webkit-appearance: none) {
    .sort-select option {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    }
}

/* Альтернативный подход: стилизация через data-атрибуты для кастомного dropdown */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
}

.custom-select-option {
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    color: var(--accent-primary);
}

.custom-select-option.selected {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
    color: var(--accent-primary);
    font-weight: 600;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: var(--space-md);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

[dir="rtl"] .search-icon {
    left: auto;
    right: var(--space-md);
}

.search-input {
    width: 100%;
    padding: var(--space-md);
    padding-left: 48px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-main);
    transition: all 0.2s ease;
}

[dir="rtl"] .search-input {
    padding-left: var(--space-md);
    padding-right: 48px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* ==================== Category Filters ==================== */
.category-filters {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-md);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-filters::-webkit-scrollbar {
    display: none;
}

.category-btn {
    flex-shrink: 0;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.category-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* ==================== Listings Grid ==================== */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-md);
}

/* ==================== Listing Card ==================== */
.listing-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.listing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.card-gradient {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

/* Gradient variations based on category */
.card-gradient.gradient-Инфл { background: var(--gradient-1); }
.card-gradient.gradient-Кит { background: var(--gradient-2); }
.card-gradient.gradient-Снайп { background: var(--gradient-3); }
.card-gradient.gradient-Ферма { background: var(--gradient-4); }
.card-gradient.gradient-Трейдер { background: var(--gradient-6); }
.card-gradient.gradient-Other { background: var(--gradient-5); }

/* PBRICK Badge */
.pbrick-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    color: #000;
}

/* Commission badge on cards */
.card-commission {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.card-commission.no-fee {
    color: var(--accent-success);
}

.commission-info-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    margin-left: 0.25rem;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-muted);
    line-height: 1;
}

.commission-info-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Total price display */
.card-total-price {
    font-size: 0.875rem;
    color: var(--accent-primary);
    font-weight: 500;
}

/* TON Connect styles */
.ton-connect-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md);
    background: #0088cc;
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.ton-connect-button:hover {
    background: #0077b5;
}

.ton-connect-button svg {
    width: 24px;
    height: 24px;
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.wallet-address {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.pbrick-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    margin-top: var(--space-md);
    font-size: 0.8rem;
    color: var(--accent-warning);
}

.pbrick-info-link {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
    cursor: pointer;
}

.pbrick-info-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.pbrick-info svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Deposit amount input */
.deposit-amount-container {
    margin-bottom: var(--space-lg);
}

.deposit-amount-input {
    width: 100%;
    padding: var(--space-lg);
    background: var(--bg-input);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-family: var(--font-mono);
    text-align: center;
}

.deposit-amount-input:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

.card-name-pill {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.card-info {
    padding: var(--space-md);
}

.card-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.card-price {
    display: flex;
    align-items: baseline;
    gap: var(--space-xs);
}

.card-price-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-success);
}

.card-price-currency {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Sold badge */
.card-sold-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: rgba(0, 0, 0, 0.7);
    color: var(--accent-danger);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ==================== Balance Card ==================== */
.balance-card {
    background: var(--gradient-1);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.balance-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: var(--space-xs);
}

.balance-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

#user-balance {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.balance-currency {
    font-size: 1.25rem;
    font-weight: 500;
    opacity: 0.8;
}

.balance-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.btn-primary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.btn-accent {
    background: var(--accent-primary);
    color: white;
}

.btn-accent:hover:not(:disabled) {
    background: var(--accent-secondary);
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    opacity: 0.9;
}

.btn-full {
    width: 100%;
}

.btn-create {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-input);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.btn-create:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-create svg {
    width: 24px;
    height: 24px;
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-copy svg {
    width: 16px;
    height: 16px;
}

/* ==================== Sections ==================== */
.section {
    margin-bottom: var(--space-lg);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

/* ==================== Listings List (Profile) ==================== */
.listings-list,
.purchases-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.list-item-gradient {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-item-gradient span {
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a2e;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.625rem;
    font-weight: 600;
}

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

.list-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-item-price {
    font-weight: 600;
    color: var(--accent-success);
    font-family: var(--font-mono);
}

.list-item-actions {
    display: flex;
    gap: var(--space-xs);
}

.list-item-actions button {
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.list-item-actions button:hover {
    background: var(--accent-danger);
    color: white;
}

.list-item-actions button svg {
    width: 16px;
    height: 16px;
}

/* ==================== Empty State ==================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-small {
    padding: var(--space-lg);
    text-align: center;
    color: var(--text-muted);
}

/* ==================== Loading ==================== */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== Tab Bar ==================== */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-lg);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.tab-btn svg {
    width: 24px;
    height: 24px;
}

.tab-btn.active {
    color: var(--accent-primary);
}

/* ==================== Modal ==================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Модалка редактирования цены должна быть выше других модалок */
#edit-price-modal {
    z-index: 1001;
}

.modal.closing {
    opacity: 0;
}

.modal.closing .modal-content {
    transform: translateY(100%);
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal.hidden .modal-content {
    transform: translateY(100%);
}

.modal .modal-content {
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal.opening .modal-content {
    transform: translateY(0);
    opacity: 1;
}

.btn-edit-price {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-left: var(--space-xs);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(168, 85, 247, 0.18));
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit-price svg {
    width: 16px;
    height: 16px;
}

.btn-edit-price:hover {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.btn-edit-price:active {
    transform: translateY(1px);
}

.card-price-with-edit {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.list-item-price-with-edit {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.detail-price-row {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden .modal-backdrop {
    opacity: 0;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--bg-secondary);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: var(--space-lg);
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

/* ==================== Form ==================== */
.form-group {
    margin-bottom: var(--space-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-main);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* ==================== Listing Detail ==================== */
.detail-gradient {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: calc(var(--space-lg) * -1);
    margin-bottom: var(--space-lg);
}

.detail-name-pill {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1.125rem;
    box-shadow: var(--shadow-md);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
}

.detail-value {
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

.detail-value.address {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    max-width: 180px;
}

.detail-value.price {
    color: var(--accent-success);
    font-family: var(--font-mono);
}

.detail-description {
    padding: var(--space-md);
    background: var(--bg-input);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.detail-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    align-items: stretch;
}

.detail-actions .btn-full {
    flex: 1;
}

.detail-actions .btn-share {
    flex-shrink: 0;
}

/* ==================== Deposit ==================== */
.deposit-instructions {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.deposit-address-box {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-input);
    border-radius: var(--radius-md);
}

.deposit-address {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    word-break: break-all;
    color: var(--text-primary);
}

/* ==================== Toast ==================== */
.toast {
    position: fixed;
    bottom: calc(var(--tab-bar-height) + var(--space-md));
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.875rem;
    z-index: 2000;
    animation: toastIn 0.3s ease;
}

.toast.hidden {
    display: none;
}

.toast.success {
    border-color: var(--accent-success);
}

.toast.error {
    border-color: var(--accent-danger);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ==================== Utility Classes ==================== */
.hidden {
    display: none !important;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* ==================== Support Button ==================== */
.btn-support {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-content: center;
    margin-bottom: var(--space-md);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(168, 85, 247, 0.3);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    color: var(--text-primary);
}

.btn-support:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border-color: rgba(168, 85, 247, 0.5);
    transform: translateY(-2px);
}

.btn-support svg {
    width: 20px;
    height: 20px;
}

/* ==================== Share Button ==================== */
.btn-share {
    width: 52px;
    height: 52px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-share:hover {
    background: #f3f3f3;
    transform: translateY(-2px);
}

.btn-share svg {
    width: 20px;
    height: 20px;
    stroke: var(--bg-primary);
}

/* ==================== Confirm Modal ==================== */
.confirm-modal-content {
    max-width: 350px;
    border-radius: var(--radius-xl);
}

.confirm-message {
    text-align: center;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
    padding: var(--space-md) 0;
}

.confirm-actions {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    padding-top: 0;
}

.confirm-actions .btn {
    flex: 1;
}

/* ==================== Selection ==================== */
::selection {
    background: var(--accent-primary);
    color: white;
}

