* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0e17;
    color: #e0e6f0;
    overflow-x: hidden;
}

/* ===== AUTH / LOGIN PAGE ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0e17 0%, #1a2332 50%, #0f1923 100%);
    padding: 20px;
}

.auth-box {
    background: linear-gradient(135deg, #1a2332, #0f1923);
    border: 1px solid #1e2d45;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.8rem;
    font-weight: 700;
    color: #00d4aa;
    margin-bottom: 5px;
}

.auth-logo i {
    font-size: 2rem;
}

.auth-subtitle {
    text-align: center;
    color: #667788;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: #0f1923;
    border-radius: 10px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #667788;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-tab.active {
    background: #00d4aa;
    color: #0a0e17;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-form .form-group label {
    display: block;
    font-size: 0.8rem;
    color: #667788;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-form .form-group input {
    width: 100%;
    padding: 12px 14px;
    background: #0f1923;
    border: 1px solid #1e2d45;
    border-radius: 10px;
    color: #e0e6f0;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.auth-form .form-group input:focus {
    border-color: #00d4aa;
}

.btn-auth {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    border: none;
    border-radius: 10px;
    color: #0a0e17;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 170, 0.3);
}

.auth-note {
    text-align: center;
    color: #445566;
    font-size: 0.8rem;
    margin-top: 15px;
}

.auth-error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid #ff4757;
    color: #ff4757;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 15px;
}

/* ===== NAVIGATION ===== */
.navbar {
    background: linear-gradient(135deg, #0f1923 0%, #1a2332 100%);
    border-bottom: 1px solid #1e2d45;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #00d4aa;
}

.logo i {
    font-size: 1.6rem;
}

.pro {
    color: #ff6b35;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: #8899aa;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s;
    padding: 5px 0;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
    color: #00d4aa;
    border-bottom-color: #00d4aa;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8899aa;
    font-size: 0.85rem;
}

.user-info i {
    font-size: 1.2rem;
    color: #00d4aa;
}

.balance-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.balance-label {
    font-size: 0.7rem;
    color: #667788;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: #00d4aa;
}

.btn-deposit {
    background: linear-gradient(135deg, #00d4aa, #00b894);
    border: none;
    color: #0a0e17;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 0.85rem;
}

.btn-deposit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.3);
}

.btn-logout {
    background: transparent;
    border: 1px solid #ff4757;
    color: #ff4757;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-logout:hover {
    background: #ff4757;
    color: #fff;
}

/* ===== DEPOSIT MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #1a2332, #0f1923);
    border: 1px solid #1e2d45;
    border-radius: 20px;
    padding: 35px;
    width: 100%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    color: #667788;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #ff4757;
}

.modal-content h3 {
    font-size: 1.3rem;
    color: #e0e6f0;
    margin-bottom: 8px;
}

.modal-content h3 i {
    color: #ffd700;
    margin-right: 8px;
}

.modal-desc {
    color: #667788;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.deposit-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.deposit-option {
    padding: 10px;
    background: #0f1923;
    border: 1px solid #1e2d45;
    border-radius: 8px;
    color: #e0e6f0;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.deposit-option:hover {
    border-color: #00d4aa;
    background: rgba(0, 212, 170, 0.1);
}

/* ===== MAIN LAYOUT ===== */
.main-container {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
}

