/* ============================================
   FRKHD - Blog
   Matches the landing aesthetic: sky blue, Clash Display + Satoshi,
   mobile-first, light/airy.
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f0f6ff;
    --surface: rgba(255, 255, 255, 0.58);
    --surface-solid: #ffffff;
    --text: #0c1a2e;
    --text-dim: #6b7f99;
    --text-muted: #8a9bb3;
    --border: rgba(12, 26, 46, 0.07);
    --border-strong: rgba(12, 26, 46, 0.14);
    --accent-1: #2d8cf0;
    --accent-2: #0ea5e9;
    --accent-gradient: linear-gradient(135deg, #2d8cf0, #0ea5e9);
    --accent-soft: rgba(45, 140, 240, 0.08);
    --pinned-tint: rgba(45, 140, 240, 0.04);
    --radius: 18px;
    --radius-sm: 12px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --font-display: 'Clash Display', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shadow-soft: 0 10px 30px -15px rgba(12, 26, 46, 0.12);
    --shadow-hover: 0 18px 44px -18px rgba(12, 26, 46, 0.18);
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(45, 140, 240, 0.1), transparent),
        radial-gradient(ellipse 50% 40% at 100% 50%, rgba(14, 165, 233, 0.06), transparent);
    pointer-events: none;
}

a {
    color: var(--accent-1);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-2);
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

::selection {
    background: var(--accent-2);
    color: #fff;
}

.page-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(240, 246, 255, 0.72);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: transform 0.35s var(--ease);
}

.header-logo:hover {
    color: var(--text);
    text-decoration: none;
}

.header-logo:hover .header-logo-icon {
    transform: rotate(-6deg) scale(1.08);
}

.header-logo-icon {
    transition: transform 0.4s var(--ease);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-link {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-dim);
    padding: 0.35em 0;
    position: relative;
    transition: color 0.25s ease;
}

.header-link:hover {
    color: var(--accent-1);
    text-decoration: none;
}

.header-link--active {
    color: var(--text);
}

.header-link--active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 1px;
}

/* ============================================
   LAYOUT
   ============================================ */
.content-wrapper {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    align-items: start;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: sticky;
    top: calc(64px + 2rem);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-card,
.autopublish-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.profile-card {
    padding: 1.5rem;
    text-align: center;
}

.profile-avatar {
    display: flex;
    justify-content: center;
    margin-bottom: 0.9rem;
}

.avatar-placeholder {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    box-shadow: 0 8px 22px -10px rgba(45, 140, 240, 0.55);
}

.avatar-sm {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    box-shadow: 0 4px 10px -5px rgba(45, 140, 240, 0.45);
}

.profile-info {
    margin-bottom: 1rem;
}

.profile-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    font-size: 0.88rem;
}

.detail-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    justify-content: center;
    color: var(--text-dim);
}

.detail-row a {
    color: var(--text-dim);
    transition: color 0.2s ease;
}

.detail-row a:hover {
    color: var(--accent-1);
    text-decoration: none;
}

.detail-icon {
    font-size: 0.92rem;
    opacity: 0.8;
}

.profile-stats {
    display: flex;
    justify-content: center;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-count {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.autopublish-card {
    padding: 1rem 1.1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: linear-gradient(135deg, rgba(45, 140, 240, 0.05), rgba(14, 165, 233, 0.03));
}

.autopublish-icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.autopublish-text {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-dim);
}

.autopublish-text strong {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}

.autopublish-text p {
    margin: 0;
}

/* ============================================
   FEED
   ============================================ */
.feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.empty-feed {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4rem 1.5rem;
    text-align: center;
    color: var(--text-dim);
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.empty-feed p {
    font-size: 0.95rem;
}

.post-card {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
        border-color 0.35s var(--ease);
    overflow: hidden;
}

.post-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-soft);
}

