:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --link-color: #007bff;
    --header-link-color: #222222;
    --border-color: #eeeeee;
    --meta-color: #777777;
    --form-bg: #f2f2f2;
    --input-bg: #ffffff;
    --input-text: #333333;
    --input-border: #cccccc;
    --table-border: rgba(0,0,0,0.1);
    --table-header-bg: rgba(0,0,0,0.05);
    --tag-bg: #f0f0f0;
    --tag-color: #555;
}

body.theme-night {
    --bg-color: #222222;
    --text-color: #eeeeee;
    --link-color: #66b3ff;
    --header-link-color: #ffffff;
    --border-color: #444444;
    --meta-color: #aaaaaa;
    --form-bg: #333333;
    --input-bg: #444444;
    --input-text: #eeeeee;
    --input-border: #555555;
    --table-border: #444444;
    --table-header-bg: #333333;
    --tag-bg: #333;
    --tag-color: #ccc;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--link-color);
}

header h1 a {
    text-decoration: none;
    color: var(--header-link-color);
}

header {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 40px;
    padding-bottom: 20px;
}

article {
    margin-bottom: 40px;
}

article img {
    max-width: 100%;
    height: auto;
}

img {
    max-width: 100%;
    height: auto;
}

h2 {
    margin-bottom: 5px;
}

h2 a {
    text-decoration: none;
    color: var(--link-color);
}

h2 a:hover {
    text-decoration: underline;
}

.meta {
    color: var(--meta-color);
    font-size: 0.9em;
    margin-bottom: 15px;
}

footer {
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    color: var(--meta-color);
    font-size: 0.8em;
    text-align: center;
}

/* Admin form styles */
.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="email"],
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 12px 20px;
    margin: 8px 0;
    display: inline-block;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--input-text);
    border-radius: 4px;
    box-sizing: border-box;
    transition: box-shadow 0.3s ease-in-out;
}

.admin-form input[type="text"]:focus,
.admin-form input[type="password"]:focus,
.admin-form input[type="email"]:focus,
.admin-form textarea:focus {
    box-shadow: 0 0 5px rgba(81, 203, 238, 1);
    border: 1px solid rgba(81, 203, 238, 1);
}

