:root {
    --bg: #000000;
    --surface: rgba(14, 14, 14, 0.9);
    --surface-strong: #141414;
    --ink: #c0c0c0;
    --muted: #9b9b9b;
    --line: rgba(192, 192, 192, 0.2);
    --accent: #d9d9d9;
    --accent-deep: #e6e6e6;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 30%),
        radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.05), transparent 35%),
        linear-gradient(160deg, #050505 0%, #000000 45%, #080808 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

.login-shell {
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.login-card,
.site-shell {
    width: min(100%, 800px);
    margin-left: auto;
    margin-right: auto;
}

.login-card {
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.eyebrow {
    margin: 0 0 0.5rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--accent-deep);
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.75rem;
    font-size: clamp(2.4rem, 8vw, 4.8rem);
    line-height: 0.95;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.intro-copy {
    max-width: 42rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}

.notice-box,
.placeholder-block {
    border-radius: 20px;
    border: 1px dashed rgba(192, 192, 192, 0.24);
    padding: 1rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
}

.notice-box {
    margin: 1.5rem 0;
}

.login-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.social-login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid rgba(192, 192, 192, 0.32);
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.social-login-button-google {
    background: #c0c0c0;
    color: #000;
}

.social-login-button-facebook {
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
}

.social-login-button:hover {
    border-color: rgba(230, 230, 230, 0.52);
    transform: translateY(-1px);
}

.social-login-button-google:hover {
    background: #dcdcdc;
}

.social-login-button-facebook:hover {
    background: rgba(255, 255, 255, 0.1);
}

.site-shell {
    padding: 1rem;
}

.site-header {
    z-index: 1000;
    position: sticky;
    top: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem auto 1.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(192, 192, 192, 0.3);
    flex-shrink: 0;
}

.menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    padding: 0.8rem 1rem;
}

.site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-top: 0.5rem;
}

.site-nav.open {
    display: flex;
}

.site-nav a,
.logout-form button {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.75rem 1rem;
    color: var(--muted);
    background: transparent;
    width: 100%;
    text-align: center;
}

.site-nav a.active,
.site-nav a:hover,
.logout-form button:hover {
    border-color: rgba(192, 192, 192, 0.35);
    background: rgba(192, 192, 192, 0.12);
    color: var(--ink);
}

.logout-form {
    margin: 0;
}

.page-layout {
    display: grid;
    gap: 1rem;
}

.hero-panel,
.content-card {
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 1.5rem;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.meta-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.2rem;
    margin-top: 0.2rem;
}

.meta-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.photos-layout {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 1rem;
}

.blogs-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.blog-list-panel {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.blogs-detail-panel {
    min-width: 0;
}

.blog-link-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.55rem;
}

.blog-list-link {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid rgba(192, 192, 192, 0.22);
    border-radius: 14px;
    padding: 0.6rem 0.85rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.blog-list-link:hover {
    border-color: rgba(192, 192, 192, 0.4);
    background: rgba(192, 192, 192, 0.1);
    transform: translateY(-1px);
}

.blog-list-link.active {
    border-color: rgba(140, 180, 255, 0.55);
    background: rgba(100, 150, 255, 0.14);
    color: #c8daff;
}

.blog-list-link-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
}

.blog-list-link-meta {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
}

.wide-card {
    width: 100%;
}

.photos-browser-panel,
.photos-detail-panel {
    min-height: 24rem;
}

.photos-browser-panel {
    display: flex;
    flex-direction: column;
    max-height: 72vh;
}

.photos-detail-panel {
    display: flex;
    flex-direction: column;
    max-height: 72vh;
}

#photo-thumbnails-container {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 0.25rem;
}

/* ── Folder search ─────────────────────────────────────────────── */
.folder-search-wrap {
    position: relative;
    margin-bottom: 0.85rem;
}

.folder-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(192, 192, 192, 0.25);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    font-size: 0.9rem;
    outline: none;
}

.folder-search-input:focus {
    border-color: rgba(192, 192, 192, 0.55);
    background: rgba(255, 255, 255, 0.08);
}

.folder-search-input::placeholder {
    color: var(--muted);
}

/* hide the native clear button in webkit so we control the layout */
.folder-search-input::-webkit-search-cancel-button {
    opacity: 0.5;
    cursor: pointer;
}