.post-card--pinned {
    background:
        linear-gradient(var(--surface-solid), var(--surface-solid)) padding-box,
        var(--accent-gradient) border-box;
    border: 1px solid transparent;
    background-color: var(--pinned-tint);
}

.post-pinned-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-1);
    background: var(--accent-soft);
    padding: 0.3em 0.8em;
    border-radius: 100px;
    margin-bottom: 1rem;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.95rem;
}

.post-avatar {
    flex-shrink: 0;
}

.post-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.post-author {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--text);
    letter-spacing: -0.005em;
}

.post-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-mood {
    font-size: 1.1rem;
    flex-shrink: 0;
    opacity: 0.95;
}

.post-content {
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    /* pre-line preserves \n as line breaks but collapses consecutive whitespace
       (leading tabs / multiple spaces). Combined with removing nl2br() in PHP,
       that means one \n per visible line, no double spacing. */
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-content + .post-image,
.post-content + .post-video,
.post-content + .post-gallery {
    margin-top: 1.1rem;
}

.post-image,
.post-video {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--accent-soft);
}

.post-image img,
.post-video video {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    background: #000;
}

.post-gallery {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--accent-soft);
}

.post-gallery .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-gallery .swiper-slide img,
.post-gallery .swiper-slide video {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    background: #000;
}

