body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f7f6; /* Lighter background */
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px; /* Wider container */
    margin: 20px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #0056b3;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.2rem;
}

h2 {
    color: #007bff;
    font-size: 1.6rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

h3 {
    color: #555;
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: flex-end;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #e9f0f8; /* Light blueish background */
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    flex: 1;
}

label {
    margin-bottom: 6px;
    font-weight: bold;
    color: #555;
    font-size: 0.95rem;
}

input[type="month"],
input[type="number"],
select {
    padding: 10px 12px;
    border: 1px solid #cce0ff; /* Lighter blue border */
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    background-color: #f8fcff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="month"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    outline: none;
}

button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0; /* Prevent button from shrinking */
}

button:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Main Layout for Chart and Trading Panel */
.main-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.chart-panel {
    flex: 3; /* Takes more space */
    min-width: 400px;
    background-color: #fcfcfc;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

#chart-wrapper {
    height: 400px;
    width: 100%;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 15px;
}

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

#current-date-display {
    font-weight: bold;
    color: #007bff;
    font-size: 1.1rem;
}

.trading-panel {
    flex: 1; /* Takes remaining space */
    min-width: 280px;
    background-color: #fcfcfc;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.current-price-info {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    padding: 10px;
    background-color: #e0f2f7; /* Light cyan */
    border-radius: 5px;
}

.buy-sell-section {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.buy-sell-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.input-group {
    margin-bottom: 15px;
}

.buy-sell-section button {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
}

#buy-btn {
    background-color: #28a745; /* Green for buy */
}
#buy-btn:hover:not(:disabled) {
    background-color: #218838;
}

#sell-btn {
    background-color: #dc3545; /* Red for sell */
}
#sell-btn:hover:not(:disabled) {
    background-color: #c82333;
}

#sell-all-btn {
    background-color: #6c757d; /* Grey for sell all */
    font-size: 0.9rem;
    padding: 8px 15px;
    width: auto;
    margin-left: 10px;
    margin-top: 0;
}
#sell-all-btn:hover:not(:disabled) {
    background-color: #5a6268;
}


/* Portfolio and History Layout */
.portfolio-and-history {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.portfolio-summary, .trade-history {
    flex: 1;
    min-width: 350px;
    background-color: #fcfcfc;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.portfolio-summary p {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.portfolio-summary p span {
    font-weight: bold;
    color: #000;
}

.portfolio-summary p.positive {
    color: #28a745; /* Green for positive */
}
.portfolio-summary p.negative {
    color: #dc3545; /* Red for negative */
}

.trade-history ul {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #fdfdfd;
}

.trade-history li {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trade-history li:last-child {
    border-bottom: none;
}

.trade-history li.buy {
    color: #28a745;
    background-color: #e6ffed;
}

.trade-history li.sell {
    color: #dc3545;
    background-color: #ffe6e8;
}

.trade-history li span {
    font-weight: bold;
}

@media (max-width: 768px) {
    .main-layout, .portfolio-and-history, .controls {
        flex-direction: column;
    }

    .chart-panel, .trading-panel, .portfolio-summary, .trade-history, .control-group {
        min-width: unset;
        width: 100%;
    }

    button {
        width: 100%;
    }

    #sell-all-btn {
        margin-left: 0;
        margin-top: 10px;
    }
}