.admin-form input[type="submit"] {
    width: 100%;
    background-color: #4CAF50;
    color: white;
    padding: 14px 20px;
    margin: 8px 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.admin-form input[type="submit"]:hover {
    background-color: #45a049;
}

.admin-form {
    border-radius: 5px;
    background-color: var(--form-bg);
    padding: 20px;
}

/* Manage Posts Table Styles */
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 10px; border-bottom: 1px solid var(--table-border); text-align: left; }
th { background-color: var(--table-header-bg); }
.btn-delete { color: red; cursor: pointer; border: none; background: none; text-decoration: underline; }
.btn-toggle { color: blue; cursor: pointer; border: none; background: none; text-decoration: underline; margin-right: 10px; }
.btn-edit { color: green; text-decoration: none; margin-right: 10px; }
.btn-edit:hover { text-decoration: underline; }
.status-draft { color: #999; font-style: italic; }

/* Tags */
.tags { font-size: 0.85em; margin-bottom: 15px; }
.tag {
    display: inline-block;
    background-color: var(--tag-bg);
    color: var(--tag-color);
    padding: 2px 8px;
    border-radius: 4px;
    text-decoration: none;
    margin-right: 5px;
}
.tag:hover { background-color: var(--link-color); color: white; }

/* Theme Switch */
.theme-selector {
    display: flex;
    align-items: center;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.theme-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 2px; bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--link-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

body.theme-night .slider {
    background-color: #666;
}
body.theme-night input:checked + .slider {
    background-color: var(--link-color);
}

/* Utilities & Helpers */
.visually-hidden { display: none; visibility: hidden; }
.text-red { color: red; }
.text-green { color: green; }
.text-orange { color: orange; }
.text-gray { color: #666; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: bold; }
.font-small { font-size: 0.9em; }
.font-italic { font-style: italic; }
.opacity-70 { opacity: 0.7; }
.opacity-80 { opacity: 0.8; }
.nowrap { white-space: nowrap; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; }
.flex-center-y { display: flex; align-items: center; }
.flex-between-center { display: flex; justify-content: space-between; align-items: center; }
.flex-gap-5 { gap: 5px; }
.flex-gap-10 { gap: 10px; }
.flex-1 { flex: 1; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mt-40 { margin-top: 40px; }
.mb-5 { margin-bottom: 5px; }
.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.inline-form { display: inline; }
.inherit-color { color: inherit; }

/* Buttons */
.btn { padding: 10px 15px; cursor: pointer; border: none; border-radius: 4px; display: inline-block; text-decoration: none; color: var(--text-color); background-color: var(--form-bg); border: 1px solid var(--input-border); }
.btn-sm { padding: 6px 12px; font-size: 0.9em; }
.btn-xs { padding: 5px 10px; font-size: 0.8em; }
.btn-primary { background-color: #4CAF50; color: white; border: none; }
.btn-secondary { background-color: #777; color: white; border: none; }
.btn-info { background-color: #008CBA; color: white; border: none; }
.btn-warning { background-color: #e67e22; color: white; border: none; }
.btn-danger { color: red; cursor: pointer; border: none; background: none; text-decoration: underline; }
.btn-editor-action { padding: 14px 20px; border: none; border-radius: 4px; cursor: pointer; color: white; }
.btn-share { display: none; padding: 5px 10px; cursor: pointer; background: none; border: 1px solid currentColor; border-radius: 4px; color: inherit; }

/* Forms */
.form-control-inline { padding: 8px; border: 1px solid var(--input-border); border-radius: 4px; background-color: var(--input-bg); color: var(--input-text); }
.search-input { width: 300px; }
.search-input-sm { width: 200px; padding: 6px; }
.subscribe-input { padding: 6px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--input-text); border-radius: 4px; flex-grow: 1; max-width: 300px; }
.comment-input { width: 100%; padding: 8px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--input-text); border-radius: 4px; }
.comment-textarea { width: 100%; padding: 8px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--input-text); border-radius: 4px; font-family: inherit; }

/* Components */
.flash-message { background: var(--form-bg); border: 1px solid var(--input-border); padding: 10px; margin-top: 10px; border-radius: 4px; }
.nav-active { font-weight: bold; }
.lang-active { font-weight: bold; text-decoration: underline; }
.char-counter { float: right; color: #666; }
.autosave-notify { margin-left: 10px; color: #666; font-size: 0.9em; align-self: center; }
.settings-hint { font-size: 0.9em; color: #666; margin-bottom: 15px; }

/* Comments */
.comments-section { border-top: 1px solid var(--input-border); padding-top: 20px; }
.comment { margin-bottom: 15px; padding: 10px; background: var(--form-bg); border-radius: 4px; border: 1px solid var(--input-border); }
.comment-meta { font-weight: bold; font-size: 0.9em; margin-bottom: 5px; }
.comment-date { font-weight: normal; opacity: 0.7; font-size: 0.9em; }

/* Post Status */
.status-scheduled { color: #e67e22; font-weight: bold; }
.status-confirmed { color: green; }
.status-pending { color: orange; }

/* Blockquote (Moved from index.php) */
blockquote {
    background: #f9f9f9;
    border-left: 10px solid #ccc;
    margin: 1em 10px;
    padding: 0.5em 10px;
}
.theme-night blockquote { 
    background: #333; 
    border-left-color: #555; 
}

/* Back to Top (Moved from index.php) */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    background-color: var(--form-bg);
    color: var(--text-color);
    border: 1px solid var(--input-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    z-index: 1000;
    opacity: 0.7;
}
#back-to-top:hover { opacity: 1; }

/* Linktree-style Page */
.container-narrow {
    max-width: 480px;
    margin: 0 auto;
}

.profile-pic {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid var(--border-color);
}

.link-block {
    display: block;
    width: 100%;
    padding: 15px 20px;
    margin-bottom: 15px;
    background-color: var(--form-bg);
    border: 1px solid var(--input-border);
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s;
    box-sizing: border-box;
}

.link-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background-color: var(--input-bg);
    text-decoration: none;
    border-color: var(--link-color);
}