.post-gallery .swiper-button-prev,
.post-gallery .swiper-button-next {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    color: var(--text);
    box-shadow: 0 4px 14px -4px rgba(12, 26, 46, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.post-gallery .swiper-button-prev::after,
.post-gallery .swiper-button-next::after {
    font-size: 14px;
    font-weight: 700;
}

.post-gallery .swiper-pagination {
    --swiper-pagination-color: #fff;
    --swiper-pagination-bullet-inactive-color: #fff;
    --swiper-pagination-bullet-inactive-opacity: 0.55;
}

.gallery-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(12, 26, 46, 0.65);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25em 0.65em;
    border-radius: 100px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.post-footer {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-footer-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: all 0.25s ease;
}

.page-link:hover {
    background: var(--surface-solid);
    color: var(--accent-1);
    border-color: rgba(45, 140, 240, 0.3);
    text-decoration: none;
}

.page-link--active {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 16px -6px rgba(45, 140, 240, 0.55);
    cursor: default;
}

.page-link--active:hover {
    color: #fff;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.site-footer a {
    color: var(--text-dim);
}

.footer-sep {
    opacity: 0.4;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 240px 1fr;
        gap: 1.75rem;
        padding: 1.5rem 1.25rem;
    }

    .header-inner {
        padding: 0.8rem 1.25rem;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 14.5px;
    }

    .header-inner {
        padding: 0.7rem 1rem;
    }

    .header-logo {
        font-size: 0.98rem;
    }

    .header-logo span {
        display: none;
    }

    .header-nav {
        gap: 1rem;
    }

    .header-link {
        font-size: 0.88rem;
    }

    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 0.9rem;
        padding: 0.9rem 1rem 1.25rem;
    }

    /* Compact identity strip on mobile - one card, one row. */
    .sidebar {
        position: static;
        flex-direction: column;
        gap: 0.6rem;
    }

    /* Identity strip: avatar + name + stat pill, single line, no noise. */
    .profile-card {
        padding: 0.85rem 1rem;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 0.85rem;
        text-align: left;
        flex-wrap: nowrap;
    }

    .profile-avatar {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .avatar-placeholder {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
        box-shadow: 0 4px 12px -6px rgba(45, 140, 240, 0.5);
    }

    .profile-info {
        margin-bottom: 0;
        flex: 1 1 auto;
        min-width: 0;
    }

    .profile-name {
        font-size: 1rem;
        line-height: 1.15;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Email + site link live in the header/footer already - hide on mobile. */
    .profile-details {
        display: none;
    }

    .profile-stats {
        flex-shrink: 0;
    }

    .stat {
        flex-direction: row;
        align-items: baseline;
        gap: 0.35rem;
        padding: 0.3em 0.75em;
        border-radius: 100px;
        background: var(--accent-soft);
    }

    .stat-count {
        font-size: 0.9rem;
    }

    .stat-label {
        font-size: 0.62rem;
        letter-spacing: 0.08em;
    }

    /* Autopublish - short, single-line, collapsible feel */
    .autopublish-card {
        padding: 0.7rem 0.9rem;
        gap: 0.55rem;
    }

    .autopublish-icon {
        font-size: 0.95rem;
    }

    .autopublish-text {
        font-size: 0.78rem;
        line-height: 1.45;
    }

    .autopublish-text strong {
        font-size: 0.8rem;
        margin-bottom: 0.15rem;
    }

    .post-card {
        padding: 1.05rem 1.1rem;
        border-radius: var(--radius-sm);
    }

    .post-header {
        margin-bottom: 0.7rem;
    }

    .post-author {
        font-size: 0.95rem;
    }

    .post-time {
        font-size: 0.75rem;
    }

    .post-content {
        font-size: 0.96rem;
        line-height: 1.6;
    }

    .post-image img,
    .post-video video,
    .post-gallery .swiper-slide img,
    .post-gallery .swiper-slide video {
        max-height: 480px;
    }

    .post-gallery .swiper-button-prev,
    .post-gallery .swiper-button-next {
        width: 34px;
        height: 34px;
    }

    .post-gallery .swiper-button-prev::after,
    .post-gallery .swiper-button-next::after {
        font-size: 12px;
    }

    .post-footer {
        margin-top: 0.8rem;
        padding-top: 0.7rem;
    }

    .page-link {
        min-width: 32px;
        height: 32px;
        padding: 0 0.75rem;
        font-size: 0.82rem;
    }
}

@media (max-width: 380px) {
    .content-wrapper {
        padding: 0.75rem;
    }

    .post-card {
        padding: 0.95rem;
    }

    .profile-card {
        padding: 0.75rem 0.85rem;
    }
}

/* Dark mode follows system preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a1220;
        --surface: rgba(20, 32, 52, 0.6);
        --surface-solid: #101a2c;
        --text: #e8eef7;
        --text-dim: #9dafc7;
        --text-muted: #6b7f99;
        --border: rgba(255, 255, 255, 0.08);
        --border-strong: rgba(255, 255, 255, 0.14);
        --pinned-tint: rgba(45, 140, 240, 0.08);
    }

    body::before {
        background:
            radial-gradient(ellipse 80% 50% at 50% -10%, rgba(45, 140, 240, 0.12), transparent),
            radial-gradient(ellipse 50% 40% at 100% 50%, rgba(14, 165, 233, 0.06), transparent);
    }

    .site-header {
        background: rgba(10, 18, 32, 0.72);
    }

    .post-gallery .swiper-button-prev,
    .post-gallery .swiper-button-next {
        background: rgba(20, 32, 52, 0.92);
        color: var(--text);
    }
}

/* ============================================
   ADMIN - panel-specific components
   ============================================ */

/* --- Alerts --- */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}

.alert--success {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.22);
    color: #166534;
}

.alert--error {
    background: rgba(239, 68, 68, 0.07);
    border-color: rgba(239, 68, 68, 0.22);
    color: #9f1f1f;
}

/* --- Admin feed wrapper - single column, no sidebar --- */
.admin-feed {
    grid-column: 1 / -1;
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
}

.content-wrapper:has(.admin-feed) {
    grid-template-columns: 1fr;
}

.admin-section-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--text);
    margin: 1rem 0 0.3rem;
    padding-left: 0.25rem;
}

/* --- Post form card --- */
.post-form-card {
    padding: 1.25rem 1.5rem 1.1rem;
}

.post-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.form-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text);
    font-size: 1.02rem;
    letter-spacing: -0.005em;
}