.folder-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    list-style: none;
    margin: 0;
    padding: 0.3rem 0;
    background: var(--surface, #1e1e1e);
    border: 1px solid rgba(192, 192, 192, 0.25);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
    max-height: 25vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.folder-search-result {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    border-radius: 7px;
    margin: 0 0.3rem;
    transition: background 0.1s ease;
}

.folder-search-result:hover {
    background: rgba(192, 192, 192, 0.11);
}

.folder-search-result-name {
    font-size: 0.9rem;
    color: var(--ink);
}

.folder-search-result-path {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-search-empty {
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: default;
}
/* ── End folder search ──────────────────────────────────────────── */

/* ── Blog post search ───────────────────────────────────────────── */
.blog-search-panel {
    gap: 0.75rem;
    overflow: visible;
    isolation: auto;
}

.blog-search-wrap {
    position: relative;
}

.blog-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.85rem;
    border: 1px solid rgba(192, 192, 192, 0.25);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    font-size: 0.95rem;
    outline: none;
}

.blog-search-input:focus {
    border-color: rgba(192, 192, 192, 0.55);
    background: rgba(255, 255, 255, 0.08);
}

.blog-search-input::placeholder {
    color: var(--muted);
}

.blog-search-results {
    position: fixed;
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: 0.3rem 0;
    background: var(--surface);
    border: 1px solid rgba(192, 192, 192, 0.25);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
    max-height: 28vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.blog-search-result {
    display: block;
}

.blog-search-result-link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.85rem;
    color: var(--ink);
    transition: background 0.15s ease;
}

.blog-search-result-link:hover {
    background: rgba(192, 192, 192, 0.1);
}

.blog-search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-search-result-meta {
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-search-result-empty {
    padding: 0.6rem 0.85rem;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: default;
}

.blog-post-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
    grid-column: 1 / -1;
}

.blog-post-breadcrumb a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.blog-post-breadcrumb a:hover {
    color: var(--accent-deep);
}
/* ── End blog post search ────────────────────────────────────────── */

.folder-tree,
.folder-children {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.folder-tree {
    margin-top: 1rem;
}

.folder-tree-scroll {
    margin-top: 0.85rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 0.25rem;
}

.folder-tree-scroll .folder-tree {
    margin-top: 0;
}

.folder-children {
    padding-left: 1rem;
    margin-top: 0.35rem;
    border-left: 1px dashed rgba(192, 192, 192, 0.2);
}

.folder-node {
    margin-bottom: 0.3rem;
}

.folder-node-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid rgba(192, 192, 192, 0.18);
    border-radius: 12px;
    padding: 0.5rem 0.65rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    cursor: pointer;
}

.folder-node-toggle:hover,
.folder-node-toggle.active {
    border-color: rgba(192, 192, 192, 0.4);
    background: rgba(192, 192, 192, 0.11);
}

.folder-caret {
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid rgba(230, 230, 230, 0.9);
    transition: transform 0.2s ease;
}

.folder-node-toggle[aria-expanded="true"] .folder-caret {
    transform: rotate(90deg);
}

.folder-node-toggle[data-has-children="0"] .folder-caret {
    visibility: hidden;
}

.photos-meta-row {
    grid-template-columns: 1fr;
    margin-bottom: 1rem;
}

.photos-empty-message {
    color: rgba(192, 192, 192, 0.5);
    font-size: 0.9rem;
    margin: 0;
}

.photos-loading {
    color: rgba(192, 192, 192, 0.5);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.photo-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

.photo-thumb-link {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(192, 192, 192, 0.15);
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.15s ease;
    padding: 0;
    cursor: zoom-in;
}

.photo-thumb-link:hover {
    border-color: rgba(192, 192, 192, 0.45);
}

.photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-thumb-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0.2rem 0.35rem;
    background: rgba(0, 0, 0, 0.58);
    color: #ffffff;
    font-size: 0.62rem;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

body.photo-viewer-open {
    overflow: hidden;
}

.photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: start;
}

.photo-viewer[hidden] {
    display: none !important;
}

.photo-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.84);
}

.photo-viewer-panel {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
    border: 1px solid rgba(192, 192, 192, 0.28);
    border-radius: 0;
    overflow: hidden;
    background: rgba(13, 13, 13, 0.96);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
}

.photo-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(192, 192, 192, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

.photo-viewer-counter {
    color: var(--muted);
    font-size: 0.9rem;
}

.photo-viewer-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.photo-viewer-btn {
    border: 1px solid rgba(192, 192, 192, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--ink);
    padding: 0.38rem 0.75rem;
    cursor: pointer;
}

.photo-viewer-btn:hover {
    background: rgba(192, 192, 192, 0.12);
}

.photo-viewer-stage {
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    touch-action: pan-y;
}

.photo-viewer-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}

