:root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --accent-color: #4682B4; /* Medium blue (evening sky) */
    --card-bg: #2c2c2c;
    --error-color: #ef5350;
    --success-color: #4682B4; /* Match accent color */
    --warning-color: #ff9800;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
}

/* Navigation bar */
.nav {
    background: var(--accent-color);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between; /* Logo left, links right */
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav .logo {
    height: 40px; /* Smaller logo for navbar */
    max-width: 100%;
}

.nav .nav-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: color 0.3s;
}

.nav a:hover, .nav a:focus {
    color: #e0e0e0;
    outline: none;
}

.nav a.active {
    font-weight: bold;
    text-decoration: underline;
}

.container {
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

h2, h3, h4 {
    color: var(--accent-color);
    margin-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
}

input[type="text"], input[type="password"], select, textarea, input[type="date"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #333;
    color: var(--text-color);
}

textarea {
    resize: vertical;
}

input[type="checkbox"] {
    margin-right: 5px;
}

button {
    padding: 10px 20px;
    background: var(--accent-color);
    border: none;
    border-radius: 4px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

button:hover {
    background: #355E8C; /* Darker blue */
}

.error, .success {
    text-align: center;
    margin-bottom: 10px;
}

.error { color: var(--error-color); }
.success { color: var(--success-color); }
.warning { background: var(--warning-color); color: #333; }

.dream {
    padding: 15px;
    border-bottom: 1px solid #444;
    margin-bottom: 20px;
}

.dream:last-child {
    border-bottom: none;
}

/* Metadata for view.php and detail.php */
.dream-metadata {
    background: #333;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.dream-metadata p {
    margin: 5px 0;
}

/* Detail page sections */
.dream-section {
    background: var(--card-bg);
    padding: 20px;
    border-left: 4px solid var(--accent-color);
    border-radius: 4px;
    margin-bottom: 20px;
}

.dream-section h4 {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-button {
    background: #555;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
}

.toggle-button:hover {
    background: #666;
}

.dream-content {
    display: block; /* Initially visible */
}

/* Privacy icons for index.php, view.php, detail.php */
.privacy-icon {
    margin-right: 8px;
    font-size: 1.2rem;
    vertical-align: middle;
}

.lock-icon::before {
    content: '\1F512'; /* Unicode for lock (🔒) */
    color: #ef5350; /* Red */
}

.globe-icon::before {
    content: '\1F310'; /* Unicode for globe (🌐) */
    color: #2196F3; /* Blue */
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    background: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.tag-cloud a {
    color: var(--text-color);
    text-decoration: none;
    margin-right: 10px;
    transition: color 0.3s;
}

.tag-cloud a:hover {
    color: #355E8C; /* Darker blue */
}

p {
    margin: 5px 0;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover, a:focus {
    text-decoration: underline;
    outline: none;
}

/* Login, register, forgot/reset password pages */
.login-container, .forgot-container, .reset-container {
    max-width: 400px;
    margin: 20px auto;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

/* Settings page */
.settings-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Admin page */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.admin-table th, .admin-table td {
    padding: 10px;
    border: 1px solid #444;
    text-align: left;
}

.admin-table th {
    background: var(--accent-color);
    color: white;
}

.admin-table tr:nth-child(even) {
    background: #333;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-button {
    padding: 10px 20px;
    background: #333;
    border: none;
    border-radius: 4px;
    color: var(--text-color);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.tab-button:hover {
    background: #444;
}

.tab-button.active {
    background: var(--accent-color);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Charts */
canvas {
    max-width: 100%;
    margin: 15px auto;
    display: block;
}

/* Stats grid for charts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

/* Time charts (full-width for larger charts) */
.time-charts {
    grid-template-columns: repeat(auto-fit, minmax(600px, 1fr));
}

/* Stat card */
.stat-card {
    background: #333;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.stat-card h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.stat-card p {
    font-size: 1rem;
    color: var(--text-color);
}

.stat-card canvas {
    margin: 0 auto;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination a {
    padding: 8px 12px;
    background: #333;
    color: var(--text-color);
    border-radius: 4px;
    text-decoration: none;
}

.pagination a:hover {
    background: #444;
}

.pagination a.active {
    background: var(--accent-color);
    color: white;
}

/* About page */
.about-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.about-logo {
    max-height: 150px; /* Larger logo for About page */
    margin-bottom: 20px;
}

.intro {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.about-section {
    text-align: left;
    margin: 2rem 0;
}

.about-section ul {
    list-style-type: disc;
    padding-left: 1.5rem;
}

.cta-buttons {
    margin-top: 1.5rem;
}

.button {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    margin: 0 0.5rem;
    font-weight: 600;
}

.button:hover {
    background: #355E8C; /* Darker blue */
}

.button-secondary {
    background: #555;
    color: white;
}

.button-secondary:hover {
    background: #666;
}

/* Public page */
.public-container {
    text-align: center;
}

.public-section {
    margin: 2rem 0;
    text-align: left;
}

.public-tag {
    background: #444;
    padding: 5px 10px;
    border-radius: 4px;
    color: var(--text-color);
    transition: background 0.3s;
}

.public-tag:hover {
    background: var(--accent-color);
    color: white;
}

.sentiment-chart {
    margin-top: 15px;
}

.sentiment-bar {
    padding: 10px;
    color: white;
    margin-bottom: 5px;
    border-radius: 4px;
}

.sentiment-bar.positive {
    background: #4682B4; /* Match accent color */
}

.sentiment-bar.negative {
    background: #ef5350;
}

.sentiment-bar.neutral {
    background: #2196F3;
}

/* Public view page */
.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-button {
    padding: 8px 16px;
    background: #333;
    color: var(--text-color);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
}

.filter-button:hover {
    background: #444;
}

.filter-button.active {
    background: var(--accent-color);
    color: white;
}

.dream-list {
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 600px) {
    .container, .settings-container, .about-container, .public-container {
        margin: 20px;
        padding: 15px;
    }
    .login-container, .forgot-container, .reset-container {
        margin: 20px;
        padding: 15px;
        min-height: auto;
    }
    .dream {
        padding: 10px;
    }
    .nav {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    .nav .logo {
        margin: 0 auto; /* Center logo on mobile */
    }
    .nav .nav-links {
        flex-direction: column;
        gap: 10px;
    }
    .tabs {
        flex-direction: column;
        gap: 5px;
    }
    .admin-table {
        font-size: 0.9rem;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .time-charts {
        grid-template-columns: 1fr;
    }
    .about-logo {
        max-height: 100px; /* Smaller logo on mobile */
    }
}

/* Cytoscape.js container */
.cytoscape-container {
    width: 100%;
    height: 600px;
    border: 1px solid #444;
    background: var(--card-bg);
    border-radius: 4px;
    margin-top: 15px;
}

/* Date filter form */
.date-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.date-filter input[type="date"] {
    max-width: 200px;
}

.date-filter button {
    padding: 8px 16px;
}

.filter {
    display: inline-block;
    padding: 8px 16px;
    margin: 5px;
    background-color: var(--card-bg);
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
}

.filter:hover, .filter.active {
    background-color: var(--accent-color);
    color: #fff;
}