.post-textarea {
    width: 100%;
    resize: vertical;
    min-height: 100px;
    padding: 0.85rem 1rem;
    font-family: var(--font-body);
    font-size: 0.98rem;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.post-textarea:focus {
    border-color: rgba(45, 140, 240, 0.4);
    box-shadow: 0 0 0 3px rgba(45, 140, 240, 0.1);
}

.post-textarea::placeholder {
    color: var(--text-muted);
}

/* --- Existing media preview grid --- */
.existing-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}

.existing-media-title {
    grid-column: 1 / -1;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 0.15rem;
}

.existing-media-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.existing-media-item img,
.existing-media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s ease;
}

.existing-media-item input[type="checkbox"] {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    margin: 0;
    z-index: 2;
    cursor: pointer;
    accent-color: #ef4444;
}

.existing-media-item:has(input:checked) {
    border-color: #ef4444;
}

.existing-media-item:has(input:checked) img,
.existing-media-item:has(input:checked) video {
    opacity: 0.45;
}

.media-type-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(12, 26, 46, 0.65);
    color: #fff;
    font-size: 0.72rem;
    padding: 0.15em 0.45em;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* --- Form footer (buttons row) --- */
.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}

.form-actions-left,
.form-actions-right {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

/* --- File upload label (fake-button) --- */
.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5em 0.9em;
    background: var(--accent-soft);
    border: 1px solid rgba(45, 140, 240, 0.18);
    border-radius: 100px;
    color: var(--accent-1);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.file-upload-label:hover {
    background: rgba(45, 140, 240, 0.14);
    border-color: rgba(45, 140, 240, 0.35);
}

.file-upload-input {
    display: none;
}

.file-name-display {
    font-size: 0.78rem;
    color: var(--text-dim);
}

/* --- Mood + draft + datetime controls --- */
.mood-select select,
.datetime-input {
    padding: 0.42em 0.75em;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 100px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.datetime-input {
    cursor: text;
    min-width: 130px;
}

.mood-select select:focus,
.datetime-input:focus {
    border-color: rgba(45, 140, 240, 0.4);
    box-shadow: 0 0 0 3px rgba(45, 140, 240, 0.1);
}

.datetime-fields {
    display: flex;
    gap: 0.35rem;
}

.draft-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42em 0.85em;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 100px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
    user-select: none;
}

.draft-toggle input {
    margin: 0;
    accent-color: var(--accent-1);
}

.draft-toggle:has(input:checked) {
    color: var(--accent-1);
    border-color: rgba(45, 140, 240, 0.35);
    background: var(--accent-soft);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55em 1.15em;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 100px;
    cursor: pointer;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
        background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
    white-space: nowrap;
}

.btn--primary {
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 6px 16px -8px rgba(45, 140, 240, 0.55);
}

.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -8px rgba(45, 140, 240, 0.65);
    color: #fff;
    text-decoration: none;
}

.btn--secondary {
    color: var(--text-dim);
    background: var(--surface-solid);
    border-color: var(--border);
}

.btn--secondary:hover {
    color: var(--text);
    border-color: var(--border-strong);
    text-decoration: none;
}

.btn--full {
    width: 100%;
    padding: 0.7em 1.2em;
    font-size: 0.95rem;
}

/* --- Post admin action bar --- */
.post-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35em 0.85em;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 100px;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.admin-btn:hover {
    text-decoration: none;
    color: var(--text);
    border-color: var(--border-strong);
}

.admin-btn--edit:hover {
    color: var(--accent-1);
    border-color: rgba(45, 140, 240, 0.35);
    background: var(--accent-soft);
}

.admin-btn--pin:hover {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.35);
    background: rgba(217, 119, 6, 0.07);
}

.admin-btn--delete:hover {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.06);
}

.post-draft-badge {
    color: var(--text-muted);
    background: rgba(12, 26, 46, 0.05);
}

.post-card--draft {
    opacity: 0.82;
}

/* --- Header: logout link tint --- */
.header-link--logout {
    color: var(--text-muted);
}