.content-card.wide {
    grid-column: 1 / -1;
}

.blog-card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.home-blog-grid {
    grid-template-columns: 1fr;
    justify-items: center;
}

.home-blog-grid .blog-card {
    width: min(100%, 980px);
    margin-inline: auto;
}

.blog-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.blog-post-date {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.blog-order-controls {
    display: inline-flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.blog-order-link,
.blog-load-more-link {
    border: 1px solid rgba(192, 192, 192, 0.35);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.82rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

.blog-order-link:hover,
.blog-load-more-link:hover {
    background: rgba(192, 192, 192, 0.1);
}

.blog-order-link.active {
    border-color: rgba(192, 192, 192, 0.6);
    background: rgba(192, 192, 192, 0.2);
}

.blog-order-link:disabled,
.blog-load-more-link:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.blog-results-meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.blog-post-list {
    display: grid;
    gap: 0.85rem;
}

.blog-post-item {
    position: relative;
    overflow: hidden;
    text-align: center;
    border: 1px solid rgba(230, 230, 230, 0.2);
    border-radius: 16px;
    padding: 0.95rem;
    background:
        linear-gradient(155deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 12px 28px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.blog-post-item::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.2), transparent 46%),
        linear-gradient(140deg, rgba(255, 255, 255, 0.08), transparent 45%);
    pointer-events: none;
}

.blog-post-item:hover {
    transform: translateY(-2px);
    border-color: rgba(235, 235, 235, 0.42);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 16px 34px rgba(0, 0, 0, 0.38);
}

.blog-post-title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.blog-post-text {
    margin: 0.5rem 0 0;
    white-space: normal;
    line-height: 1.6;
    margin-left: auto;
    margin-right: auto;
    max-width: 72ch;
}

.blog-post-image-wrap {
    margin-top: 0.75rem;
}

.blog-post-image {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(192, 192, 192, 0.2);
    display: block;
    margin-inline: auto;
}

.blog-post-link-wrap {
    margin: 0.75rem 0 0;
}

.blog-post-link {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.blog-load-more-wrap {
    margin: 0.15rem 0 0;
}

.placeholder-block {
    min-height: 12rem;
    display: grid;
    place-items: center;
    color: var(--accent-deep);
    font-weight: 700;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        repeating-linear-gradient(
            45deg,
            rgba(192, 192, 192, 0.04) 0,
            rgba(192, 192, 192, 0.04) 12px,
            transparent 12px,
            transparent 24px
        );
}

.placeholder-block.alt {
    color: #b3b3b3;
}

/* ── Edit Blogs ──────────────────────────────────────────────────────────── */

.edit-blog-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 1px solid rgba(192, 192, 192, 0.22);
    border-radius: 14px;
    padding: 0.55rem 0.6rem 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.edit-blog-card:hover {
    border-color: rgba(192, 192, 192, 0.38);
    background: rgba(192, 192, 192, 0.08);
}

.edit-blog-card-title {
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.three-dot-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.three-dot-btn:hover,
.three-dot-btn[aria-expanded="true"] {
    border-color: rgba(192, 192, 192, 0.35);
    background: rgba(192, 192, 192, 0.12);
    color: var(--ink);
}

.ctx-menu {
    position: fixed;
    z-index: 1100;
    list-style: none;
    margin: 0;
    padding: 0.3rem 0;
    min-width: 160px;
    background: var(--surface-strong);
    border: 1px solid rgba(192, 192, 192, 0.25);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
}

.ctx-menu-item {
    display: block;
    width: 100%;
    padding: 0.55rem 1rem;
    text-align: left;
    background: transparent;
    border: 0;
    color: var(--ink);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.12s ease;
}

.ctx-menu-item:hover {
    background: rgba(192, 192, 192, 0.1);
}

.ctx-menu-item-danger {
    color: #ff7070;
}

.ctx-menu-item-danger:hover {
    background: rgba(255, 80, 80, 0.12);
}

/* Edit panel (wraps the active form card) */
.edit-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-panel[hidden] {
    display: none;
}

/* Edit form fields */
.edit-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}

.edit-form-header h2 {
    margin-bottom: 0;
}

.edit-field-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    align-items: start;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.65rem;
}

.edit-field-label {
    padding-top: 0.5rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}

.edit-field-input,
.edit-field-textarea,
.edit-lookup-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(192, 192, 192, 0.25);
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s ease;
}

.edit-field-input:focus,
.edit-field-textarea:focus,
.edit-lookup-input:focus {
    outline: none;
    border-color: rgba(140, 180, 255, 0.55);
}

.edit-field-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.edit-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

.edit-btn {
    padding: 0.5rem 1.1rem;
    border: 1px solid rgba(192, 192, 192, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.edit-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(192, 192, 192, 0.5);
}

.edit-btn-primary {
    background: rgba(100, 150, 255, 0.18);
    border-color: rgba(140, 180, 255, 0.45);
    color: #c8daff;
}

.edit-btn-primary:hover {
    background: rgba(100, 150, 255, 0.3);
}

.edit-btn-danger {
    background: rgba(200, 60, 60, 0.14);
    border-color: rgba(255, 100, 100, 0.35);
    color: #ff9090;
}

.edit-btn-danger:hover {
    background: rgba(200, 60, 60, 0.28);
}

.edit-msg {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    min-height: 1.2em;
}

.edit-msg-ok  { color: #7dcc88; }
.edit-msg-err { color: #ff7070; }

/* Post list */
.edit-post-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
}

.edit-post-item {
    border: 1px solid rgba(192, 192, 192, 0.18);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
}

.edit-post-item.is-new {
    border-style: dashed;
    border-color: rgba(140, 180, 255, 0.35);
    background: rgba(100, 150, 255, 0.04);
}

.edit-post-item-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.edit-loading {
    color: var(--muted);
    font-style: italic;
}

/* Lookup (image file / folder search within post forms) */
.lookup-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.lookup-selected {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.4em;
    font-size: 0.82rem;
    color: var(--muted);
    overflow: hidden;
}

.lookup-selected-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(192, 192, 192, 0.2);
    flex-shrink: 0;
}

.lookup-selected-path {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lookup-clear-btn {
    flex-shrink: 0;
    padding: 0.1rem 0.45rem;
    border: 1px solid rgba(192, 192, 192, 0.22);
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 0.78rem;
    cursor: pointer;
}

.lookup-clear-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ink);
}

.lookup-results {
    position: fixed;
    z-index: 1050;
    list-style: none;
    margin: 0;
    padding: 0.3rem 0;
    background: var(--surface-strong);
    border: 1px solid rgba(192, 192, 192, 0.25);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
    max-height: 26vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.lookup-result-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.12s ease;
}

.lookup-result-item:hover {
    background: rgba(192, 192, 192, 0.1);
}

.lookup-result-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid rgba(192, 192, 192, 0.15);
    flex-shrink: 0;
}

