/* styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9fc;
    color: #1e293b;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR STYLES */
.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.02);
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .logo-area span,
.sidebar.collapsed .sidebar-nav ul li span {
    display: none;
}

.sidebar.collapsed .sidebar-nav ul li i {
    margin-right: 0;
    font-size: 1.3rem;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.2rem;
    color: #2563eb;
}

.logo-area i {
    font-size: 1.4rem;
}

.collapse-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    font-size: 1rem;
    transition: 0.2s;
    padding: 6px;
    border-radius: 8px;
}

.collapse-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
}

.sidebar-nav ul {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    margin-bottom: 6px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #475569;
    font-weight: 500;
}

.nav-item i {
    width: 22px;
    font-size: 1.2rem;
}

.nav-item:hover {
    background: #f1f5f9;
    color: #2563eb;
    transform: translateX(2px);
}

.nav-item.active {
    background: #eef2ff;
    color: #2563eb;
}

/* MAIN WRAPPER */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    transition: margin-left 0.3s;
    padding: 20px 24px;
}

.sidebar.collapsed + .main-wrapper {
    margin-left: 80px;
}

/* TOP HEADER */
.top-header {
    background: white;
    border-radius: 20px;
    padding: 16px 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #eef2f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.mobile-menu-icon {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #1e293b;
}

.account-info {
    display: flex;
    gap: 32px;
    align-items: baseline;
    flex-wrap: wrap;
}

.user-greeting {
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    font-size: 0.9rem;
    color: #475569;
}

.stat-item span {
    font-weight: 700;
    color: #0f172a;
}

.profit-loss {
    font-weight: 700;
}

.profit-positive {
    color: #10b981;
}

.profit-negative {
    color: #ef4444;
}

/* Margin Metrics in Top Header */
.margin-metrics {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8fafc;
    padding: 8px 20px;
    border-radius: 40px;
    border: 1px solid #eef2f6;
}

.metric-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.metric-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

.metric-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.metric-divider {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
}