.header-link--logout:hover {
    color: #dc2626;
}

/* ============================================
   LOGIN
   ============================================ */
.login-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    box-shadow: var(--shadow-soft);
}

.login-title {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 1.25rem;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.01em;
}

.form-group input {
    padding: 0.7em 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    border-color: rgba(45, 140, 240, 0.4);
    box-shadow: 0 0 0 3px rgba(45, 140, 240, 0.1);
}

.login-back {
    display: block;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ============================================
   ADMIN - mobile
   ============================================ */
@media (max-width: 720px) {
    .admin-feed {
        max-width: none;
    }

    .post-form-card {
        padding: 1rem 1.1rem 0.9rem;
    }

    .post-textarea {
        font-size: 0.95rem;
        padding: 0.7rem 0.85rem;
    }

    .form-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }

    .form-actions-left,
    .form-actions-right {
        width: 100%;
        justify-content: flex-start;
    }

    .form-actions-right {
        justify-content: space-between;
    }

    .datetime-fields {
        flex: 1 1 auto;
    }

    .datetime-input {
        min-width: 0;
        flex: 1;
    }

    .btn {
        padding: 0.55em 1rem;
        font-size: 0.85rem;
    }

    .admin-btn {
        font-size: 0.76rem;
        padding: 0.3em 0.7em;
    }

    .existing-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    .login-card {
        padding: 1.5rem 1.25rem;
    }

    .login-title {
        font-size: 1.25rem;
    }
}

/* ============================================
   STATS - analytics dashboard
   ============================================ */

/* Range selector (pill group) */
.stats-range {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
    align-items: center;
}

.range-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.42em 0.95em;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-dim);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 100px;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.range-btn:hover {
    color: var(--accent-1);
    border-color: rgba(45, 140, 240, 0.3);
    background: var(--accent-soft);
    text-decoration: none;
}

.range-btn--active {
    color: #fff;
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 4px 12px -6px rgba(45, 140, 240, 0.5);
}

.range-btn--active:hover {
    color: #fff;
    background: var(--accent-gradient);
}

.range-btn--toggle {
    margin-left: auto;
}

/* Info alert variant */
.alert--info {
    background: rgba(45, 140, 240, 0.07);
    border-color: rgba(45, 140, 240, 0.22);
    color: #1f5899;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
}

/* Big-number stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.5rem;
}

.stat-card {
    padding: 1.25rem 1.35rem;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.stat-card-num {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text) 40%, var(--accent-1) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.3rem;
}

.stat-card-label {
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Section with bars */
.stats-section {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.4rem;
}

.stats-section .admin-section-title {
    margin: 0 0 0.9rem;
    padding: 0;
    font-size: 0.95rem;
}

.stats-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

/* Bar rows */
.bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 25%) 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.42rem 0;
    font-size: 0.86rem;
}

.bar-row + .bar-row {
    border-top: 1px dashed var(--border);
}

.bar-label {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-label--mono {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78rem;
    color: var(--text-dim);
}

.bar-track {
    height: 8px;
    background: var(--accent-soft);
    border-radius: 100px;
    overflow: hidden;
    min-width: 60px;
}

.bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 100px;
    transition: width 0.6s var(--ease);
}

.bar-fill--danger {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.bar-value {
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-dim);
    white-space: nowrap;
}

/* Hours histogram */
.hours-chart {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 3px;
    align-items: end;
    height: 140px;
    padding: 0.25rem 0 0.25rem;
    border-bottom: 1px solid var(--border);
}

.hour-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    position: relative;
}

.hour-bar {
    width: 100%;
    min-height: 2px;
    background: var(--accent-gradient);
    border-radius: 3px 3px 0 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.hour-col:hover .hour-bar {
    opacity: 0.85;
    transform: scaleY(1.03);
    transform-origin: bottom;
}

.hour-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}

/* Tables */
.visits-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-solid);
}

