/* ============================================
   bašta.eu — Stylesheet
   Based on visual design guide
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=IBM+Plex+Serif:wght@400;700&display=swap');

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
}

/* --- Body --- */
/* Disable transitions on initial page load to avoid flash */
.no-transition, .no-transition * {
    transition: none !important;
}

body {
    font-family: "IBM Plex Sans", sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.6;
    background: #ffffff;
    color: #000000;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* --- Main container --- */
main {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 32px;
    flex: 1;
}

/* --- Navigation --- */
nav {
    padding: 32px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

nav a.logo {
    font-family: "IBM Plex Serif", serif;
    font-weight: 700;
    font-size: 24px;
    color: #000000;
    text-decoration: none;
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 32px;
}

nav ul li a {
    font-size: 16px;
    text-decoration: none;
}

nav ul li a:hover {
    text-decoration: underline;
}

/* --- Theme toggle button --- */
#theme-toggle {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #000000;
    padding: 0;
    line-height: 1;
    transition: color 0.4s ease;
}

/* --- Headings --- */
h1, h2, h3 {
    font-family: "IBM Plex Serif", serif;
    font-weight: 700;
    margin-top: 0;
    line-height: 1.1;
}

h1 { font-size: 64px; margin-bottom: 24px; }
h2 { font-size: 36px; margin-bottom: 24px; }
h3 { font-size: 24px; margin-bottom: 24px; }

/* --- Paragraphs --- */
p {
    margin-bottom: 24px;
    margin-top: 0;
}

/* --- Lists --- */
ul, ol {
    margin-bottom: 24px;
    margin-top: 0;
}

/* --- Links --- */
a {
    color: #000000;
    text-decoration: underline;
}

/* --- Sections --- */
section {
    margin-bottom: 120px;
}

section:last-child {
    margin-bottom: 0;
}

/* --- Footer --- */
footer {
    padding: 48px 32px;
    text-align: right;
}

footer p {
    font-size: 14px;
    margin-bottom: 0;
}

/* --- Code blocks --- */
pre, code {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 15px;
}

pre {
    background: #f5f5f5;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

code {
    background: #f5f5f5;
    padding: 2px 4px;
    transition: background-color 0.4s ease, color 0.4s ease;
}

pre code {
    background: none;
    padding: 0;
}

/* --- Images --- */
img {
    max-width: 100%;
    height: auto;
}

/* --- Blockquotes --- */
blockquote {
    margin: 0 0 24px 0;
    padding-left: 24px;
    border-left: 2px solid #cccccc;
    transition: border-left-color 0.4s ease;
}

/* --- Horizontal rules (not recommended, but handle gracefully) --- */
hr {
    border: none;
    height: 0;
    margin: 0;
}

/* --- Dark mode --- */
/* Both html.dark-mode (applied before body exists) and .dark-mode on body */
html.dark-mode,
.dark-mode {
    background: #000000;
    color: #ffffff;
}

/* Override body's own background rule — higher specificity */
html.dark-mode body,
.dark-mode {
    background: #000000;
    color: #ffffff;
}

html.dark-mode a,
html.dark-mode nav a.logo,
html.dark-mode nav ul li a,
html.dark-mode footer p,
html.dark-mode .admin-editor .cancel,
html.dark-mode .admin-nav a,
.dark-mode a,
.dark-mode nav a.logo,
.dark-mode nav ul li a,
.dark-mode footer p,
.dark-mode .admin-editor .cancel,
.dark-mode .admin-nav a {
    color: #ffffff;
}

html.dark-mode pre,
html.dark-mode code,
.dark-mode pre,
.dark-mode code {
    background: #1a1a1a;
    color: #e0e0e0;
}

html.dark-mode pre,
.dark-mode pre {
    border-color: #333333;
}

html.dark-mode pre code,
.dark-mode pre code {
    background: none;
}

html.dark-mode blockquote,
.dark-mode blockquote {
    border-left-color: #555555;
}

html.dark-mode #theme-toggle,
.dark-mode #theme-toggle {
    color: #ffffff;
}

/* --- Admin specific: login form --- */
.login-form {
    padding: 0 32px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.login-form input[type="password"] {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 16px;
    border: 1px solid #000000;
    background: #ffffff;
    color: #000000;
    margin-bottom: 24px;
}

.login-form button {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px;
    font-weight: 700;
    padding: 8px 24px;
    background: #000000;
    color: #ffffff;
    border: none;
    cursor: pointer;
    text-transform: capitalize;
}

.login-form button:hover {
    text-decoration: underline;
}

.login-form .error {
    color: #cc0000;
    margin-bottom: 24px;
    font-size: 14px;
}

.login-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.login-form .back-link {
    font-size: 14px;
    margin: 0;
}

.login-form .back-link a {
    text-decoration: none;
}

.login-form .back-link a:hover {
    text-decoration: underline;
}

.admin-logout {
    margin-top: 48px;
    font-size: 14px;
    text-align: right;
}
.admin-logout a {
    color: #000 !important;
    text-decoration: none;
}
.admin-logout a:hover {
    text-decoration: underline;
}

/* --- Admin page list --- */
.admin-page-list {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-page-list h1 {
    font-size: 36px;
    margin-bottom: 48px;
}

.admin-page-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-page-list ul li {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-page-list ul li a {
    font-size: 18px;
}

.admin-page-list ul li form {
    display: inline;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-btn {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px !important;
    font-weight: 700;
    padding: 8px 24px;
    line-height: 1.6;
    background: #000000;
    color: #ffffff !important;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    vertical-align: middle;
}

.admin-btn:hover {
    text-decoration: underline;
}

.admin-btn-danger {
    background: #cc0000;
}

.admin-btn, .admin-btn-danger {
    text-transform: capitalize;
}

.admin-actions {
    display: flex;
    gap: 8px;
    margin-top: 32px;
}

/* --- Admin editor --- */
.admin-editor {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-editor h1 {
    font-size: 36px;
    margin-bottom: 24px;
}

.admin-editor label {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.admin-editor input[type="text"],
.admin-editor textarea {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 16px;
    border: 1px solid #000000;
    background: #ffffff;
    color: #000000;
    margin-bottom: 24px;
}

.admin-editor textarea {
    min-height: 500px;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 15px;
    line-height: 1.6;
}

.admin-editor button {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 16px;
    font-weight: 700;
    padding: 8px 24px;
    background: #000000;
    color: #ffffff;
    border: none;
    cursor: pointer;
    margin-right: 16px;
}

.admin-editor button:hover {
    text-decoration: underline;
}

.admin-editor .cancel {
    font-size: 16px;
    color: #000000;
}

/* --- Admin navigation --- */
.admin-nav {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-nav a {
    font-size: 14px;
    margin-right: 24px;
}

/* --- EasyMDE overrides --- */
.EasyMDEContainer .editor-toolbar {
    border: 1px solid #000000;
    border-bottom: none;
    background: #ffffff;
}

.EasyMDEContainer .editor-toolbar button {
    color: #000000 !important;
}

.EasyMDEContainer .editor-toolbar button:hover {
    background: #f0f0f0;
}

.EasyMDEContainer .CodeMirror {
    border: 1px solid #000000;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: 15px;
    line-height: 1.6;
    color: #000000;
}

.EasyMDEContainer .editor-preview {
    background: #ffffff;
    color: #000000;
}
