* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #09090b;
    --bg-secondary: #0f0f12;
    --bg-card: #18181b;
    --bg-hover: #27272a;
    --accent-primary: #14f195;
    --accent-secondary: #9945ff;
    --accent-gradient: linear-gradient(135deg, #14f195 0%, #9945ff 100%);
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: #27272a;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-md);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
}

.connect-wallet {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-gradient);
    border: none;
    color: #000;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.connect-wallet:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.connect-wallet.connected {
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Views */
.view {
    display: none;
    padding: 32px 0;
}

.view.active {
    display: block;
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.view-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select, .search-input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    min-width: 140px;
}

.filter-select:focus, .search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-input {
    min-width: 200px;
}

/* Listings Grid */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}

.listing-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.15s ease;
}

.listing-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.listing-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.listing-coin {
    display: flex;
    align-items: center;
    gap: 12px;
}

.coin-icon {
    width: 44px;
    height: 44px;
    background: var(--bg-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    overflow: hidden;
}

.coin-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coin-info h3 {
    font-size: 1rem;
    font-weight: 600;
}

.coin-info span {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.listing-badge {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-live {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-partial {
    background: rgba(20, 241, 149, 0.1);
    color: var(--accent-primary);
}

.listing-details {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 16px;
}

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

.detail-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.detail-value {
    font-weight: 500;
    font-size: 0.875rem;
}

.detail-value.highlight {
    color: var(--accent-primary);
}

.listing-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.seller-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.seller-avatar {
    width: 24px;
    height: 24px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
}

.btn-trade {
    background: var(--accent-gradient);
    border: none;
    color: #000;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-trade:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Create Form */
.create-form {
    max-width: 640px;
    margin: 0 auto;
}

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 12px;
}

.form-section h3 {
    margin-bottom: 16px;
    font-size: 0.9375rem;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
}

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

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

.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.swap-indicator {
    display: flex;
    justify-content: center;
    padding: 8px 0;
    color: var(--text-muted);
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: #000;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-large {
    width: 100%;
    padding: 14px 32px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-hover);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.modal-close:hover {
    background: var(--danger);
}

.modal-header {
    padding: 20px 20px 0;
}

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

.modal-content {
    padding: 20px;
}

.trade-summary {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

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

.trade-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.trade-arrow {
    display: flex;
    justify-content: center;
    padding: 4px 0;
    color: var(--accent-primary);
}

.offer-input-group {
    margin-bottom: 16px;
}

.offer-input-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-size: 0.8125rem;
}

.offer-input-group input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
}

.offer-input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.quick-amounts {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.quick-amount {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.quick-amount:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

/* My Listings */
.my-listing-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.my-listing-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.my-listing-details h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.my-listing-details p {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

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

.btn-secondary {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
    }

    .nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters {
        width: 100%;
    }

    .filter-select, .search-input {
        flex: 1;
        min-width: auto;
    }

    .listings-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .my-listing-card {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .my-listing-actions {
        width: 100%;
    }

    .my-listing-actions button {
        flex: 1;
    }
}