.visits-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.visits-table thead th {
    text-align: left;
    padding: 0.7rem 0.85rem;
    background: var(--accent-soft);
    color: var(--text-dim);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.visits-table tbody td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}

.visits-table tbody tr:last-child td {
    border-bottom: 0;
}

.visits-table tbody tr:hover {
    background: rgba(45, 140, 240, 0.04);
}

.cell-mono {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.78rem;
}

.cell-truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-medium {
    max-width: 160px;
}

.cell-wide {
    max-width: 300px;
}

.cell-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem !important;
}

.honeypot-paths {
    margin-bottom: 1rem;
}

/* Stats - mobile */
@media (max-width: 720px) {
    .stats-range {
        gap: 0.3rem;
    }

    .range-btn {
        padding: 0.35em 0.75em;
        font-size: 0.78rem;
    }

    .range-btn--toggle {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        margin-top: 0.25rem;
    }

    .alert--info {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }

    .alert--info .btn {
        width: 100%;
    }

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

    .stat-card {
        padding: 0.95rem 1rem;
    }

    .stat-card-num {
        font-size: 1.6rem;
    }

    .stat-card-label {
        font-size: 0.7rem;
    }

    .stats-section {
        padding: 1rem 1.05rem;
    }

    .bar-row {
        grid-template-columns: minmax(90px, 38%) 1fr auto;
        gap: 0.55rem;
        font-size: 0.82rem;
    }

    .hours-chart {
        grid-template-columns: repeat(24, 1fr);
        gap: 2px;
        height: 110px;
    }

    .hour-label {
        font-size: 0.55rem;
    }

    .visits-table table {
        font-size: 0.78rem;
    }

    .visits-table thead th,
    .visits-table tbody td {
        padding: 0.5rem 0.65rem;
    }
}

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stats-section {
        padding: 0.9rem 1rem;
    }
}

/* ============================================
   COZY - warm touches: ambient, player, shortcuts,
   almaty clock, "right now" card
   ============================================ */

/* subtle floating dots in the corners, pure css ambient */
.cozy-ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.cozy-dot {
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.18;
    animation: cozy-drift 42s ease-in-out infinite alternate;
}

