* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Light mode colors */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #888888;
    --border-color: #e9ecef;
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --input-border: #ddd;
    --error-bg: #fee;
    --error-text: #c33;
}

[data-theme="dark"] {
    /* Dark mode colors */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #383838;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --border-color: #404040;
    --shadow-light: rgba(0, 0, 0, 0.2);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --input-border: #555;
    --error-bg: #3d1414;
    --error-text: #ff6b6b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 10px var(--shadow-medium);
}

.theme-icon {
    font-size: 1.2rem;
}

.search-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-medium);
    margin-bottom: 20px;
}

.ownership-query {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.query-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.ownership-input {
    width: 200px;
    padding: 12px 20px;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    border: 2px solid var(--input-border);
    border-radius: 4px;
    transition: border-color 0.3s;
    text-transform: uppercase;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.ownership-input:focus {
    outline: none;
    border-color: #007bff;
}

.fund-filters {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.fund-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
}

.fund-checkbox input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.fund-checkbox span {
    font-weight: 500;
}

.results-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.results {
    display: grid;
    gap: 15px;
}

.holding-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-light);
    transition: box-shadow 0.3s;
    border: 1px solid var(--border-color);
}

.holding-card:hover {
    box-shadow: 0 4px 15px var(--shadow-medium);
}

/* Comparison card styles */
.holding-card.comparison {
    padding: 0;
    overflow: hidden;
}

.comparison-header {
    padding: 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.comparison-header .holding-ticker {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.comparison-header .holding-name {
    font-size: 1rem;
    color: var(--text-secondary);
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
}

.fund-column {
    border-right: 1px solid var(--border-color);
    padding: 20px;
}

.fund-column:last-child {
    border-right: none;
}

.fund-label {
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 15px;
    color: white;
    font-size: 0.9rem;
}

.fund-label.vtsax {
    background: #1e88e5;
}

.fund-label.vtiax {
    background: #43a047;
}

.fund-label.vfiax {
    background: #e53935;
}

.comparison-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comparison-details .detail-item {
    margin: 0;
}

.comparison-details .detail-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.holding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.holding-ticker {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.holding-fund {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.holding-fund.vtsax {
    background: #1e88e5;
}

.holding-fund.vtiax {
    background: #43a047;
}

.holding-fund.vfiax {
    background: #e53935;
}

.holding-name {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.ownership-result {
    text-align: center;
    padding: 30px;
    font-size: 1.3rem;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ownership-result.no {
    background: var(--error-bg);
    color: var(--error-text);
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error {
    background: #fee;
    color: #c33;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .search-section {
        padding: 20px;
    }
    
    .ownership-query {
        font-size: 1.2rem;
        flex-wrap: wrap;
    }
    
    .ownership-input {
        width: 150px;
        font-size: 1.1rem;
    }
    
    .holding-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .holding-details {
        grid-template-columns: 1fr;
    }
    
    /* Comparison cards on mobile */
    .comparison-grid {
        grid-template-columns: 1fr;
    }
    
    .fund-column {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .fund-column:last-child {
        border-bottom: none;
    }
}