:root {
    --primary-color: #2ecc71;
    /* Default, will be overridden by server if accentColor is set */
    /* ACCENT_COLOR_INJECT */
    --primary-hover: #27ae60;
    /* Nephritis Green */
    --secondary-color: #3498db;
    /* Blue */
    --secondary-hover: #2980b9;
    /* Darker Blue */
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --text-color: #222;
    --hover-bg: #f0f0f0;
}

body.dark-mode {
    --card-bg: #232527;
    --border-color: #333;
    --text-color: #e0e0e0;
    --hover-bg: #2a2d2f;
}

body {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    margin: 0;
    background: #f7f8fa;
    color: #222;
    min-height: 100vh;
}

/* Dark mode styles */
body.dark-mode {
    background: #181a1b;
    color: #e0e0e0;
}

/* Grouped dark mode backgrounds and borders */
body.dark-mode .admin-card,
body.dark-mode .category-card,
body.dark-mode .login-box,
body.dark-mode .category,
body.dark-mode .category-grid,
body.dark-mode .modal-content,
body.dark-mode .category-options-box,
body.dark-mode .image-options-box {
    background: var(--card-bg) !important;
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .admin-msg {
    background: #1f3428 !important;
    color: #e8f7ee !important;
    border-color: var(--primary-color) !important;
}

body.dark-mode .admin-error {
    color: #ffb3b3;
}

body.dark-mode .dropzone {
    background: var(--card-bg);
    border-color: #444;
    color: var(--text-color);
}

body.dark-mode .category-toggle {
    background: var(--card-bg);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .category-toggle:focus,
body.dark-mode .category-toggle:hover {
    background: var(--hover-bg);
}

body.dark-mode .img-item {
    background: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .img-item img {
    background: #222;
}

body.dark-mode .alt-text-input {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: #444;
}

body.dark-mode .admin-nav a {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .admin-nav a:hover {
    background: var(--hover-bg);
}

body.dark-mode .modal {
    background: rgba(20, 20, 20, 0.85);
}

body.dark-mode .category img,
body.dark-mode .no-image {
    background: #222;
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .gallery img {
    border-color: var(--border-color);
}

body.dark-mode .back {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .back:hover {
    background: var(--hover-bg);
}

body.dark-mode footer a {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .favicon-preview {
    background: var(--card-bg);
}

body.dark-mode header {
    background: var(--card-bg);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode header nav a:hover,
body.dark-mode header nav a:focus {
    background: var(--hover-bg) !important;
    color: var(--primary-color) !important;
    border-bottom: 2px solid var(--primary-color) !important;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode label,
body.dark-mode .category-title,
body.dark-mode .category-options-title,
body.dark-mode .image-options-title,
body.dark-mode .admin-form label,
body.dark-mode .admin-msg,
body.dark-mode .admin-error,
body.dark-mode .alt-text-input,
body.dark-mode .category div,
body.dark-mode .options-row,
body.dark-mode .category-toggle .category-title,
body.dark-mode .category-toggle .accordion-arrow {
    color: var(--text-color) !important;
}

body.dark-mode a,
body.dark-mode a:visited {
    color: var(--primary-color) !important;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    color: var(--text-color) !important;
    background: var(--card-bg) !important;
    border-color: #444 !important;
}

body.dark-mode ::placeholder {
    color: #aaa !important;
    opacity: 1;
}

body.dark-mode .admin-action-btn:hover,
body.dark-mode .set-thumb-btn:hover,
body.dark-mode .delete-cat-btn:hover {
    background: #333 !important;
    color: var(--primary-color) !important;
}

body.dark-mode .category-name {
    background: var(--card-bg);
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
}

/* Glow effect for selected backup in dark mode */
body.dark-mode .admin-list-item:has(.backup-checkbox:checked),
body.dark-mode .admin-list-item.selected {
    background: #1f3428 !important;
    box-shadow: 0 0 0 2px var(--primary-color), 0 2px 8px rgba(var(--primary-color-rgb, 46, 204, 113), 0.10);
    border-color: var(--primary-color) !important;
    color: var(--text-color) !important;
}

/* Dark mode for About page */
body.dark-mode .about-container {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}

body.dark-mode .about-photo {
    background: #181a1b;
    border: 3px solid #444;
}

body.dark-mode .about-content {
    color: var(--text-color) !important;
}

body.dark-mode .about-content a {
    color: var(--primary-color) !important;
}

body.dark-mode .about-content code,
body.dark-mode .about-content pre {
    background: #181a1b !important;
    color: var(--primary-color) !important;
}

body.dark-mode .btn-primary {
    color: #fff !important;
}

/* Header */
header {
    width: 100%;
    background: var(--card-bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    padding: 2.5rem 0 1.5rem 0;
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.site-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 0.5rem 0 0.7rem 0;
    text-align: center;
    line-height: 1.1;
    color: var(--primary-color);
}

.header-image-preview {
    max-width: 320px;
    max-height: 80px;
    margin-bottom: 0.7rem;
    display: block;
}

header nav {
    margin-top: 1rem;
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

header nav>* {
    display: flex;
    align-items: center;
    height: 100%;
}

/* Make dropdown toggles look like nav links */
header nav a,
.dropdown-toggle {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    font-size: 1.1rem;
    border-radius: 0;
    border-bottom: 2px solid transparent !important;
    box-sizing: border-box;
    /* Prevents layout shift on border change */
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    /* Fix: Reserve space for border to prevent header jump */
    border-bottom-width: 2px;
    border-bottom-style: solid;
    background: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    border: none;
}

header nav a:hover,
header nav a:focus,
.dropdown-toggle:hover,
.dropdown-toggle:focus {
    background: var(--hover-bg);
    border-bottom: 2px solid var(--primary-color) !important;
    color: var(--primary-color);
    outline: none;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropdown-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

.dropdown-arrow {
    font-size: 0.7rem;
    margin-left: 0.3em;
    transition: transform 0.2s, color 0.2s;
    color: inherit;
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 0.2rem;
    padding: 0.3rem 0;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Make dropdown menu items match nav links */
.dropdown-item {
    display: block;
    padding: 0.6rem 1.2rem;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    background: none;
    transition: border 0.2s, background 0.2s, color 0.2s;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--hover-bg);
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    outline: none;
}

/* Dark mode header/nav */
body.dark-mode header {
    background: var(--card-bg);
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .site-title {
    color: var(--primary-color);
}

body.dark-mode header nav a {
    color: var(--text-color);
}

body.dark-mode header nav a:hover,
body.dark-mode header nav a:focus {
    background: var(--hover-bg) !important;
    color: var(--primary-color) !important;
    border-bottom: 2px solid var(--primary-color) !important;
}

body.dark-mode .dropdown-menu {
    background: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .dropdown-item {
    color: var(--text-color);
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
    background: var(--hover-bg);
    color: var(--primary-color);
}

/* Dark mode toggle button */
.dark-mode-toggle {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    z-index: 10;
    font-size: 1.7rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.2em 0.4em;
    border-radius: 0;
    transition: background 0.2s;
}

.dark-mode-toggle:hover,
.dark-mode-toggle:focus {
    background: rgba(120, 120, 120, 0.08);
    outline: none;
}

/* Responsive header/nav */
@media (max-width: 900px) {
    header nav {
        flex-wrap: wrap;
        gap: 0.7rem;
        row-gap: 0.7rem;
        justify-content: center;
        padding: 0 0.5rem;
    }

    .dark-mode-toggle {
        position: static;
        margin: 0.7rem auto 0.5rem auto;
        float: none;
        right: auto;
        top: auto;
    }
}

@media (max-width: 600px) {
    .site-title {
        margin-top: 1.2rem;
        margin-bottom: 0.7rem;
        text-align: center;
        width: 100%;
    }

    header {
        flex-direction: column;
        align-items: center;
    }

    .dark-mode-toggle {
        position: static !important;
        display: block;
        margin: 0.7rem auto 0.5rem auto;
        float: none;
        right: auto;
        top: auto;
    }

    header nav a {
        font-size: 1rem;
        padding: 0.5rem 0.7rem;
        min-width: 90px;
        text-align: center;
    }

    .dropdown-menu {
        position: fixed;
        top: auto;
        left: 1rem;
        right: 1rem;
        width: auto;
        min-width: auto;
    }
}

/* Headings */
h1 {
    text-align: center;
    margin-top: 2rem;
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -1px;
}

/* Admin Panel & Cards */
.admin-card,
.login-box {
    background: var(--card-bg);
    border-radius: 0;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    margin-bottom: 2.5rem;
    padding: 2rem 2vw;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
}

.login-box {
    max-width: 400px;
    margin: 3rem auto;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    box-sizing: border-box;
}

.admin-card {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.category-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #e9ecef;
    flex-shrink: 0;
    flex-grow: 0;
    display: block;
}

img,
.no-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
    border: none;
    background: #e9ecef;
}

/* Only category thumbnails are square */
.category-image-wrapper img,
.category-image-wrapper .no-image {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    border-radius: 0;
    border: none;
    background: #e9ecef;
}

/* Gallery images: natural aspect ratio, not forced square */
.gallery img {
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
    display: block;
    border-radius: 0;
    border: 1px solid var(--border-color);
    background: #e9ecef;
}

.category-name {
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.2em 0.5rem;
    min-height: 1.6em;
    background: var(--card-bg);
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.admin-card,
.category-accordion {
    overflow: visible;
}

.admin-card>#category-list {
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    padding-right: 0;
}

#category-list .category-accordion {
    width: 100%;
    box-sizing: border-box;
    margin-right: 0;
    padding: 0;
    margin-bottom: 1.1rem;
    border: none;
    background: none;
    max-width: 100%;
}

.admin-msg {
    background: #e8f7ee;
    color: #222;
    padding: 0.7rem 1rem;
    margin: 1rem auto 2rem auto;
    max-width: 400px;
    border: 1px solid var(--primary-color);
    border-radius: 0;
    text-align: center;
    font-size: 1.1rem;
}

.admin-error {
    color: #c00;
    font-weight: 600;
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
}

.admin-nav {
    max-width: 400px;
    margin: 0 auto 1.5rem auto;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.admin-nav a {
    background: #eee;
    color: #222;
    font-weight: 600;
    border-radius: 0;
    padding: 0.5rem 1.2rem;
    text-decoration: none;
    box-shadow: none;
    border: 1px solid var(--border-color);
    transition: background 0.2s;
    display: inline-block;
}

.admin-nav a:hover {
    background: #e0e0e0;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin: 0;
}

.admin-form input[type="text"],
.admin-form input[type="file"],
.admin-form select,
.admin-form button {
    font-size: 1.1rem;
    min-height: 2.5rem;
}

.admin-form input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    font-size: 1.1rem;
    min-height: 2.5rem;
}

.admin-form label {
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--text-color);
    display: block;
}

.admin-form select {
    padding: 0.7rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0;
    background: #f7f8fa;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    transition: border 0.2s;
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='gray' height='18' viewBox='0 0 20 20' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M5.516 7.548a1 1 0 0 1 1.415 0L10 10.617l3.07-3.07a1 1 0 1 1 1.415 1.415l-3.777 3.778a1 1 0 0 1-1.415 0L5.516 8.963a1 1 0 0 1 0-1.415z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.8em center;
    background-size: 1em;
    padding-right: 2.5em;
}

.admin-form select:focus {
    border: 1.5px solid #a0a0a0;
    outline: none;
    background: #f0f0f0;
}

.admin-form.row-gap {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.2rem;
    width: 100%;
    padding: 0;
}

.admin-form.row-gap input[type="text"] {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
    width: 1%;
    height: 2.5rem;
    font-size: 1.1rem;
}

.admin-form.row-gap button {
    height: 2.5rem;
    margin-top: 0;
    align-self: stretch;
    min-width: 120px;
    width: auto;
    white-space: nowrap;
    box-sizing: border-box;
    font-size: 1.1rem;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 600px) {
    .admin-form.row-gap {
        flex-direction: column;
        align-items: stretch;
        gap: 0.7rem;
    }

    .admin-form.row-gap button {
        min-width: 0;
        width: 100%;
        justify-content: center;
    }
}

.dropzone {
    border: 2px dashed #bbb;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    cursor: pointer;
    background: #fafbfc;
    border-radius: 0;
    transition: background 0.2s;
    position: relative;
    font-size: 1.08rem;
    color: var(--text-color);
    outline: none;
}

.dropzone:hover {
    background: #f0f0f0;
}

.dropzone.dragover {
    background: #e8f7ee;
    border-color: var(--primary-color);
}

.dropzone:focus {
    border-color: var(--primary-color);
    background: #e8f7ee;
}

.preview {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7em;
    margin-bottom: 1em;
}

.preview-thumb-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90px;
}

.preview-thumb {
    border-radius: 0;
    border: 1px solid #ccc;
    background: #f8f8f8;
}

.preview-filename {
    font-size: 0.85em;
    text-align: center;
    word-break: break-all;
}

/* Tighter image grid for admin */
.image-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 0 1.2rem 0;
    min-height: 90px;
    background: transparent;
    padding-bottom: 1rem;
    border-radius: 0;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.img-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: var(--card-bg);
    border-radius: 0;
    box-shadow: none;
    padding: 0.3rem 0.2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    cursor: grab;
    opacity: 1;
    transition: box-shadow 0.2s, opacity 0.2s;
    border: none;
    gap: 0.5rem;
    margin-bottom: 2px;
}

.img-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
    background: #e9ecef;
    pointer-events: none;
    border: none;
    display: block;
    flex-shrink: 0;
}

.alt-text-input {
    flex: 1 1 0;
    min-width: 0;
    max-width: 90%;
    width: auto;
    margin-left: 0.5rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.98rem;
    border: 1px solid var(--border-color);
    border-radius: 0;
    background: #fafbfc;
    height: 2.1rem;
    box-sizing: border-box;
    overflow: hidden;
}

.img-item.dragging {
    opacity: 0.5;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.img-item.dragover {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.img-dropzone {
    width: 100%;
    height: 16px;
    display: block;
    background: transparent;
    margin: 0;
    transition: background 0.2s;
    pointer-events: none;
}

.img-dropzone.active,
.img-dropzone.dragging {
    background: #e8f7ee;
    border-top: 3px dashed var(--primary-color);
    border-bottom: 3px dashed var(--primary-color);
    margin: 4px 0;
    pointer-events: auto;
}

.delete-img-btn {
    background: #c00;
    color: #fff;
    border: none;
    border-radius: 0;
    padding: 0.2rem 0.6rem;
    font-size: 0.95rem;
    cursor: pointer;
    margin-bottom: 0.2rem;
    transition: background 0.2s;
}

.delete-img-btn:hover {
    background: #a00;
}

.delete-img-btn-overlay {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(200, 0, 0, 0.85);
    color: #fff;
    border: none;
    border-radius: 0;
    width: 2rem;
    height: 2rem;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: background 0.2s, opacity 0.2s;
}

.img-item:hover .delete-img-btn-overlay {
    opacity: 1;
}

.delete-img-btn-overlay:hover {
    background: #a00;
}

.bulk-delete-checkbox {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 3;
    width: 1.4em;
    height: 1.4em;
    accent-color: #c00;
}

.bulk-delete-form {
    margin-bottom: 0.7rem;
}

.bulk-delete-form button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.bulk-delete-form button:first-child {
    margin-left: 0;
}

.admin-flex-row {
    display: flex;
    gap: 2rem;
    justify-content: stretch;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.admin-flex-row .admin-card {
    flex: 1 1 0;
    min-width: 300px;
    margin-bottom: 0;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 30, 30, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem 2.5rem;
    border-radius: 0;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.18);
    text-align: center;
}

.modal-content button {
    margin: 0 0.7rem;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
}

/* Login Page */
.login-box {
    max-width: 400px;
    margin: 3rem auto;
    background: var(--card-bg);
    border-radius: 0;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    border: 1px solid var(--border-color);
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    box-sizing: border-box;
}

input[type="text"],
input[type="password"] {
    padding: 0.7rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0;
    background: #f7f8fa;
    transition: border 0.2s;
}

input:focus {
    border: 1.5px solid #a0a0a0;
    outline: none;
}

button {
    padding: 0.9rem;
    background: #222;
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
    margin-top: 0.5rem;
}

button:hover {
    background: #444;
    transform: translateY(-2px) scale(1.03);
}

button:disabled,
button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.error {
    color: #c00;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* Gallery/Homepage (from index.ejs) */
.categories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    max-width: 100vw;
    margin-bottom: 3rem;
    padding: 0 1.5vw;
    box-sizing: border-box;
    overflow-x: hidden;
    min-width: 0 !important;
}

.categories>.category {
    min-width: 0 !important;
    box-sizing: border-box;
}

.category {
    min-width: 0;
    margin: 0 0 2.5rem 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery {
    column-count: 3;
    column-gap: 2rem;
    padding: 2rem 0;
    max-width: 1400px;
    margin: 0 auto 3rem auto;
    overflow-x: hidden;
}

/* Gallery container: shrink to fit content and center */
.gallery-container {
    background: var(--card-bg);
    padding: 2rem 0;
    border-radius: 0;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
    margin-bottom: 2rem;
    text-align: center;
    display: block;
    width: 100%;
}

.gallery-grid {
    display: inline-grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.2rem;
    justify-content: center;
    margin: 0 auto;
    /* Remove max-width so it only grows as needed */
    max-width: none;
}

/* Make the white box and thumbs match dark mode */
body.dark-mode .gallery-container {
    background: var(--card-bg);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.18);
}

body.dark-mode .gallery-thumb {
    background: #181a1b;
    border-color: var(--border-color);
}

.gallery-thumb {
    background: var(--card-bg);
    border-radius: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 160px;
    height: 160px;
}

.gallery-thumb input[type="checkbox"]:checked+img {
    outline: 2px solid var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.gallery img {
    max-width: 100%;
    width: 100%;
    display: block;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    break-inside: avoid;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.gallery img:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.13);
}

.gallery img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.6s;
}

.gallery img[loading="lazy"][data-loaded="true"] {
    opacity: 1;
}

.back {
    display: inline-block;
    margin: 2rem 0 1rem 0;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: #f0f0f0;
    transition: background 0.2s;
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.back:hover {
    background: #e0e0e0;
}

footer {
    width: 100%;
    text-align: right;
    padding: 1.5rem 0 2rem 0;
    background: transparent;
    z-index: 10;
    pointer-events: none;
    position: fixed;
    bottom: 0;
    left: 0;
}

footer a {
    background: #222;
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    font-size: 1.1rem;
    text-decoration: none;
    box-shadow: none;
    transition: background 0.2s;
    display: inline-block;
    pointer-events: auto;
    margin-right: 2rem;
    border-radius: 0;
    border: 1px solid #222;
}

/* Lightbox styling */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(30, 30, 30, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 0;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.lightbox-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox img {
    max-width: 80vw;
    max-height: 70vh;
    border-radius: 10px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.25);
    background: var(--card-bg);
    margin-bottom: 1rem;
}

.lightbox-alt {
    color: #eee;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5em 1em;
    margin: 0.5em auto 0 auto;
    border-radius: 0;
    font-size: 1.05em;
    max-width: 90vw;
    text-align: center;
    word-break: break-word;
}

.lightbox-caption {
    color: var(--text-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    text-align: center;
    word-break: break-all;
}

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

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(40, 40, 60, 0.7);
    color: #fff;
    border: none;
    font-size: 2.2rem;
    padding: 0.5rem 1rem;
    border-radius: 0;
    cursor: pointer;
    z-index: 1001;
    transition: background 0.18s;
}

.lightbox-nav.prev {
    left: 2vw;
}

.lightbox-nav.next {
    right: 2vw;
}

.lightbox-nav:hover,
.lightbox-nav:focus {
    background: var(--primary-color);
}

.close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 1001;
    border-radius: 0;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--primary-color);
}

.lightbox-open .dark-mode-toggle {
    pointer-events: none;
    opacity: 0.5;
    /* Optional: visually indicate it's disabled */
}

/* Gallery grid */
.gallery-container {
    background: #f7f8fa;
    padding: 2rem 0;
    border-radius: 0;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
    margin-bottom: 2rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.2rem;
    max-width: 900px;
    margin: 0 auto;
    justify-items: center;
}

.gallery-thumb {
    width: 160px;
    height: 160px;
    background: var(--card-bg);
    border-radius: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    display: block;
}

/* 404 Not Found page styles */
.notfound-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f7f8fa;
}

.notfound-container {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--card-bg);
    border-radius: 0;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

.notfound-container h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.notfound-container p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.notfound-container a {
    background: #222;
    color: #fff;
    padding: 0.7rem 1.5rem;
    border-radius: 0;
    text-decoration: none;
    font-weight: 600;
}

.notfound-container a:hover {
    background: #444;
}

/* Responsive adjustments */
@media (max-width: 1200px) {

    .categories,
    .gallery {
        display: grid;
        gap: 2rem;
        max-width: 100vw;
        margin-bottom: 3rem;
        padding: 0 1.5vw;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .no-image {
        height: 197px;
    }

    .admin-card,
    .login-box,
    .settings-flex-row .admin-card {
        max-width: 100vw;
    }

    .settings-flex-row {
        max-width: 100vw;
    }
}

@media (max-width: 1200px) and (min-width: 601px) {
    .category-name {
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        font-weight: 600;
        padding: 0.2em 0.5rem;
        min-height: 1.6em;
        background: var(--card-bg);
        color: var(--text-color);
        border-top: 1px solid var(--border-color);
        width: 100%;
        box-sizing: border-box;
        margin: 0;
    }
}

@media (max-width: 900px) {
    .gallery {
        column-count: 2;
    }

    .categories {
        display: grid;
        gap: 2rem;
        max-width: 100vw;
        margin-bottom: 3rem;
        padding: 0 1.5vw;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .admin-card {
        padding: 1.2rem;
    }

    .category-grid {
        gap: 1rem;
    }

    .category-card {
        min-width: 180px;
        max-width: 100vw;
    }

    .img-item {
        min-width: 80px;
        max-width: 100px;
    }

    .img-item img {
        width: 80px;
        height: 60px;
    }

    .img-dropzone {
        height: 60px;
    }

    .admin-flex-row {
        flex-direction: column;
        gap: 1.2rem;
    }

    .admin-flex-row .admin-card {
        min-width: 0;
    }

    .settings-flex-row {
        flex-direction: column;
        gap: 1.2rem;
        align-items: stretch;
        max-width: 100vw;
    }

    .settings-flex-row .admin-card {
        min-width: 0;
        max-width: 100vw;
        margin: 0 0 2.5rem 0;
    }

    .about-container {
        padding: 1rem;
        margin: 1rem 0.5rem;
        max-width: 98vw;
    }

    .about-photo {
        max-width: 140px;
        margin-bottom: 1.2rem;
    }

    header nav {
        flex-wrap: wrap;
        gap: 0.7rem;
        row-gap: 0.7rem;
        justify-content: center;
        padding: 0 0.5rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .gallery-thumb img {
        height: 120px;
    }

    .lightbox img {
        max-width: 98vw;
        max-height: 60vh;
    }
}

@media (max-width: 600px) {
    .gallery {
        column-count: 1;
        padding: 1rem 0;
    }

    .category-image-wrapper {
        width: 100%;
        aspect-ratio: 1 / 1;
        flex-shrink: 0;
    }

    .category-name {
        display: flex !important;
        font-size: 1.1rem;
        padding: 0.2em 0.2rem 0.2em 0.5rem;
        min-height: 1.6em;
        background: var(--card-bg);
        color: var(--text-color);
        border-top: 1px solid var(--border-color);
        align-items: center;
        justify-content: center;
        width: 100%;
        box-sizing: border-box;
    }

    h1 {
        font-size: 2rem;
    }

    footer a {
        margin-right: 1rem;
    }

    .admin-card {
        padding: 0.7rem;
    }

    .category-grid {
        flex-direction: column;
        gap: 0.7rem;
    }

    .category-card {
        min-width: 0;
        max-width: 100vw;
    }

    .admin-form input,
    .admin-form select,
    .admin-form button {
        width: 100%;
        font-size: 1.1rem;
    }

    .admin-flex-row {
        flex-direction: column;
        gap: 1.2rem;
    }

    .img-item {
        padding: 0.2rem 0.1rem;
        gap: 0.3rem;
    }

    .alt-text-input {
        font-size: 0.95rem;
        padding: 0.2rem 0.3rem;
    }

    .admin-card,
    .login-box,
    .settings-flex-row .admin-card {
        padding: 0px;
        min-width: 0;
        max-width: 100vw;
        margin: 0 0 1.5rem 0;
        box-sizing: border-box;
    }

    .admin-flex-row,
    .settings-flex-row {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        max-width: 100vw;
    }

    .admin-list-item {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        min-height: 0;
        padding: 0.7rem 0.7rem;
        gap: 0.5rem;
    }

    .admin-list {
        gap: 0.7rem;
    }

    .admin-list-item .backup-info {
        font-size: 1em;
    }

    .admin-list-item input[type="checkbox"] {
        margin-bottom: 0.5rem;
    }

    .login-box,
    .admin-card {
        margin: 1.2rem 0.5rem;
        width: 100%;
        max-width: 100vw;
    }

    .admin-form input,
    .admin-form select,
    .admin-form button {
        width: 100%;
        font-size: 1.1rem;
        min-width: 0;
    }

    .admin-form label {
        margin-bottom: 0.3rem;
    }

    .container {
        padding: 0 0.5rem;
        max-width: 100vw;
    }

    h1 {
        font-size: 1.4rem;
        margin-top: 1.2rem;
    }

    .backup-note {
        font-size: 0.95em;
        word-break: break-word;
    }

    .toast-container {
        top: 1rem;
        right: 0.5rem;
        left: 0.5rem;
        max-width: 95vw;
    }

    .toast {
        min-width: 0;
        max-width: 100vw;
        font-size: 1rem;
        padding: 0.7rem 1rem;
    }

    body.dark-mode .category-name {
        background: var(--card-bg) !important;
        color: var(--text-color) !important;
        border-top: 1px solid var(--border-color) !important;
    }

    .dark-mode-toggle {
        position: static !important;
        display: block;
        margin: 0.7rem auto 0.5rem auto;
        float: none;
        right: auto;
        top: auto;
    }

    header {
        flex-direction: column;
        align-items: center;
    }

    .site-title {
        margin-top: 1.2rem;
        margin-bottom: 0.7rem;
        text-align: center;
        width: 100%;
    }

    .about-container {
        padding: 1rem 0.5rem !important;
        margin: 0.5rem 0.1rem !important;
        max-width: 100vw !important;
        font-size: 1.08rem !important;
    }

    .about-content,
    .about-container,
    .admin-msg {
        font-size: 1.08rem !important;
        line-height: 1.6 !important;
    }

    .about-photo {
        max-width: 120px !important;
        margin-bottom: 1.2rem !important;
    }

    #markdown {
        font-size: 1.08rem !important;
        min-width: 0 !important;
        width: 100% !important;
        padding: 0.7rem !important;
    }

    label {
        font-size: 1.08rem !important;
    }

    .dropzone {
        font-size: 1.08rem !important;
        padding: 1.2rem 0.5rem !important;
    }

    button,
    .danger-btn {
        font-size: 1.08rem !important;
        padding: 1rem !important;
    }

    header nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        row-gap: 0.5rem;
        justify-content: center;
        padding: 0 0.2rem;
    }

    header nav a {
        font-size: 1rem;
        padding: 0.5rem 0.7rem;
        min-width: 90px;
        text-align: center;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.7rem;
    }

    .gallery-thumb {
        width: 100px;
        height: 100px;
    }

    .gallery-thumb img {
        height: 90px;
    }
}

/* Side-by-side layout for settings and backup */
.settings-flex-row {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    justify-content: center;
    margin: 0 auto 2.5rem auto;
    flex-wrap: wrap;
    max-width: 1900px;
}

.settings-flex-row .admin-card {
    flex: 1 1 0;
    min-width: 0;
    max-width: 900px;
    width: 100%;
    margin-bottom: 0;
}

/* Container */
.container {
    padding: 0 2vw;
    margin: 0 auto;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Visually hidden */
.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
}

/* Admin action buttons */
.set-thumb-btn,
.delete-cat-btn {
    font-size: 1rem;
    padding: 0.5rem 1.2rem;
}

.admin-action-btn,
.set-thumb-btn,
.delete-cat-btn {
    font-size: 1rem;
    padding: 0.5rem 1.2rem;
    height: 2.5rem;
    line-height: 1.2;
    border-radius: 0;
    margin-left: 0.7rem;
    margin-bottom: 0;
    box-sizing: border-box;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.image-options-box {
    min-width: 320px;
    max-width: 420px;
    width: 100%;
}

.image-options-box form {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0;
}

.image-options-box select {
    padding: 0.7rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0;
    background: #f7f8fa;
    color: var(--text-color);
    margin-bottom: 0;
    transition: border 0.2s;
    width: 100%;
    appearance: none;
    min-width: 170px;
    max-width: 220px;
    box-shadow: none;
}

.image-options-box select:focus {
    border-color: var(--primary-color);
    outline: none;
    background-color: #e8f7ee;
}

.image-options-box select:disabled {
    background: #eee;
    color: #aaa;
}

.image-options-box button {
    min-width: 90px;
    margin-left: 0;
}

.image-options-box form button {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
    font-size: 1rem;
    padding: 0.7rem 1.2rem;
    height: 2.7rem;
    line-height: 1.2;
}

.image-options-box form button:first-child {
    margin-left: 0;
}

.category-accordion {
    margin-bottom: 1.5rem;
    padding: 0;
    border: none;
    background: none;
}

.category-accordion.dragging {
    opacity: 0.5;
    border: 2px dashed var(--primary-color);
}

.category-toggle {
    width: 100%;
    box-sizing: border-box;
    background: #f7f8fa;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.2rem;
    font-weight: 600;
    text-align: left;
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    outline: none;
    transition: background 0.2s;
}

.category-toggle:focus,
.category-toggle:hover {
    background: #e0e0e0;
}

.category-toggle .category-title,
.category-toggle .accordion-arrow {
    color: #111;
}

.category-toggle[draggable="true"] {
    cursor: move;
}

.accordion-arrow {
    display: inline-block;
    transition: transform 0.2s;
    margin-left: 1rem;
    font-size: 1.2em;
}

.category-options-box,
.image-options-box {
    background: #f4f6fa;
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.9rem 1.2rem 0.7rem 1.2rem;
    margin-bottom: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 320px;
    max-width: 420px;
    box-sizing: border-box;
    overflow: visible;
    flex: 1 1 320px;
    height: auto;
}

.category-options-title,
.image-options-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-color);
    letter-spacing: 0.5px;
}

.options-row {
    display: flex;
    flex-direction: row;
    gap: 1.2rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    align-items: stretch;
    padding: 0.5rem;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.2rem;
    background: var(--card-bg);
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: auto;
    max-width: 100%;
    overflow-x: hidden;
}

.category-grid {
    width: 100%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: transparent;
    flex: unset !important;
    height: auto !important;
    max-width: 100%;
    overflow-x: hidden;
}

.close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 1001;
    border-radius: 0;
}

#saving-indicator {
    transition: opacity 0.5s;
    opacity: 1;
}

#saving-indicator.fade-out {
    opacity: 0;
}

.favicon-preview {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.favicon-preview-container,
.header-image-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
    margin-top: 0.5rem;
}

.favicon-preview-label {
    font-weight: 600;
    font-size: 1rem;
    color: #555;
    margin-bottom: 0.2rem;
}

.header-image-preview {
    max-width: 300px;
    max-height: 80px;
}

#headerTextInput,
#headerImageInput {
    margin-bottom: 1.2rem;
}

.dark-mode-toggle {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    z-index: 10;
    /* Lower than .lightbox (1000) */
    font-size: 1.7rem;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.2em 0.4em;
    border-radius: 0;
    transition: background 0.2s;
}

.dark-mode-toggle:hover,
.dark-mode-toggle:focus {
    background: rgba(120, 120, 120, 0.08);
    outline: none;
}

.admin-card-categories {
    max-width: 100vw !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
    padding-left: 2vw;
    padding-right: 2vw;
}

.header-type-radio-group {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 1.2rem;
    align-items: center;
}

.header-type-radio-group label {
    font-weight: 500;
    font-size: 1.08rem;
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 0;
    cursor: pointer;
}

.header-type-radio-group input[type="radio"] {
    accent-color: var(--primary-color);
    width: 1.2em;
    height: 1.2em;
}

/* New styles */
.hidden {
    display: none !important;
}

.label-bottom-gap {
    margin-bottom: 0.5rem;
    display: block;
}

.file-name-label {
    margin-left: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.dropzone-flex {
    flex: 1 1 auto;
}

.form-margin-top {
    margin-top: 0.5rem;
}

.form-margin-bottom {
    margin-bottom: 1rem;
}

.backup-note {
    font-size: 0.95em;
    color: #888;
}

.row-gap {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

.flex-1 {
    flex: 1;
}

.inline-form {
    display: inline;
}

.no-margin {
    margin: 0 !important;
}

.ml-05 {
    margin-left: 0.5rem;
}

.saving-indicator {
    display: none;
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 3000;
    background: #fffbe0;
    color: #222;
    padding: 0.7rem 1.2rem;
    border: 1px solid #e6b2b2;
    border-radius: 0.3rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

/* Admin user list styles */
.admin-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.admin-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f7f8fa;
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 0.7rem 1.2rem;
    font-size: 1.08rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    gap: 1rem;
    min-height: 48px;
    height: 48px;
}

.admin-list-item>span,
.admin-list-item>form {
    display: flex;
    align-items: center;
    height: 100%;
}

.admin-list-item form {
    margin: 0;
}

.admin-current-user {
    color: #888;
    font-size: 0.98em;
    margin-left: 0.7em;
}

/* Dark mode for admin list */
body.dark-mode .admin-list-item {
    background: var(--card-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-color) !important;
}

body.dark-mode .admin-list {
    background: transparent;
}

body.dark-mode .admin-current-user {
    color: #aaa;
}

.backup-checkbox {
    margin-right: 1rem;
    accent-color: var(--primary-color);
    width: 1.2em;
    height: 1.2em;
}

/* Add to your styles.css */
.backup-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    flex: 1;
}

.backup-filename {
    font-weight: 600;
    word-break: break-all;
}

.backup-meta {
    font-size: 0.97em;
    color: #888;
    margin-top: 2px;
}

/* Glow effect when selected */
.admin-list-item:has(.backup-checkbox:checked),
.admin-list-item.selected {
    background: #e8f7ee !important;
    box-shadow: 0 0 0 2px var(--primary-color), 0 2px 8px rgba(var(--primary-color-rgb, 46, 204, 113), 0.10);
    border-color: var(--primary-color) !important;
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
}

/* Bulk select image item styles */
.bulk-select-img-item {
    border: 2px solid transparent;
    background: var(--card-bg);
    transition: background 0.2s, border-color 0.2s;
    position: relative;
    cursor: pointer;
}

.bulk-select-img-item.selected {
    background: #e8f7ee !important;
    border: 2px solid var(--primary-color) !important;
    color: var(--text-color) !important;
    outline: none !important;
    box-shadow: none !important;
    z-index: 1;
}

.bulk-select-img-item.selected:focus {
    outline: none !important;
    box-shadow: none !important;
}

.bulk-select-img-item:focus {
    outline: none !important;
}

body.dark-mode .bulk-select-img-item {
    background: var(--card-bg);
    border: 2px solid transparent;
}

body.dark-mode .bulk-select-img-item.selected {
    background: #1f3428 !important;
    border: 2px solid var(--primary-color) !important;
    color: var(--text-color) !important;
    outline: none !important;
    box-shadow: none !important;
}

body.dark-mode .bulk-select-img-item.selected:focus {
    outline: none !important;
    box-shadow: none !important;
}

body.dark-mode .bulk-select-img-item:focus {
    outline: 2px solid var(--primary-color);
}

/* Toast notification styles */
.toast-container {
    position: fixed;
    top: 2.5rem;
    right: 2.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.toast {
    background: #222;
    color: #e8f7ee;
    padding: 1rem 1.5rem;
    border-radius: 0;
    font-size: 1.1rem;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.13);
    opacity: 0.97;
    border: 1px solid var(--primary-color);
    min-width: 220px;
    max-width: 400px;
    pointer-events: auto;
    animation: toast-in 0.3s;
}

@keyframes toast-in {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 0.97;
    }
}

@keyframes toast-out {
    from {
        transform: translateY(0);
        opacity: 0.97;
    }

    to {
        transform: translateY(-30px);
        opacity: 0;
    }
}

.categories>.category {
    display: flex;
    flex-direction: column;
    min-width: 0 !important;
    box-sizing: border-box;
}

.about-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 0 !important;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
    width: 100%;
    box-sizing: border-box;
}

.about-photo {
    max-width: 200px;
    display: block;
    margin: 0 auto 2rem auto;
}

@media (max-width: 900px) {
    .about-container {
        padding: 1rem;
        margin: 1rem 0.5rem;
        max-width: 98vw;
    }

    .about-photo {
        max-width: 140px;
        margin-bottom: 1.2rem;
    }
}

@media (max-width: 600px) {
    .about-container {
        padding: 1rem 0.5rem !important;
        margin: 0.5rem 0.1rem !important;
        max-width: 100vw !important;
        font-size: 1.08rem !important;
    }

    .about-content,
    .about-container,
    .admin-msg {
        font-size: 1.08rem !important;
        line-height: 1.6 !important;
    }

    .about-photo {
        max-width: 120px !important;
        margin-bottom: 1.2rem !important;
    }

    #markdown {
        font-size: 1.08rem !important;
        min-width: 0 !important;
        width: 100% !important;
        padding: 0.7rem !important;
    }

    label {
        font-size: 1.08rem !important;
    }

    .dropzone {
        font-size: 1.08rem !important;
        padding: 1.2rem 0.5rem !important;
    }

    button,
    .danger-btn {
        font-size: 1.08rem !important;
        padding: 1rem !important;
    }
}

#markdown {
    resize: vertical;
}

