/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header Styles */
.header {
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 15px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.brand-name {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(45deg, #00d4ff, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #00d4ff;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(45deg, #00d4ff, #ff6b6b);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.3);
}

.btn-success {
    background: linear-gradient(45deg, #00d4aa, #00a386);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 212, 170, 0.3);
}

.btn-danger {
    background: linear-gradient(45deg, #ff6b6b, #e55555);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.3);
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Wallet Info */
.wallet-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.wallet-details {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wallet-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.wallet-type {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    text-transform: uppercase;
}

.wallet-address {
    font-size: 12px;
    color: #00d4ff;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.wallet-balance {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 8px;
}

.wallet-balance span:first-child {
    font-size: 12px;
    font-weight: 600;
    color: #00d4aa;
}

.balance-usd {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
}

.wallet-actions {
    display: flex;
    gap: 4px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 10px;
    min-height: 28px;
    border-radius: 4px;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

/* Main Content */
.main-content {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
    padding: 30px 0;
}

/* Card Styles */
.card {
    background: rgba(30, 30, 50, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Trading Grid */
.trading-grid {
    display: grid;
    grid-template-columns: 280px 1fr 300px;
    grid-template-rows: auto 1fr auto;
    gap: 16px;
    height: calc(100vh - 140px);
}

.market-info {
    grid-column: 1;
    grid-row: 1;
}

.chart-container {
    grid-column: 2;
    grid-row: 1 / 3;
}

.trading-panel {
    grid-column: 3;
    grid-row: 1 / 3;
}

.orderbook {
    grid-column: 1;
    grid-row: 2;
    max-height: 500px;
    overflow: hidden;
}

.portfolio {
    grid-column: 1 / 4;
    grid-row: 3;
}

/* Market Info */
.market-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.pair-info h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.market-type {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.current-price {
    font-size: 20px;
    font-weight: 700;
    text-align: right;
}

.price-change {
    font-size: 14px;
    font-weight: 500;
    text-align: right;
}

.price-change.positive {
    color: #00d4aa;
}

.price-change.negative {
    color: #ff6b6b;
}

.market-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
}

/* Chart Styles */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.timeframe-selector {
    display: flex;
    gap: 5px;
}

.timeframe-btn {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.timeframe-btn:hover,
.timeframe-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    color: #00d4ff;
}

.chart-area {
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    position: relative;
}

#chartCanvas {
    width: 100%;
    height: 100%;
}

/* Trading Panel */
.trading-tabs {
    display: flex;
    margin-bottom: 20px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 6px;
    font-weight: 500;
}

.tab-btn.active {
    background: linear-gradient(45deg, #00d4aa, #00a386);
    color: white;
}

.tab-btn[data-tab="short"].active {
    background: linear-gradient(45deg, #ff6b6b, #e55555);
}

.trading-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.form-control {
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Leverage Selector */
.leverage-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.leverage-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

.leverage-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    border-radius: 50%;
    cursor: pointer;
}

.leverage-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.leverage-display {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: #00d4ff;
}

.leverage-presets {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.leverage-preset {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.leverage-preset:hover,
.leverage-preset.active {
    border-color: #00d4ff;
    color: #00d4ff;
}

.margin-info {
    padding: 12px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 8px;
    color: #00d4ff;
    font-weight: 500;
}

.advanced-options {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: 5px;
}

.advanced-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.advanced-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Order Book */
.orderbook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.orderbook-controls {
    display: flex;
    gap: 5px;
}

.orderbook-btn {
    padding: 6px 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.orderbook-btn:hover,
.orderbook-btn.active {
    border-color: #00d4ff;
    color: #00d4ff;
}

.orderbook-content {
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.orderbook-header-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.orderbook-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 4px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.orderbook-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.orderbook-asks .orderbook-row {
    color: #ff6b6b;
}

.orderbook-bids .orderbook-row {
    color: #00d4aa;
}

.orderbook-spread {
    padding: 10px 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* Portfolio */
.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.portfolio-tabs {
    display: flex;
    gap: 20px;
}

.portfolio-tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}

.portfolio-tab:hover,
.portfolio-tab.active {
    color: #00d4ff;
    border-bottom-color: #00d4ff;
}

.portfolio-tab-content {
    display: none;
}

.portfolio-tab-content.active {
    display: block;
}

.balance-info {
    display: flex;
    gap: 40px;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.balance-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.balance-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.balance-value {
    font-size: 16px;
    font-weight: 600;
}

.balance-value.pnl.positive {
    color: #00d4aa;
}

.balance-value.pnl.negative {
    color: #ff6b6b;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.empty-state {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* Footer */
.footer {
    background: rgba(15, 15, 35, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-logo {
    width: 30px;
    height: 30px;
    border-radius: 6px;
}

.footer-links {
    display: flex;
    gap: 25px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #00d4ff;
}

.footer-social {
    display: flex;
    gap: 15px;
}

.social-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: rgba(0, 212, 255, 0.2);
    color: #00d4ff;
    transform: translateY(-2px);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(30, 30, 50, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-body {
    padding: 20px;
}

.wallet-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.wallet-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-align: left;
}

.wallet-option:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    transform: translateY(-2px);
}

.wallet-option img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.wallet-option span {
    font-weight: 500;
    font-size: 16px;
}

/* Wallet Details Modal */
.wallet-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wallet-detail-item:last-child {
    border-bottom: none;
}

.wallet-detail-item .label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.wallet-detail-item .value {
    font-size: 14px;
    color: #fff;
    font-weight: 600;
}

.address-full {
    font-family: 'Courier New', monospace;
    font-size: 12px !important;
    color: #00d4ff !important;
    margin-right: 8px;
    word-break: break-all;
    flex: 1;
    text-align: right;
}

.balance-details {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.value-usd {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.wallet-actions-modal {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.wallet-actions-modal .btn {
    justify-content: flex-start;
    gap: 8px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-danger {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
}

.btn-danger:hover {
    background: rgba(255, 107, 107, 0.3);
    border-color: rgba(255, 107, 107, 0.5);
    color: #fff;
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    min-width: 300px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateX(100%);
    animation: slideIn 0.3s ease forwards;
    position: relative;
    overflow: hidden;
}

.notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: currentColor;
}

.notification.success {
    background: rgba(0, 212, 170, 0.9);
}

.notification.error {
    background: rgba(255, 107, 107, 0.9);
}

.notification.info {
    background: rgba(0, 212, 255, 0.9);
}

.notification.warning {
    background: rgba(255, 193, 7, 0.9);
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .trading-grid {
        grid-template-columns: 260px 1fr 280px;
        gap: 12px;
    }
    
    .container {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .trading-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto auto;
        height: auto;
        gap: 10px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .card {
        width: 100%;
        max-width: none;
        margin-bottom: 10px;
        padding: 14px;
    }
    
    .market-info,
    .chart-container,
    .trading-panel,
    .orderbook,
    .portfolio {
        grid-column: 1;
        grid-row: unset;
        width: 100%;
    }
    
    .chart-container {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .header .container {
        padding: 0 1rem;
        align-items: center;
    }
    
    .nav-menu {
        display: none;
    }
    
    .trading-grid {
        gap: 1rem;
    }
    
    .balance-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .chart-container {
        min-height: 300px;
    }
    
    #chartCanvas {
        max-width: 100%;
        height: auto;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .nav-menu {
        gap: 15px;
    }
    
    .nav-link {
        font-size: 14px;
    }
    
    .brand-name {
        font-size: 20px;
    }
    
    .timeframe-selector {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .timeframe-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        flex-shrink: 0;
        min-width: 44px;
        min-height: 36px;
    }
    
    .btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.5);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.7);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 100%);
    background-size: 200px 100%;
    background-repeat: no-repeat;
    animation: skeleton-loading 1.5s infinite;
    color: transparent;
    border-radius: 4px;
    display: inline-block;
    min-width: 60px;
    min-height: 20px;
}

.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 100%);
    background-size: 200px 100%;
    background-repeat: no-repeat;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

/* Market Status Indicator */
.market-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff6b6b;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #00d4aa;
}

.status-dot.connecting {
    background: #ffd700;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Enhanced Price Display */
.current-price {
    transition: all 0.3s ease;
    position: relative;
}

.current-price.price-up {
    color: #00d4aa !important;
    text-shadow: 0 0 10px rgba(0, 212, 170, 0.5);
}

.current-price.price-down {
    color: #ff6b6b !important;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

/* Enhanced Orderbook */
.orderbook-row {
    position: relative;
    overflow: hidden;
}

.orderbook-row::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    width: 0;
    transition: width 0.3s ease;
    z-index: 0;
}

.orderbook-row:hover::before {
    width: 100%;
}

.orderbook-row > span {
    position: relative;
    z-index: 1;
}

/* Real-time indicators */
.price-pulse {
    animation: price-flash 0.5s ease;
}

@keyframes price-flash {
    0%, 100% { background: transparent; }
    50% { background: rgba(0, 212, 255, 0.2); }
}

/* Connection status in header */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.connection-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff6b6b;
}

.connection-dot.connected {
    background: #00d4aa;
}

/* Enhanced chart container */
.chart-area {
    position: relative;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        rgba(0, 0, 0, 0.3);
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

/* Improved notification styles */
.notification {
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.notification.real-time {
    background: rgba(0, 212, 255, 0.9);
    border-left: 4px solid #00d4ff;
}

/* Trading panel improvements */
.leverage-display {
    background: rgba(0, 212, 255, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.form-control.error {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

/* Mobile responsiveness for new elements */
@media (max-width: 768px) {
    .market-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .market-status {
        font-size: 11px;
    }
    
    .status-dot {
        width: 5px;
        height: 5px;
    }
    
    /* Fix mobile layout - Convert to single column stacked layout */
    .trading-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
        height: auto;
        padding: 0;
    }
    
    .market-info,
    .chart-container,
    .trading-panel,
    .orderbook,
    .portfolio {
        width: 100%;
        max-width: 100%;
        order: 0;
    }
    
    /* Reorder for better mobile UX */
    .market-info {
        order: 1;
    }
    
    .trading-panel {
        order: 2;
    }
    
    .chart-container {
        order: 3;
    }
    
    .orderbook {
        order: 4;
        max-height: 300px;
    }
    
    .portfolio {
        order: 5;
    }
    
    /* Enhanced mobile improvements */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(13, 17, 28, 0.95);
        backdrop-filter: blur(10px);
        padding: 8px 0;
    }
    
    .header .container {
        padding: 0 12px;
        flex-direction: row;
        align-items: center;
        min-height: 44px;
    }
    
    .logo {
        width: 24px;
        height: 24px;
    }
    
    .nav-brand .brand-name {
        display: none;
    }
    
    .connection-status {
        display: none;
    }
    
    .header-actions {
        gap: 6px;
    }
    
    .wallet-info {
        padding: 4px 6px;
        font-size: 10px;
        border-radius: 6px;
    }
    
    .wallet-details {
        gap: 6px;
    }
    
    .wallet-identity {
        display: none;
    }
    
    .wallet-balance {
        margin-right: 3px;
    }
    
    .wallet-balance span:first-child {
        font-size: 10px;
        font-weight: 600;
    }
    
    .balance-usd {
        font-size: 8px;
    }
    
    .wallet-actions {
        gap: 2px;
    }
    
    .btn-sm {
        padding: 2px 4px;
        font-size: 8px;
        min-height: 20px;
        border-radius: 4px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 40px;
        touch-action: manipulation;
        border-radius: 6px;
    }
    
    #connectWallet {
        font-size: 12px;
        padding: 6px 10px;
        min-height: 36px;
    }
    
    .main-content {
        padding: 8px 0;
        margin-top: 60px;
    }
    
    .container {
        padding: 0 12px;
        max-width: 100%;
        overflow-x: hidden;
    }

    .card {
        margin-bottom: 12px;
        padding: 12px;
        border-radius: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .trading-grid {
        gap: 12px;
        padding: 0 4px;
    }    .header-actions {
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    #connectWallet {
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 0.5rem 0;
    }
    
    .card {
        margin-bottom: 0.75rem;
    }
    
    .market-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .pair-info h2 {
        font-size: 18px;
        margin: 0;
    }
    
    .market-type {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .price-info {
        align-self: flex-start;
        width: 100%;
    }
    
    .current-price {
        font-size: 24px !important;
        font-weight: 700;
        line-height: 1.2;
    }
    
    .price-change {
        font-size: 12px;
        margin-top: 4px;
    }
    
    .market-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 12px;
    }
    
    .stat {
        padding: 8px;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.02);
    }
    
    .stat-label {
        font-size: 10px;
        margin-bottom: 2px;
    }
    
    .stat-value {
        font-size: 12px;
        font-weight: 600;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .chart-header h3 {
        font-size: 16px;
        margin: 0;
    }
    
    .timeframe-selector {
        width: 100%;
        justify-content: space-between;
        overflow-x: auto;
        padding: 4px;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 6px;
    }
    
    .timeframe-btn {
        min-width: 40px;
        flex-shrink: 0;
        min-height: 32px;
        font-size: 11px;
        padding: 6px 8px;
        touch-action: manipulation;
        border-radius: 4px;
        font-weight: 500;
    }
    
    .timeframe-btn.active {
        background: #00d4ff;
        color: #000;
        font-weight: 600;
    }
    
    .chart-area {
        padding: 8px;
        border-radius: 6px;
    }
    
    #chartCanvas {
        width: 100% !important;
        height: 200px !important;
        max-width: 100%;
        touch-action: pan-x pan-y;
        border-radius: 4px;
    }
    
    .trading-panel .form-group {
        margin-bottom: 16px;
    }
    
    .trading-tabs {
        border-radius: 6px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.03);
        margin-bottom: 16px;
    }
    
    .trading-tabs .tab-btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 40px;
        font-weight: 600;
        touch-action: manipulation;
    }
    
    .form-group label {
        font-size: 12px;
        font-weight: 500;
        margin-bottom: 6px;
        color: rgba(255, 255, 255, 0.8);
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 42px;
        border-radius: 6px;
        touch-action: manipulation;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .form-control:focus {
        border-color: #00d4ff;
        background: rgba(255, 255, 255, 0.08);
    }
    
    .leverage-slider {
        height: 6px;
        touch-action: manipulation;
        border-radius: 3px;
    }
    
    .leverage-display {
        font-size: 18px;
        font-weight: 700;
        padding: 12px;
        background: rgba(0, 212, 255, 0.1);
        border-radius: 6px;
        text-align: center;
        margin: 8px 0;
        border: 1px solid rgba(0, 212, 255, 0.3);
    }
    
    .leverage-presets {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .leverage-preset {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
        min-width: 44px;
        touch-action: manipulation;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        font-weight: 500;
    }
    
    .leverage-preset:hover,
    .leverage-preset.active {
        background: rgba(0, 212, 255, 0.2);
        border-color: #00d4ff;
        color: #00d4ff;
    }
    
    .btn-large {
        padding: 12px 16px;
        font-size: 15px;
        min-height: 48px;
        font-weight: 600;
        touch-action: manipulation;
        border-radius: 8px;
        margin-top: 16px;
    }
    
    .orderbook-header h3 {
        font-size: 16px;
        margin: 0;
    }
    
    .orderbook-controls {
        gap: 4px;
    }
    
    .orderbook-btn {
        min-width: 32px;
        min-height: 32px;
        padding: 6px;
        font-size: 12px;
        touch-action: manipulation;
        border-radius: 4px;
    }
    
    .orderbook-content {
        font-size: 11px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .orderbook-header-row,
    .orderbook-row {
        padding: 8px 6px;
        min-height: 32px;
        display: flex;
        align-items: center;
        font-size: 11px;
    }
    
    .orderbook-spread {
        padding: 8px;
        font-size: 12px;
        font-weight: 600;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 4px;
        margin: 4px 0;
    }
    
    .portfolio-header h3 {
        font-size: 16px;
        margin: 0;
    }
    
    .portfolio-tabs {
        gap: 0;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.03);
        overflow: hidden;
    }
    
    .portfolio-tab {
        flex: 1;
        padding: 10px 8px;
        font-size: 12px;
        font-weight: 500;
        min-height: 40px;
        touch-action: manipulation;
    }
    
    .portfolio-tab.active {
        background: rgba(0, 212, 255, 0.2);
        color: #00d4ff;
    }
    
    .positions-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .balance-info {
        flex-direction: column;
        gap: 0.75rem;
        background: rgba(255, 255, 255, 0.03);
        padding: 1rem;
        border-radius: 8px;
    }
    
    .balance-item {
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .balance-item:last-child {
        border-bottom: none;
    }
}

@media (max-width: 400px) {
    .header .container {
        padding: 0 6px;
    }
    
    .container {
        padding: 0 6px;
    }
    
    .logo {
        width: 20px;
        height: 20px;
    }
    
    #connectWallet {
        font-size: 11px;
        padding: 5px 8px;
        min-height: 32px;
    }
    
    #connectWallet i {
        display: none;
    }
    
    .wallet-info {
        padding: 3px 5px;
        font-size: 9px;
    }
    
    .card {
        padding: 8px;
        margin-bottom: 6px;
        border-radius: 6px;
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }
    
    .market-header h2 {
        font-size: 16px;
    }
    
    .current-price {
        font-size: 20px !important;
    }
    
    .market-stats {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .stat {
        padding: 6px;
        border-radius: 4px;
        background: rgba(255, 255, 255, 0.02);
    }
    
    .stat-label {
        font-size: 9px;
    }
    
    .stat-value {
        font-size: 11px;
    }
    
    .chart-header h3 {
        font-size: 14px;
    }
    
    .timeframe-selector {
        gap: 3px;
        padding: 4px;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .timeframe-btn {
        padding: 6px 8px;
        font-size: 10px;
        min-width: 36px;
        min-height: 28px;
        white-space: nowrap;
        flex-shrink: 0;
        border-radius: 3px;
    }
    
    #chartCanvas {
        width: 100% !important;
        height: 180px !important;
    }
    
    .trading-tabs {
        margin-bottom: 12px;
    }
    
    .trading-tabs .tab-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 36px;
        font-weight: 600;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 11px;
        font-weight: 500;
        margin-bottom: 4px;
    }
    
    .form-control {
        padding: 8px 10px;
        font-size: 13px;
        min-height: 36px;
    }
    
    .leverage-display {
        font-size: 16px;
        font-weight: 600;
        padding: 8px;
        margin: 6px 0;
    }
    
    .leverage-presets {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }
    
    .leverage-preset {
        min-width: 40px;
        padding: 6px 8px;
        font-size: 11px;
        min-height: 28px;
        border-radius: 4px;
    }
    
    .btn-large {
        padding: 10px 12px;
        font-size: 13px;
        min-height: 42px;
        font-weight: 600;
        margin-top: 12px;
    }
    
    .leverage-display {
        font-size: 1.25rem;
        font-weight: 600;
        padding: 0.75rem;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        text-align: center;
        margin: 0.75rem 0;
    }
    
    .leverage-presets {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .leverage-preset {
        min-width: 52px;
        padding: 0.625rem;
        font-size: 0.875rem;
        border-radius: 6px;
    }
    
    .advanced-options {
        background: rgba(255, 255, 255, 0.03);
        padding: 1rem;
        border-radius: 8px;
        margin: 1rem 0;
    }
    
    .btn-large {
        padding: 1rem 0.75rem;
        font-size: 0.95rem;
        min-height: 52px;
        font-weight: 600;
    }
    
    .orderbook-header h3 {
        font-size: 1rem;
    }
    
    .orderbook-controls {
        gap: 0.25rem;
    }
    
    .orderbook-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 0.5rem;
        font-size: 0.8rem;
        touch-action: manipulation;
    }
    
    .orderbook-content {
        font-size: 0.75rem;
    }
    
    .orderbook-header-row,
    .orderbook-row {
        padding: 0.5rem 0.25rem;
        min-height: 36px;
        font-size: 0.75rem;
    }
    
    .orderbook-spread {
        padding: 0.75rem;
        font-size: 0.875rem;
        font-weight: 600;
    }
    
    .portfolio-header h3 {
        font-size: 1rem;
    }
    
    .portfolio-tabs {
        gap: 0;
        border-radius: 8px;
    }
    
    .portfolio-tab {
        flex: 1;
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
        font-weight: 500;
        min-height: 44px;
    }
    
    .balance-label {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.7);
    }
    
    .balance-value {
        font-size: 0.875rem;
        font-weight: 600;
    }
    
    .positions-table,
    .orders-table,
    .history-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .positions-table table,
    .orders-table table,
    .history-table table {
        min-width: 600px;
        font-size: 0.75rem;
    }
    
    .positions-table th,
    .positions-table td,
    .orders-table th,
    .orders-table td,
    .history-table th,
    .history-table td {
        padding: 0.625rem 0.5rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        width: calc(100% - 1rem);
        max-height: calc(100vh - 1rem);
        border-radius: 12px;
    }
    
    .wallet-options {
        gap: 0.75rem;
    }
    
    .wallet-option {
        padding: 1.25rem 1rem;
        border-radius: 10px;
        min-height: 60px;
        touch-action: manipulation;
    }
    
    .wallet-option img {
        width: 28px;
        height: 28px;
    }
    
    .wallet-option span {
        font-size: 0.95rem;
        font-weight: 500;
    }
    
    /* Notification improvements for mobile */
    .notification-container {
        position: fixed;
        top: 70px;
        right: 0.75rem;
        left: 0.75rem;
        z-index: 1001;
    }
    
    .notification {
        border-radius: 10px;
        padding: 1rem;
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    /* Touch improvements */
    .btn, .tab-btn, .timeframe-btn, .leverage-preset, .portfolio-tab, .wallet-option {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }
    
    /* Scrollbar improvements for mobile */
    .orderbook-content::-webkit-scrollbar,
    .positions-table::-webkit-scrollbar,
    .orders-table::-webkit-scrollbar,
    .history-table::-webkit-scrollbar,
    .timeframe-selector::-webkit-scrollbar {
        height: 4px;
        width: 4px;
    }
    
    .orderbook-content::-webkit-scrollbar-thumb,
    .positions-table::-webkit-scrollbar-thumb,
    .orders-table::-webkit-scrollbar-thumb,
    .history-table::-webkit-scrollbar-thumb,
    .timeframe-selector::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
    
    /* Footer mobile improvements */
    .footer {
        margin-top: 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .footer-social {
        justify-content: center;
        gap: 1.5rem;
    }
    
    .social-link {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
    
    /* Additional mobile optimizations for neat appearance */
    .trading-grid {
        gap: 10px;
    }
    
    /* Ensure proper spacing between sections */
    .market-info,
    .chart-container,
    .trading-panel,
    .orderbook,
    .portfolio {
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    /* Improve text readability */
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.2;
    }
    
    /* Better button spacing */
    .btn + .btn {
        margin-left: 4px;
    }
    
    /* Compact form layout */
    .form-group {
        margin-bottom: 10px;
    }
    
    /* Optimize scroll areas */
    .orderbook-content,
    .positions-table,
    .orders-table,
    .history-table {
        border-radius: 4px;
    }
}

/* Ultra small screens (320px and below) */
@media (max-width: 320px) {
    .container {
        padding: 0 4px;
    }
    
    .card {
        padding: 6px;
        margin-bottom: 4px;
        border-radius: 4px;
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }
    
    .current-price {
        font-size: 18px !important;
    }
    
    .chart-header h3,
    .portfolio-header h3,
    .orderbook-header h3 {
        font-size: 13px;
    }
    
    .timeframe-btn {
        min-width: 32px;
        padding: 4px 6px;
        font-size: 9px;
    }
    
    #chartCanvas {
        height: 160px !important;
    }
    
    .btn-large {
        font-size: 12px;
        min-height: 38px;
        padding: 8px 10px;
    }
    
    .positions-table table,
    .orders-table table,
    .history-table table {
        min-width: 400px;
        font-size: 8px;
    }
}