:root {
    --bg-color: #f4f7f6;
    --container-bg-color: #fff;
    --text-color: #333;
    --secondary-text-color: #555;
    --card-bg-color: #f9f9f9;
    --card-border-color: #eee;
    --profit-color-positive: #28a745;
    --profit-color-negative: #ff6b6b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --container-bg-color: #2b2b2b;
        --text-color: #e0e0e0;
        --secondary-text-color: #aaa;
        --card-bg-color: #333;
        --card-border-color: #444;
        --profit-color-negative: #e57373;
    }

    #profit-after-fees[style*="color: red"] {
        color: #ff5555 !important;
    }

    .performance-table a:hover {
        color: #8cc2ff;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    background-color: var(--container-bg-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1200px;
    text-align: center;
}

h1 {
    color: var(--text-color);
    margin-bottom: 30px;
}

h2 {
    color: var(--text-color);
}

h3 {
    color: var(--secondary-text-color);
    margin-bottom: 30px;
}

span {
    color: var(--secondary-text-color);
    font-size: 0.8em;
    margin-bottom: 20px;
}

.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.card {
    background-color: var(--card-bg-color);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--card-border-color);
}

.card h2 {
    font-size: 1.1em;
    color: var(--secondary-text-color);
    margin-top: 0;
    margin-bottom: 10px;
}

.card p {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-color);
    margin: 0;
}

#profit-after-fees {
    color: var(--profit-color-positive);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.grid .card {
    padding: 15px;
}

.grid .card h4 {
    font-size: 0.8em;
    color: var(--secondary-text-color);
    margin-top: 0;
    margin-bottom: 8px;
    font-weight: normal;
}

.grid .card p {
    font-size: 1.1em;
    font-weight: bold;
    margin: 0;
}

.grid .card .win-rate {
    font-size: 0.8em;
    font-weight: normal;
    color: var(--secondary-text-color);
    margin-top: 4px;
}

.chart-container {
    margin-top: 40px;
    height: 500px;
    position: relative;
    padding-bottom: 40px;
    margin-bottom: 20px;
}

.stats-container {
    margin-top: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stats-grid .card h4 {
    font-size: 0.9em;
    color: var(--secondary-text-color);
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: normal;
}

.stats-grid .card p {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--text-color);
    margin: 0;
}

#upload-area {
    cursor: pointer;
    border: 2px dashed var(--card-border-color);
    text-align: center;
    padding: 40px;
    margin-bottom: 30px;
    transition: background-color 0.2s, border-color 0.2s;
}

#upload-area:hover {
    background-color: var(--bg-color);
    border-color: var(--secondary-text-color);
}

#upload-area.dragging {
    border-color: var(--profit-color-positive);
    background-color: rgba(40, 167, 69, 0.1);
}

#upload-area h2 {
    margin-top: 0;
}

#upload-area p {
    font-size: 1.1em;
    color: var(--secondary-text-color);
}

#upload-area h3 {
    font-size: 0.9em;
    font-weight: normal;
    color: var(--secondary-text-color);
    margin-bottom: 20px;
}

#upload-area a {
    color: #58a6ff;
    text-decoration: none;
    transition: color 0.2s;
}

#upload-area a:hover {
    color: #8cc2ff;
    text-decoration: underline;
}

.disclaimer {
    margin-top: 30px;
    font-size: 0.9em;
    color: var(--secondary-text-color);
    font-style: italic;
}


.home {
    position: absolute;
    top: 20px;
    left: 20px;
}

.home a {
    text-decoration: none;
    color: #bb86fc;
    font-size: 1.2rem;
    padding: 0.5rem 0.5rem;
    border: 1px solid #bb86fc;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.home a:hover {
    background-color: #bb86fc;
    color: #121212;
}

.centered-subheading {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    color: var(--text-color);
}

.performance-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.performance-category {
    flex: 1;
    background-color: var(--card-bg-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.performance-category h4 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text-color);
}

.table-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 15px;
}

.table-container > div {
    flex: 1;
    border: 1px solid var(--card-border-color);
    border-radius: 6px;
    padding: 10px;
}

.table-container > div > h5 {
    font-weight: bold;
    color: var(--secondary-text-color);
    text-align: center;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
}

.performance-table th, .performance-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--card-border-color);
    font-size: 0.8em;
}

.performance-table tr:last-child td {
    border-bottom: none;
}

.performance-table th {
    font-weight: bold;
    color: var(--secondary-text-color);
}

.performance-table td:last-child {
    text-align: right;
    font-weight: bold;
    white-space: nowrap;
}

.performance-table a {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.2s;
}

.performance-table a:hover {
    text-decoration: underline;
    color: #8cc2ff;
}

.latest-trade-info {
    margin-top: 10px;
    margin-bottom: 20px;
    text-align: center;
}

#latest-trade-date {
    font-size: 0.9em;
    font-weight: normal;
    color: var(--secondary-text-color);
    margin: 0;
}

.small-text {
    font-size: 0.8em;
    font-weight: normal;
    color: var(--secondary-text-color);
    margin-top: 4px;
}

.filter-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#ticker-filter {
    padding: 8px 12px;
    border: 1px solid var(--card-border-color);
    border-radius: 6px;
    background-color: var(--card-bg-color);
    color: var(--text-color);
    font-size: 1em;
}

#filter-button, #reset-button, #add-filter-button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background-color: var(--profit-color-positive);
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
}

#reset-button {
    background-color: var(--secondary-text-color);
}

#filter-button:hover, #reset-button:hover, #add-filter-button:hover {
    opacity: 0.9;
}

.active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.filter-tag {
    background-color: var(--card-bg-color);
    border: 1px solid var(--card-border-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    font-size: 0.9em;
}

.filter-tag .remove-filter {
    margin-left: 8px;
    cursor: pointer;
    color: var(--secondary-text-color);
    font-weight: bold;
    line-height: 1;
}

.filter-tag .remove-filter:hover {
    color: var(--profit-color-negative);
}