/* --- Admin Client Upload & Client Info --- */
.client-header {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    outline: none;
    border: 1.5px solid transparent;
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(90deg, var(--primary-hover) 0%, var(--primary-color) 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(var(--primary-color-rgb, 46, 204, 113), 0.13);
    transform: translateY(-2px) scale(1.03);
    border-color: var(--primary-hover);
}

.btn-primary:active {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: 0 1px 4px rgba(var(--primary-color-rgb, 46, 204, 113), 0.10);
    transform: none;
    border-color: var(--primary-hover);
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    background: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.file-input-wrapper:hover {
    background: var(--primary-hover);
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.upload-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 0;
    margin-bottom: 1rem;
    border: 1px solid #c3e6cb;
}

.access-info {
    background: var(--info-bg, #e8f4f8);
    border: 1px solid var(--info-border, #bee5eb);
    border-radius: 0;
    padding: 1rem;
    margin-top: 1rem;
    color: var(--info-text, inherit);
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

:root {
    --info-bg: #e8f4f8;
    --info-border: #bee5eb;
    --info-text: #155263;
}

@media (prefers-color-scheme: dark) {
    :root {
        --info-bg: #23293a;
        --info-border: #3a4157;
        --info-text: #e0e6f0;
    }
}

/* --- Admin Client New --- */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0;
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-color);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.password-generator {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.generate-btn {
    padding: 0.5rem 1rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.generate-btn:hover {
    background: var(--secondary-hover);
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 0;
    margin-bottom: 1rem;
}

/* --- Admin Clients --- */
.clients-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 1rem;
}

.client-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
    margin-bottom: 1.5rem;
    /* Add this if you want more vertical spacing */
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
}

.client-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.client-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.client-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.client-info h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.client-meta {
    display: block;
    margin-bottom: 0.2em;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.status-expired {
    background: #fff3cd;
    color: #856404;
}

.client-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.client-actions>* {
    vertical-align: middle;
    margin-bottom: 0 !important;
}

.client-actions .btn,
.client-actions button {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 0;
}

.btn-small {
    font-size: 0.85rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0 !important;
}

.btn.btn-small,
.btn-small {
    font-size: 0.85rem !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0 !important;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.create-client-btn {
    background: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 2rem;
    font-size: 1rem;
}

.create-client-btn:hover {
    background: var(--primary-hover);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0;
    padding: 1rem;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.message {
    background: #e8f7ee;
    color: #222;
    padding: 0.7rem 1rem;
    margin: 1rem auto 2rem auto;
    max-width: 400px;
    border: 1px solid var(--primary-color);
    border-radius: 0;
    text-align: center;
    font-size: 1.1rem;
}

/* --- Client Gallery --- */
.client-header {
    background: var(--card-bg);
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 0;
    border: 1px solid var(--border-color);
}

.client-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.download-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.download-btn {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.download-btn:hover {
    background: var(--primary-hover);
}

.download-btn.secondary {
    background: var(--secondary-color);
}

.download-btn.secondary:hover {
    background: var(--secondary-hover);
}

.image-item {
    position: relative;
    cursor: pointer;
}

.image-download {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.image-item:hover .image-download {
    opacity: 1;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.logout-btn:hover {
    background: #c82333;
}

.empty-state {
    text-align: center;
    margin: 2rem 0;
}

.gallery-container {
    max-width: 100vw;
    overflow-x: auto;
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
    font-size: 1.1rem;
}

.dropdown-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 0.5rem 1rem;
    text-decoration: none;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.dropdown-toggle:hover {
    color: var(--primary-color);
}

.dropdown-arrow {
    font-size: 0.7rem;
    margin-left: 0.3em;
    transition: transform 0.2s, color 0.2s;
    color: inherit;
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--hover-bg);
    color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed;
        top: auto;
        left: 1rem;
        right: 1rem;
        width: auto;
        min-width: auto;
    }
}

/* Modern switch toggle styles */
.switch-toggle-group {
    display: flex;
    align-items: center;
    gap: 0.7em;
    margin-bottom: 1em;
}

.switch-label-text {
    font-size: 1.1em;
    color: var(--text-color);
    opacity: 0.7;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.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: background 0.2s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--primary-color);
    transition: transform 0.2s, background 0.2s;
    border-radius: 50%;
}

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

.switch input:checked+.slider:before {
    transform: translateX(22px);
    background: var(--primary-hover);
}