/* ===== RESET & BASE STYLING ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: Arial, sans-serif;
    background-color: #0e1117;
    color: #fff;
    line-height: 1.5;
}

/* ===== HEADER ===== */
.header {
    background-color: #161b22;
    padding: 1rem 2rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1.5rem;
    border-bottom: 1px solid #30363d;
    position: relative;
    z-index: 100;
}
.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #58a6ff;
}
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}
.main-nav a {
    text-decoration: none;
    color: #c9d1d9;
}
.main-nav a:hover {
    color: #58a6ff;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 70px);
    width: 100%;
}

/* ===== SIDEBAR ===== */
.sidebar {
    background-color: #090a0a;
    width: 220px;
    padding: 2rem 1rem;
    border-right: 1px solid #090a0a;
}
.sidebar ul {
    list-style: none;
}
.sidebar li {
    padding: 0.8rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    color: #c9d1d9;
}
.sidebar li.active,
.sidebar li:hover {
    background-color: #090a0a;
    color: #58a6ff;
}

/* ===== CONTENT AREA ===== */
.content {
    flex: 1;
    width: 100%;
    padding: 2rem;
}

/* ===== CARD COMPONENT ===== */
.card {
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #30363d;
    background-color: #161b22;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.card h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #58a6ff;
    border-bottom: 1px solid #30363d;
    padding-bottom: 8px;
}

/* ===== TABLE STYLING ===== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #30363d;
}
thead {
    background-color: #090a0a;
    color: #58a6ff;
    font-weight: 600;
}
tbody tr:hover {
    background-color: #21262d;
}

/* ===== TOP WINNERS & LOSERS ===== */
#top-winners td:nth-child(3) {
    color: #4ade80;
    font-weight: 700;
}
#top-losers h2 {
    color: #ef6464;
}
#top-losers td:nth-child(3) {
    color: #ef6464;
    font-weight: 700;
}
#top-winners-body .index-card,
#top-losers-body .index-card {
    background-color: #161b22;   /* same as market overview */
    border: 1px solid #30363d;   /* visible border */
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
    flex: 1;
    text-align: center;
}

#top-winners-body .index-card:hover,
#top-losers-body .index-card:hover {
    border-color: #58a6ff;
    box-shadow: 0 4px 12px rgba(88,166,255,0.4);
    transform: translateY(-3px);
}

/* ===== TRADE BUTTON ===== */
.trade-btn {
    padding: 4px 10px;
    border-radius: 6px;
    background-color: #58a6ff;
    color: #0e1117;
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.trade-btn:hover {
    background-color: #1f83ff;
}

/* ===== MARKET OVERVIEW SECTION ===== */
.market-overview {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0;
}

/* Each market container box */
.market-container {
    flex: 1;
    background-color: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover effect */
.market-container:hover {
    border-color: #58a6ff;
    box-shadow: 0 4px 12px rgba(88,166,255,0.4);
    transform: translateY(-3px);
}

/* Inside card styling */
.index-card {
    text-align: center;
    transition: transform 0.2s;
}
.index-card:hover {
    transform: translateY(-2px);
}
.index-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #c9d1d9;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.index-card .price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
}
.index-card .change {
    font-size: 1rem;
    font-weight: 600;
}
.change.positive {
    color: #4ade80;
}
.change.negative {
    color: #ef6464;
}

/* ===== CHART STYLING ===== */
#chartCanvas {
    width: 100%;
    height: 300px;
    background-color: #2a2a3e;
    border-radius: 10px;
    margin-top: 15px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .market-overview {
        flex-direction: column;
    }
    .market-container {
        width: 100%;
    }

    .main-nav ul {
        display: none;
    }
}

/* ===== DASHBOARD BALANCE SECTION ===== */
.dashboard-balance {
    background-color: #1e293b; /* dark card background */
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    max-width: 400px;
    margin: 20px auto;
    text-align: center;
    transition: all 0.3s ease;
}

.dashboard-balance h2 {
    margin: 0 0 10px;
    font-size: 1.3rem;
    color: #e5e7eb;
}

.dashboard-balance p#balance {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 10px 0 15px;
    color: #22c55e; /* green for positive balance */
}

.funds-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.funds-controls input[type="number"] {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    outline: none;
    width: 130px;
    font-size: 1rem;
    background-color: #0f172a;
    color: #e5e7eb;
}

.funds-controls input[type="number"]::placeholder {
    color: #94a3b8;
}

.funds-controls .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
}

.funds-controls .btn.add {
    background-color: #22c55e; /* green */
}

.funds-controls .btn.add:hover {
    background-color: #16a34a;
}

.funds-controls .btn.remove {
    background-color: #ef4444; /* red */
}

.funds-controls .btn.remove:hover {
    background-color: #dc2626;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .dashboard-balance {
        padding: 15px 20px;
    }
    .funds-controls {
        flex-direction: column;
    }
    .funds-controls input[type="number"], 
    .funds-controls .btn {
        width: 100%;
    }
}