.cozy-dot-1 { top: -60px; left: -40px; background: #ffb38a; animation-delay: 0s; }
.cozy-dot-2 { bottom: -80px; right: -60px; background: #7fb7ff; animation-delay: -12s; }
.cozy-dot-3 { top: 40%; right: -80px; background: #f4b6d2; animation-delay: -24s; opacity: 0.12; }
.cozy-dot-4 { bottom: 10%; left: -80px; background: #c8a8ff; animation-delay: -30s; opacity: 0.14; }

@keyframes cozy-drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(40px, 30px) scale(1.1); }
    100% { transform: translate(-20px, 60px) scale(0.95); }
}

/* ---------- almaty clock in header ---------- */
.almaty-clock {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    margin-left: auto;
    padding-left: 0.75rem;
    opacity: 0.75;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .almaty-clock { font-size: 0.72rem; padding-left: 0.5rem; }
}

/* ---------- right-now card ---------- */
.rightnow-card {
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 0.85rem;
}

.rightnow-title {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    margin-bottom: 0.55rem;
    text-transform: lowercase;
}

.rightnow-rows {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.rightnow-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.rightnow-icon {
    flex-shrink: 0;
    font-size: 0.9rem;
    width: 1.1rem;
    text-align: center;
    opacity: 0.9;
}

.rightnow-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: lowercase;
    letter-spacing: 0.04em;
    min-width: 3.5rem;
}

.rightnow-value {
    color: var(--text);
    font-size: 0.84rem;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

/* ---------- profile name caret ---------- */
.profile-name {
    cursor: pointer;
    user-select: none;
}
.profile-name::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 0.9em;
    background: var(--accent-1);
    margin-left: 3px;
    vertical-align: -0.12em;
    animation: cozy-blink 1.05s steps(2, end) infinite;
}

@keyframes cozy-blink {
    0%, 50%  { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ---------- post dim-on-sibling-hover ---------- */
.feed.feed-has-hover .post-card:not(.post-card-hovered) {
    opacity: 0.55;
    transition: opacity 0.3s var(--ease);
}

.post-card { transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease), opacity 0.3s var(--ease); }

/* ---------- visits in footer ---------- */
.footer-visits {
    color: var(--text-muted);
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
}

/* ============================================
   MUSIC PLAYER
   ============================================ */
.cozy-player {
    position: fixed;
    bottom: 1.1rem;
    left: 1.1rem;
    width: 240px;
    padding: 0.75rem;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    display: flex;
    gap: 0.7rem;
    align-items: center;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: var(--font-body);
}

.cozy-vinyl {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    flex-shrink: 0;
    background:
        radial-gradient(circle, #f4b58a 0 14px, transparent 14px),
        repeating-radial-gradient(circle, #1b1b1b 0 1px, #242424 1px 3px),
        #1a1a1a;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25), inset 0 0 0 1px rgba(255,255,255,0.04);
    animation: cozy-spin 4s linear infinite;
    animation-play-state: paused;
}

.cozy-vinyl.spinning { animation-play-state: running; }

.cozy-vinyl-label {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #f0f0f0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes cozy-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.cozy-player-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    flex: 1;
}

.cozy-track-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.cozy-track-artist {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.cozy-progress {
    height: 4px;
    background: var(--border);
    border-radius: 100px;
    cursor: pointer;
    overflow: hidden;
    margin: 0.15rem 0 0.1rem;
}

.cozy-progress-fill {
    height: 100%;
    width: 0;
    background: var(--accent-gradient);
    border-radius: 100px;
    transition: width 0.15s linear;
}

.cozy-controls {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

.cozy-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.78rem;
    padding: 0.15em 0.35em;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    font-family: inherit;
    line-height: 1;
}

.cozy-btn:hover { color: var(--accent-1); background: var(--accent-soft); }

.cozy-btn-play {
    font-size: 0.85rem;
    color: var(--text);
    padding: 0.2em 0.5em;
}

.cozy-btn-close { margin-left: auto; font-size: 0.95rem; color: var(--text-muted); }

.cozy-hint {
    font-size: 0.62rem;
    color: var(--text-muted);
    opacity: 0.7;
    letter-spacing: 0.04em;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (max-width: 720px) {
    .cozy-player {
        width: calc(100% - 1.4rem);
        bottom: 0.7rem;
        left: 0.7rem;
        right: 0.7rem;
    }
}

/* ============================================
   SHORTCUTS DIALOG
   ============================================ */
.cozy-shortcuts {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-solid);
    color: var(--text);
    padding: 1.5rem 2rem;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.88rem;
    box-shadow: 0 30px 60px -20px rgba(12, 26, 46, 0.4);
    min-width: 320px;
}

.cozy-shortcuts::backdrop {
    background: rgba(12, 26, 46, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.cozy-shortcuts-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.cozy-shortcuts-sep {
    color: var(--text-muted);
    opacity: 0.5;
    margin-bottom: 0.85rem;
    overflow: hidden;
    white-space: nowrap;
}

.cozy-shortcuts-rows {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.45rem 1.1rem;
}

.cozy-shortcuts-rows > div {
    display: contents;
}

.cozy-shortcuts kbd {
    font-family: inherit;
    background: var(--accent-soft);
    color: var(--accent-1);
    padding: 0.1em 0.5em;
    border-radius: 4px;
    font-size: 0.82rem;
    min-width: 3ch;
    text-align: center;
    display: inline-block;
}

.cozy-shortcuts span {
    color: var(--text-dim);
    align-self: center;
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cozy-dot,
    .cozy-vinyl,
    .profile-name::after {
        animation: none !important;
    }
    .cozy-vinyl.spinning { animation: none !important; }
}