/* Responsive */
@media (max-width: 1024px) {
    .margin-metrics {
        margin-top: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .metric-divider {
        display: none;
    }
    
    .metric-item {
        background: white;
        padding: 6px 12px;
        border-radius: 20px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
}

@media (max-width: 768px) {
    .top-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .margin-metrics {
        justify-content: space-between;
    }
    
    .metric-item {
        flex: 1;
        justify-content: center;
    }
}

/* Admin edited trade badge */
.trade-edited-badge {
    background: #f59e0b;
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    display: inline-block;
}

/* CONTENT PANELS */
.content-panels {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.center-col {
    flex: 2;
    min-width: 0;
}

.right-panel {
    width: 340px;
}
/* Asset Categories */
.asset-categories {
    display: flex;
    gap: 8px;
    margin-right: 16px;
    padding-right: 16px;
    border-right: 1px solid #eef2f6;
}

.category-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
}

.category-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.category-btn.active {
    background: #2563eb;
    color: white;
}

/* Different colors for different asset types in market watch */
.market-item.forex .symbol-name { color: #2563eb; }
.market-item.commodities .symbol-name { color: #f59e0b; }
.market-item.indices .symbol-name { color: #10b981; }
.market-item.stocks .symbol-name { color: #8b5cf6; }
.market-item.crypto .symbol-name { color: #ef4444; }

/* Responsive */
@media (max-width: 768px) {
    .asset-categories {
        order: -1;
        width: 100%;
        overflow-x: auto;
        border-right: none;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid #eef2f6;
    }
    
    .category-btn {
        white-space: nowrap;
    }
}
/* CHART CARD */
.chart-card {
    background: white;
    border-radius: 24px;
    border: 1px solid #eef2f6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    margin-bottom: 24px;
    overflow: hidden;
}

.chart-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eef2f6;
    background: #fafcff;
}

.chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}

.timeframes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tf-btn, .draw-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    color: #334155;
}

.tf-btn.active, .tf-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.draw-btn {
    padding: 6px 12px;
}

.draw-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.draw-btn:hover {
    background: #e2e8f0;
}

.indicator-selector {
    display: flex;
    gap: 12px;
}

.indicator-selector select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    background: #f8fafc;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

.sl-tp-buttons {
    display: flex;
    gap: 12px;
}

.sl-btn, .tp-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.sl-btn {
    background: #fee2e2;
    color: #dc2626;
}

.sl-btn.active {
    background: #dc2626;
    color: white;
}

.tp-btn {
    background: #dcfce7;
    color: #16a34a;
}

.tp-btn.active {
    background: #16a34a;
    color: white;
}

.chart-container {
    position: relative;
    padding: 20px;
    background: #ffffff;
    cursor: crosshair;
}

#advancedChart {
    width: 100%;
    height: auto;
    background: #ffffff;
    border-radius: 12px;
    cursor: crosshair;
}

.chart-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
}

.chart-footer {
    padding: 12px 20px;
    border-top: 1px solid #eef2f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.price-info {
    display: flex;
    gap: 20px;
}

.price-info span {
    font-weight: 600;
    color: #1e293b;
}

.zoom-controls {
    display: flex;
    gap: 8px;
}

.zoom-controls button {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.zoom-controls button:hover {
    background: #e2e8f0;
}

/* MARKET WATCH */
.market-watch-card {
    background: white;
    border-radius: 20px;
    border: 1px solid #eef2f6;
    padding: 16px 0;
}

.card-title {
    padding: 0 16px 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid #eef2f6;
    margin-bottom: 8px;
}

.market-list {
    max-height: 280px;
    overflow-y: auto;
}

.market-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f1f5f9;
}

.market-item:hover, .market-item.selected {
    background: #f8fafc;
}

.symbol-name {
    font-weight: 600;
}

.bid-ask {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
}

.change-positive {
    color: #10b981;
}

.change-negative {
    color: #ef4444;
}

/* styles.css - Add these new styles to existing ones */
.symbol-info {
    display: flex;
    align-items: baseline;
    gap: 15px;
    background: #f8fafc;
    padding: 8px 16px;
    border-radius: 12px;
    margin-right: 10px;
}

.symbol-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.live-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2563eb;
}

.price-change {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

.price-change.positive {
    color: #10b981;
    background: #dcfce7;
}

.price-change.negative {
    color: #ef4444;
    background: #fee2e2;
}

.market-item {
    transition: all 0.2s;
}

.market-item.selected {
    background: #eef2ff;
    border-left: 3px solid #2563eb;
}

.bid-price {
    font-weight: 600;
    color: #1e293b;
}

.ask-price {
    color: #64748b;
}

.spread {
    font-size: 0.7rem;
    color: #94a3b8;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 1000;
}

.connection-status.connected {
    background: #dcfce7;
    color: #16a34a;
}

.connection-status.disconnected {
    background: #fee2e2;
    color: #dc2626;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.updating {
    animation: pulse 0.5s ease-in-out;
}

/* ORDER PANEL */
.order-card {
    background: white;
    border-radius: 24px;
    border: 1px solid #eef2f6;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.order-card h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.order-field {
    margin-bottom: 16px;
}

.order-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: #475569;
}

.order-field select, .order-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    transition: 0.2s;
}

.order-buttons {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.sell-btn, .buy-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sell-btn {
    background: #fee2e2;
    color: #dc2626;
}

.buy-btn {
    background: #dcfce7;
    color: #16a34a;
}

.margin-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #eef2f6;
    font-size: 0.85rem;
    display: grid;
    gap: 8px;
}

/* BOTTOM PANEL */
.bottom-panel {
    background: white;
    border-radius: 24px;
    border: 1px solid #eef2f6;
    overflow: hidden;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid #eef2f6;
    background: #fefefe;
    padding: 0 20px;
}

.tab-btn {
    padding: 14px 24px;
    background: transparent;
    border: none;
    font-weight: 600;
    cursor: pointer;
    color: #64748b;
    transition: 0.2s;
}

.tab-btn.active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.table-responsive {
    overflow-x: auto;
}

.trades-table {
    width: 100%;
    border-collapse: collapse;
}

.trades-table th, .trades-table td {
    padding: 12px 12px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

/* MOBILE DRAWER */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 1001;
    transition: left 0.3s;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.mobile-drawer.open {
    left: 0;
}

.drawer-header {
    padding: 24px 20px;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: #2563eb;
}

.close-drawer {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
}

.drawer-nav {
    list-style: none;
    padding: 20px;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .content-panels {
        flex-direction: column;
    }
    .right-panel {
        width: 100%;
    }
    .sidebar {
        display: none;
    }
    .main-wrapper {
        margin-left: 0 !important;
        padding: 16px;
    }
    .mobile-menu-icon {
        display: block;
    }
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .timeframes {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

@media (max-width: 768px) {
    .account-info {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .price-info {
        flex-wrap: wrap;
        gap: 12px;
    }
}