:root {
    /* Light Mode Variables */
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --nav-bg: #f5f5f5;
    --border-color: #e0e0e0;
    --primary-color: #007aff;
    --secondary-color: #5856d6;
    --accent-color: #ff2d55;
    --card-bg: #ffffff;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --header-height: 60px;

    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
    /* Dark Mode Variables */
    --bg-color: #121212;
    --text-color: #ffffff;
    --nav-bg: #1e1e1e;
    --border-color: #333333;
    --primary-color: #0a84ff;
    --secondary-color: #5e5ce6;
    --accent-color: #ff375f;
    --card-bg: #1e1e1e;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Nav */
.app-header {
    height: var(--header-height);
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.main-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    opacity: 0.7;
    text-decoration: none;
    display: inline-block;
}

.nav-btn:hover {
    background-color: rgba(128, 128, 128, 0.1);
    opacity: 1;
    text-decoration: none;
}

.nav-btn.active {
    background-color: var(--primary-color);
    color: white;
    opacity: 1;
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.primary-btn,
.secondary-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    text-decoration: none;
    display: inline-block;
}

.secondary-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 4px;
    border-radius: 50%;
}

.icon-btn:hover {
    background-color: rgba(128, 128, 128, 0.1);
}

/* Form Elements */
.select-input,
.date-input,
.file-input {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
}

.select-input:disabled {
    opacity: 0.6;
}

/* Main Content */
#app-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.view-container {
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
}

.placeholder-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    gap: 1rem;
    color: var(--text-color);
    opacity: 0.8;
}

/* Map View */
.map-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: var(--card-bg);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.map-stats {
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--text-color);
}

.full-map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Timeline View */
.timeline-controls {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.timeline-content {
    padding: 1rem;
    overflow-y: auto;
    height: calc(100% - 60px);
}

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-item {
    border-left: 2px solid var(--primary-color);
    padding-left: 1rem;
}

.timeline-time {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.timeline-details {
    background: var(--nav-bg);
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.2rem;
}

/* Health View */
.health-nav {
    margin-bottom: 2rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.chart-container {
    /* Generic chart container styles usually handled by grid children, but we can add specificity */
}

/* Finance View */
.finance-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
}

.amount {
    font-size: 1.5rem;
    font-weight: bold;
}

.amount.primary {
    color: var(--primary-color);
}

.amount.secondary {
    color: var(--secondary-color);
}

.amount.accent {
    color: var(--accent-color);
}

.finance-controls {
    margin-bottom: 1rem;
}

.transaction-list {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

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

.data-table thead {
    background: var(--nav-bg);
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 1rem;
}

.data-table td {
    border-bottom: 1px solid var(--border-color);
}

.align-right {
    text-align: right;
}

/* Energy & Movies uses similar grids */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
}

.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding-bottom: 2rem;
}

.movie-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.movie-poster {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.movie-poster-placeholder {
    height: 250px;
    background: var(--nav-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    opacity: 0.5;
}

.movie-info {
    padding: 1rem;
}

.movie-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.movie-meta {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    display: flex;
    justify-content: space-between;
}

/* Data View */
.data-controls {
    margin-bottom: 1rem;
}

.table-wrapper {
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: calc(100vh - 200px);
}

.generic-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.generic-table th {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
    background: var(--nav-bg);
    position: sticky;
    top: 0;
}

.generic-table td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

/* Import View */
.import-card {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.full-width {
    width: 100%;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.hidden {
    display: none !important;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    max-width: 500px;
    width: 90%;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsiveness */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        height: auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .header-left {
        display: none;
    }

    .main-nav {
        width: 100%;
        justify-content: center;
        padding-bottom: 0;
    }

    .header-right {
        display: none;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.p-1 {
    padding: 1rem;
}

.accent-color {
    color: var(--accent-color);
}