.lookup-result-path {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
}

/* ── Photo thumb 3-dot overlay ───────────────────────────────────────────── */

.photo-thumb-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(192, 192, 192, 0.15);
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.15s ease;
}

.photo-thumb-wrap:hover {
    border-color: rgba(192, 192, 192, 0.45);
}

.photo-thumb-wrap > .photo-thumb-link {
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
    border-radius: 0;
    border: none;
    background: none;
}

.photo-thumb-dot-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.photo-thumb-wrap:hover .photo-thumb-dot-btn,
.photo-thumb-dot-btn:focus,
.photo-thumb-dot-btn[aria-expanded="true"] {
    opacity: 1;
}

.photo-thumb-dot-btn:hover,
.photo-thumb-dot-btn[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.85);
}

/* ── Add-to-Blog modal ───────────────────────────────────────────────────── */

.atb-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.atb-modal-overlay[hidden] {
    display: none !important;
}

body.atb-modal-open {
    overflow: hidden;
}

.atb-modal-panel {
    width: min(100%, 600px);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 1.5rem;
    background: var(--surface-strong);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

@media (max-width: 800px) {
    .content-grid,
    .photos-layout,
    .blogs-layout {
        grid-template-columns: 1fr;
    }

    .photos-browser-panel {
        max-height: none;
    }

    .photos-detail-panel {
        max-height: none;
    }

    .folder-tree-scroll {
        max-height: 30vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 0 0 auto;
    }

    #photo-thumbnails-container {
        max-height: 30vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 0 0 auto;
    }

    .photo-viewer-panel {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .photo-viewer-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .photo-viewer-actions {
        justify-content: stretch;
    }

    .photo-viewer-btn {
        flex: 1 1 0;
    }
}

/* ── Users page ──────────────────────────────────────────────────────────── */

.user-search-wrap {
    margin-top: 0.75rem;
}

.user-card-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    transition: border-color 0.15s ease;
}

.user-card[hidden] {
    display: none;
}

.user-card:hover {
    border-color: rgba(192, 192, 192, 0.4);
}