.portfolio-summary {
    background: linear-gradient(135deg, #1a2332, #0f1923);
    border: 1px solid #1e2d45;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.portfolio-summary h3 {
    font-size: 0.8rem;
    color: #667788;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.portfolio-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
}

.portfolio-change {
    font-size: 0.9rem;
    font-weight: 500;
}

.portfolio-change.positive { color: #00d4aa; }
.portfolio-change.negative { color: #ff4757; }

.holdings-list {
    background: #1a2332;
    border: 1px solid #1e2d45;
    border-radius: 12px;
    padding: 20px;
}

.holdings-list h3 {
    font-size: 0.8rem;
    color: #667788;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.holding-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #1e2d45;
}

.holding-item:last-child {
    border-bottom: none;
}

.holding-name {
    font-weight: 600;
    color: #e0e6f0;
}

.holding-qty {
    font-size: 0.8rem;
    color: #667788;
}

.holding-value {
    font-weight: 600;
    color: #00d4aa;
}

.holding-empty {
    color: #667788;
    font-size: 0.85rem;
    font-style: italic;
}

.trading-area {
    flex: 1;
    min-width: 0;
}

.market-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.market-card {
    background: linear-gradient(135deg, #1a2332, #0f1923);
    border: 1px solid #1e2d45;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.market-card:hover {
    transform: translateY(-2px);
    border-color: #00d4aa;
}

.market-card.active {
    border-color: #00d4aa;
    box-shadow: 0 0 20px rgba(0, 212, 170, 0.1);
}

.market-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.market-name {
    font-size: 0.85rem;
    color: #667788;
    font-weight: 500;
}

.market-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.market-change {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: right;
}

.market-change.positive { color: #00d4aa; }
.market-change.negative { color: #ff4757; }

.chart-container {
    background: #1a2332;
    border: 1px solid #1e2d45;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header h2 {
    font-size: 1.1rem;
    color: #e0e6f0;
}

.chart-timeframes {
    display: flex;
    gap: 5px;
}

.tf-btn {
    background: transparent;
    border: 1px solid #1e2d45;
    color: #667788;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.tf-btn:hover,
.tf-btn.active {
    background: #00d4aa;
    border-color: #00d4aa;
    color: #0a0e17;
}

#priceChart {
    width: 100%;
    height: 350px;
}

.trading-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.trade-form,
.ai-panel {
    background: #1a2332;
    border: 1px solid #1e2d45;
    border-radius: 12px;
    padding: 20px;
}

.trade-form h3,
.ai-panel h3 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #e0e6f0;
}

.ai-panel h3 i {
    color: #ff6b35;
    margin-right: 8px;
}

.trade-type {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.trade-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #1e2d45;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.trade-btn.buy { color: #00d4aa; }
.trade-btn.buy.active { background: #00d4aa; border-color: #00d4aa; color: #0a0e17; }
.trade-btn.sell { color: #ff4757; }
.trade-btn.sell.active { background: #ff4757; border-color: #ff4757; color: #fff; }

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: #667788;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 10px 12px;
    background: #0f1923;
    border: 1px solid #1e2d45;
    border-radius: 8px;
    color: #e0e6f0;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group select:focus,
.form-group input:focus {
    border-color: #00d4aa;
}

.form-group input[readonly] {
    color: #667788;
    cursor: not-allowed;
}

.btn-execute {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    border: none;
    border-radius: 8px;
    color: #0a0e17;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 5px;
}

.btn-execute:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.3);
}

.ai-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.status-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.status-indicator.active { background: rgba(0, 212, 170, 0.15); color: #00d4aa; }
.status-indicator.inactive { background: rgba(102, 119, 136, 0.15); color: #667788; }

.btn-ai-toggle {
    background: transparent;
    border: 1px solid #ff6b35;
    color: #ff6b35;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-ai-toggle:hover,
.btn-ai-toggle.active {
    background: #ff6b35;
    color: #fff;
}

.ai-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.ai-stat {
    text-align: center;
    padding: 10px;
    background: #0f1923;
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #667788;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: #e0e6f0;
}

.ai-log {
    background: #0f1923;
    border-radius: 8px;
    padding: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.log-entry {
    font-size: 0.8rem;
    padding: 4px 0;
    border-bottom: 1px solid #1e2d45;
}

.log-entry:last-child { border-bottom: none; }
.log-entry.buy { color: #00d4aa; }
.log-entry.sell { color: #ff4757; }
.log-entry.profit { color: #00d4aa; }
.log-entry.loss { color: #ff4757; }
.log-entry.info { color: #667788; }

.history-section {
    background: #1a2332;
    border: 1px solid #1e2d45;
    border-radius: 12px;
    padding: 20px;
}

.history-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: #e0e6f0;
}

.history-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.75rem;
    color: #667788;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #1e2d45;
}

td {
    padding: 10px 12px;
    font-size: 0.85rem;
    border-bottom: 1px solid #1e2d45;
}

td.type-buy { color: #00d4aa; }
td.type-sell { color: #ff4757; }
td.profit { color: #00d4aa; }
td.loss { color: #ff4757; }

.no-history {
    text-align: center;
    color: #667788;
    font-style: italic;
    padding: 30px !important;
}

/* Custom Alert */
.custom-alert {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.custom-alert.show { transform: translateX(0); }

.custom-alert.success {
    background: linear-gradient(135deg, #00b894, #00d4aa);
    color: #0a0e17;
    border: 1px solid #00d4aa;
}

.custom-alert.error {
    background: linear-gradient(135deg, #e84118, #ff4757);
    color: #fff;
    border: 1px solid #ff4757;
}

.custom-alert i { font-size: 1.2rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f1923; }
::-webkit-scrollbar-thumb { background: #1e2d45; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2a3d5a; }

/* ===== RESPONSIVE - TABLETS (max 1024px) ===== */
@media (max-width: 1024px) {
    .nav-links { gap: 15px; }
    .nav-links a { font-size: 0.8rem; }
    .nav-right { gap: 10px; }
    .balance-amount { font-size: 0.95rem; }
    .user-info span { display: none; }
    .market-overview { grid-template-columns: repeat(2, 1fr); }
    .trading-panel { grid-template-columns: 1fr; }
    .sidebar { width: 240px; }
    .portfolio-value { font-size: 1.5rem; }
}

/* ===== RESPONSIVE - MOBILE (max 768px) ===== */
@media (max-width: 768px) {
    /* Auth */
    .auth-box { padding: 25px 20px; }
    .auth-logo { font-size: 1.5rem; }
    
    /* Navbar */
    .nav-container { height: 56px; padding: 0 10px; }
    .logo { font-size: 1.1rem; }
    .logo i { font-size: 1.3rem; }
    .nav-links { 
        display: none; 
        position: absolute;
        top: 56px;
        left: 0;
        width: 100%;
        background: #0f1923;
        flex-direction: column;
        gap: 0;
        border-bottom: 1px solid #1e2d45;
        z-index: 999;
    }
    .nav-links.show { display: flex; }
    .nav-links a { 
        padding: 14px 20px; 
        border-bottom: 1px solid #1e2d45;
        border-bottom-color: transparent;
    }
    .nav-links a:hover,
    .nav-links a.active { border-bottom-color: #00d4aa; }
    .nav-right { gap: 8px; }
    .user-info span { display: none; }
    .balance-display { display: none; }
    .btn-deposit { padding: 6px 12px; font-size: 0.75rem; }
    .btn-logout { padding: 6px 10px; font-size: 0.8rem; }
    
    /* Hamburger Menu */
    .hamburger {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
        padding: 5px;
        background: transparent;
        border: none;
    }
    .hamburger span {
        width: 22px;
        height: 2px;
        background: #8899aa;
        border-radius: 2px;
        transition: all 0.3s;
    }
    .hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
    .hamburger.active span:nth-child(2) { opacity: 0; }
    .hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }
    
    /* Main Layout */
    .main-container { 
        flex-direction: column; 
        padding: 10px;
        gap: 10px;
    }
    .sidebar { width: 100%; }
    .portfolio-summary { padding: 15px; }
    .portfolio-value { font-size: 1.4rem; }
    .holdings-list { padding: 15px; }
    
    /* Market Cards */
    .market-overview { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 8px;
    }
    .market-card { padding: 10px; }
    .market-price { font-size: 0.95rem; }
    .market-name { font-size: 0.75rem; }
    .market-change { font-size: 0.8rem; }
    
    /* Chart */
    .chart-container { padding: 12px; }
    .chart-header { flex-direction: column; gap: 10px; align-items: flex-start; }
    .chart-header h2 { font-size: 0.95rem; }
    #priceChart { height: 220px; }
    
    /* Trading Panel */
    .trading-panel { grid-template-columns: 1fr; gap: 10px; }
    .trade-form, .ai-panel { padding: 15px; }
    .trade-form h3, .ai-panel h3 { font-size: 0.9rem; }
    .trade-btn { padding: 8px; font-size: 0.8rem; }
    .form-group select, .form-group input { padding: 8px 10px; font-size: 0.85rem; }
    .btn-execute { padding: 10px; font-size: 0.9rem; }
    
    /* AI Panel */
    .ai-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .ai-stat { padding: 8px; }
    .stat-value { font-size: 0.85rem; }
    .ai-log { max-height: 100px; }
    
    /* History */
    .history-section { padding: 12px; overflow-x: auto; }
    .history-section h3 { font-size: 0.9rem; }
    th, td { padding: 8px 6px; font-size: 0.75rem; white-space: nowrap; }
    
    /* Modal */
    .modal-content { 
        margin: 10px; 
        padding: 20px; 
        max-width: 100%;
    }
    .deposit-options { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .deposit-option { padding: 8px; font-size: 0.8rem; }
    
    /* Alert */
    .custom-alert { 
        top: 70px; 
        right: 10px; 
        left: 10px;
        max-width: none;
        font-size: 0.8rem;
        padding: 12px 15px;
    }
}

/* ===== RESPONSIVE - SMALL MOBILE (max 480px) ===== */
@media (max-width: 480px) {
    .auth-box { padding: 20px 15px; }
    .auth-logo { font-size: 1.3rem; }
    .auth-logo i { font-size: 1.5rem; }
    .auth-tab { font-size: 0.8rem; padding: 8px; }
    .auth-form .form-group input { padding: 10px; font-size: 0.85rem; }
    .btn-auth { padding: 12px; font-size: 0.9rem; }
    
    .market-overview { grid-template-columns: 1fr 1fr; gap: 6px; }
    .market-card { padding: 8px; }
    .market-price { font-size: 0.85rem; }
    
    #priceChart { height: 180px; }
    
    .ai-stats { grid-template-columns: repeat(3, 1fr); gap: 4px; }
    .ai-stat { padding: 6px; }
    .stat-label { font-size: 0.6rem; }
    .stat-value { font-size: 0.8rem; }
    
    .modal-content { padding: 15px; }
    .modal-content h3 { font-size: 1.1rem; }
    
    .portfolio-value { font-size: 1.2rem; }
    .portfolio-change { font-size: 0.8rem; }
}
