:root {
    --bg-color: #f4f4f9;
    --text-color: #333;
    --container-bg: #fff;
    --container-shadow: 0 4px 8px rgba(0,0,0,0.1);
    --input-border-color: #ccc;
    --button-bg: #228B22;
    --button-bg-hover: #1A6B1A;
    --button-text-color: white;
    --menu-bar-bg: #333;
    --menu-bar-text: white;
    --flash-bg: #dff0d8;
    --flash-text: #3c763d;
    --flash-border: #d6e9c6;
    --table-border-color: #ddd;
    --table-header-bg: #f2f2f2;
    --table-header-hover-bg: #e9e9e9;
    --link-color: #007bff;
    --status-protected-color: #d9534f;
    --status-public-color: #5cb85c;
    --status-private-color: #f0ad4e;
    --delete-button-bg: #d9534f;
    --remove-pass-button-bg: #f0ad4e;
    --note-bg: #f0f0f0;
    --footer-text-color: #888;
    --theme-toggle-icon-color: #333;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --container-bg: #1e1e1e;
    --container-shadow: 0 4px 8px rgba(0,0,0,0.4);
    --input-border-color: #555;
    --button-bg: #3da940;
    --button-bg-hover: #45bf48;
    --button-text-color: #fff;
    --menu-bar-bg: #1e1e1e;
    --menu-bar-text: #e0e0e0;
    --flash-bg: #2a3a2a;
    --flash-text: #a7c9a7;
    --flash-border: #445c44;
    --table-border-color: #444;
    --table-header-bg: #2c2c2c;
    --table-header-hover-bg: #383838;
    --link-color: #58a6ff;
    --status-protected-color: #f8716d;
    --status-public-color: #56d364;
    --status-private-color: #e3b341;
    --delete-button-bg: #da3633;
    --remove-pass-button-bg: #e3b341;
    --note-bg: #2c2c2c;
    --footer-text-color: #aaa;
    --theme-toggle-icon-color: #e0e0e0;
}


/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Login & Change Password Page Styles */
.login-container, .change-password-container-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1; /* Changed from height: 70vh */
    text-align: center;
}

.container, .change-password-container {
    background-color: var(--container-bg);
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--container-shadow);
    width: 320px;
}

.logo {
    width: 120px;
}

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

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 1em;
    border: 1px solid var(--input-border-color);
    border-radius: 5px;
    box-sizing: border-box;
    background-color: var(--container-bg);
    color: var(--text-color);
}

.rename-input {
    width: 50%;
}

button {
    padding: 10px 15px;
    font-size: 1em;
    background-color: var(--button-bg);
    color: var(--button-text-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--button-bg-hover);
}

.login-form button, .change-password-form button {
     width: 100%;
}

.error-message {
    color: var(--status-protected-color);
    margin-top: 15px;
}

/* Authenticated Dashboard Styles */
.dashboard-container {
    width: 75%;
    margin: 20px auto;
    padding: 20px;
}

.menu-bar {
    background-color: var(--menu-bar-bg);
    color: var(--menu-bar-text);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-title {
    font-size: 1.1em;
    font-weight: 600;
}

.menu-links {
    display: flex;
    gap: 15px;
}

.menu-bar a {
    color: var(--menu-bar-text);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--flash-text);
    background-color: var(--flash-bg);
    border-color: var(--flash-border);
}

.note-form {
    margin-top: 20px;
    margin-bottom: 40px;
    display: flex;
    gap: 10px;
}

.note-form input {
   flex-grow: 1;
   margin-bottom: 0;
}

/* Table Container */
.table-container {
    width: 75%;
    margin: 20px auto;
}

/* Notes Table Styles */
.notes-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.notes-table th, .notes-table td {
    border: 1px solid var(--table-border-color);
    padding: 12px;
    text-align: left;
    vertical-align: middle;
}

.notes-table th {
    background-color: var(--table-header-bg);
}

th[data-sort-column] {
    cursor: pointer;
    user-select: none;
    position: relative;
}

th[data-sort-column]:hover {
    background-color: var(--table-header-hover-bg);
}

.sort-arrow {
    display: inline-block;
    width: 1em;
    text-align: left;
}

.notes-table a {
    color: var(--link-color);
    text-decoration: none;
}

.notes-table a:hover {
    text-decoration: underline;
}

.actions-cell, .crud-form {
    display: flex;
    gap: 5px;
    align-items: center;
}

.crud-form input[type="text"], .crud-form input[type="password"] {
    width: 120px;
    margin-bottom: 0;
    padding: 8px;
}

.crud-form button {
    padding: 8px 12px;
}

.status-protected {
    font-weight: bold;
    color: var(--status-protected-color);
}

.status-public {
    color: var(--status-public-color);
}

.status-private {
    font-weight: bold;
    color: var(--status-private-color);
}

button.delete-button {
    background-color: var(--delete-button-bg);
}

.remove-pass-button {
    background-color: var(--remove-pass-button-bg);
}

/* Note Editor Page Styles */
html, body.note-page-body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.note-page-body {
    display: flex;
    flex-direction: column;
}

.note-page-body textarea {
    width: 100%;
    flex-grow: 1;
    padding: 10px;
    font-family: monospace;
    font-size: 1.1em;
    border: none;
    outline: none;
    resize: none;
    box-sizing: border-box;
    background-color: var(--note-bg);
    color: var(--text-color);
}

/* Footer Styles */
.footer {
    text-align: center;
    padding: 15px;
    color: var(--footer-text-color);
    background-color: var(--bg-color);
    font-size: 0.9em;
    margin-top: auto;
}

/* Theme Toggle Button */
.theme-toggle-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: none;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s, border-color 0.3s;
}

body.note-page-body .theme-toggle-button {
    background-color: var(--note-bg);
}
.theme-toggle-button svg {
    width: 24px;
    height: 24px;
    fill: var(--theme-toggle-icon-color);
    transition: fill 0.3s;
}

#theme-icon-moon {
    display: none; /* Hidden by default */
}