.user-card-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.user-card-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    user-select: none;
}

.user-card-info {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.user-card-name {
    font-size: 0.9rem;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-card-email,
.user-card-roles {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Calendar ────────────────────────────────────────────────────── */
.cal-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.cal-search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font-size: 0.95rem;
    padding: 0.45rem 2.2rem 0.45rem 0.7rem;
    outline: none;
    transition: border-color 0.15s;
}

.cal-search-input:focus {
    border-color: var(--accent);
}

.cal-search-clear {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.1rem 0.3rem;
}

.cal-search-status {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.cal-load-prev-btn {
    background: none;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    cursor: pointer;
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.85rem;
    padding: 0.4rem 0.9rem;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
    width: 100%;
}

.cal-load-prev-btn:hover {
    background: var(--surface-strong);
    border-color: var(--accent);
}

.cal-load-prev-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cal-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cal-day-row {
    border-top: 1px solid var(--line);
    padding: 0.6rem 0 0.6rem;
}

.cal-day-row:first-child {
    border-top: none;
}

.cal-day-row--today .cal-day-header {
    color: var(--accent);
}

.cal-day-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.cal-day-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: inherit;
}

.cal-today-badge {
    background: var(--accent);
    border-radius: 4px;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.45rem;
    text-transform: uppercase;
}

.cal-events-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-left: 0.25rem;
}

.cal-event-chip {
    background: var(--surface-strong);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.3rem 0.6rem;
    position: relative;
}

.cal-chip-edit-btn {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0;
    padding: 0;
    transition: opacity 0.15s;
}

.cal-event-chip:hover .cal-chip-edit-btn {
    opacity: 1;
}

.cal-chip-edit-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.cal-chip-input {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 3px;
    color: var(--ink);
    font-size: 0.82rem;
    padding: 2px 5px;
}

.cal-chip-input:focus {
    border-color: var(--accent);
    outline: none;
}

.cal-chip-msg {
    color: #c0392b;
    font-size: 0.75rem;
    margin-top: 2px;
}

.cal-event-name {
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.3;
}

.cal-event-meta {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.3;
}

.cal-sentinel {
    height: 1px;
}

.cal-load-msg {
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
    text-align: center;
}

.cal-load-msg--err {
    color: #c0392b;
}

.cal-load-more-msg {
    color: var(--muted);
    font-size: 0.82rem;
    padding: 0.5rem 0;
    text-align: center;
}

/* ── Edit Calendar page layout ──────────────────────────────────── */
.caledit-layout {
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
}

.caledit-main-card {
    width: 100%;
    box-sizing: border-box;
}

.caledit-filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    margin-bottom: 12px;
}

.caledit-list-scroll {
    max-height: 60vh;
    overflow-y: auto;
}

/* ── Edit Calendar inline-bulk rows ─────────────────────────────── */
.caledit-grid-header {
    display: flex;
    gap: 5px;
    padding: 4px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface);
}

.caledit-grid-header span:first-child { flex: 2; min-width: 130px; }
.caledit-grid-header span:nth-child(2) { width: 100px; flex-shrink: 0; }
.caledit-grid-header span:nth-child(3) { width: 100px; flex-shrink: 0; }
.caledit-grid-header span:nth-child(4) { width: 100px; flex-shrink: 0; }
.caledit-grid-header span:nth-child(5) { width: 52px;  flex-shrink: 0; }
.caledit-grid-header span:nth-child(6) { width: 140px; flex-shrink: 0; }
.caledit-grid-header span:last-child   { flex-shrink: 0; width: 130px; }

.caledit-inline-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    padding: 5px 6px;
    border-bottom: 1px solid var(--line);
}

.caledit-inline-row:last-child {
    border-bottom: none;
}

.caledit-inline-name  { flex: 2; min-width: 130px; }
.caledit-inline-type  { width: 100px; flex-shrink: 0; }
.caledit-inline-rec   { width: 100px; flex-shrink: 0; }
.caledit-inline-month { width: 100px; flex-shrink: 0; }
.caledit-inline-day   { width: 52px;  flex-shrink: 0; }

.caledit-year-group {
    display: flex;
    gap: 4px;
    width: 140px;
    flex-shrink: 0;
}

.caledit-year-group input {
    min-width: 0;
    width: 66px;
}

.caledit-row-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.caledit-row-actions .edit-btn {
    padding: 0.28rem 0.7rem;
    font-size: 0.8rem;
}

.caledit-row-msg {
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 48px;
}
