/* ───────────────────────────────────────────
   Perretes 2.0 — Design System
   Dark-first, purple palette, glassmorphism
   ─────────────────────────────────────────── */

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

/* ─── Theme Variables ─── */
:root {
    /* Purple primary palette */
    --primary:      #a78bfa;
    --primary-soft: #8b5cf6;
    --primary-deep: #7c3aed;
    --primary-glow: rgba(167, 139, 250, 0.25);
    --danger:       #f87171;
    --danger-soft:  #ef4444;
    --success:      #34d399;
    --warning:      #fbbf24;

    /* Dark mode (default) */
    --bg:           #0b0b0f;
    --bg-elevated:  #13131a;
    --card:         rgba(28, 28, 38, 0.72);
    --surface:      rgba(38, 38, 52, 0.65);
    --text:         #f1f1f4;
    --text-secondary:#a1a1aa;
    --text-muted:   #71717a;
    --border:       rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.12);

    --radius-sm:    12px;
    --radius-md:    16px;
    --radius-lg:    22px;
    --radius-pill:  999px;

    --shadow-sm:    0 2px 8px rgba(0,0,0,0.25);
    --shadow-md:    0 8px 32px rgba(0,0,0,0.35);
    --shadow-lg:    0 16px 48px rgba(0,0,0,0.45);
    --shadow-glow:  0 0 24px var(--primary-glow);

    --transition-fast:   0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:   0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode override */
[data-theme="light"] {
    --bg:           #f5f5f7;
    --bg-elevated:  #ffffff;
    --card:         rgba(255, 255, 255, 0.78);
    --surface:      rgba(245, 245, 247, 0.85);
    --text:         #1d1d1f;
    --text-secondary:#6e6e73;
    --text-muted:   #a1a1a6;
    --border:       rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    --shadow-md:    0 8px 32px rgba(0,0,0,0.08);
    --shadow-lg:    0 16px 48px rgba(0,0,0,0.12);
}

/* Smooth theme transition */
html {
    transition: background-color var(--transition-slow), color var(--transition-slow);
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Layout ─── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ─── Glass Component ─── */
.glass {
    background: var(--card);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* ─── Navbar ─── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 0;
    margin-bottom: 1.5rem;
}

.nav-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.logo span {
    font-size: 1.4rem;
}

/* Nav search */
.nav-search {
    position: relative;
    flex: 1;
    max-width: 340px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    transition: all var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.85rem center;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-soft);
    background-color: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--card);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 380px;
    overflow-y: auto;
    padding: 0.5rem 0;
    animation: dropdownIn 0.2s ease-out;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.search-section {
    padding: 0.25rem 0;
}

.search-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.35rem 1rem;
    margin: 0;
}

.search-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition-fast);
    border-radius: 0;
}

.search-item:hover {
    background: var(--surface);
}

.search-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 1.8rem;
    height: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-elevated);
}

.search-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Nav links */
.nav-links {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-shrink: 0;
}

.nav-links a, .nav-links button {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-pill);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-links a:hover, .nav-links button:hover {
    background: var(--surface);
    color: var(--text);
}

.nav-user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    padding: 0.35rem 0.7rem 0.35rem 0.35rem;
    border-radius: var(--radius-pill);
    background: var(--surface);
}

/* Theme toggle */
.theme-toggle {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--bg-elevated);
    color: var(--primary);
    transform: rotate(15deg);
}

/* ─── Auth Pages ─── */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--card);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    animation: cardIn 0.4s ease-out;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1.75rem;
    text-align: center;
}

/* ─── Forms ─── */
.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.form-group input,
.bark-form textarea,
.edit-textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    resize: vertical;
    transition: all var(--transition-fast);
}

.form-group input::placeholder,
.bark-form textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.bark-form textarea:focus,
.edit-textarea:focus {
    outline: none;
    border-color: var(--primary-soft);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-elevated);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.9rem;
}

.char-count {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.char-count.warning {
    color: var(--warning);
}

.char-count.danger {
    color: var(--danger);
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.3rem;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-soft), var(--primary-deep));
    color: #fff;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text);
    border-color: var(--border-hover);
}

.btn-block {
    width: 100%;
    padding: 0.7rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-danger {
    background: var(--danger-soft);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
}

/* ─── Avatares ─── */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    user-select: none;
    box-shadow: var(--shadow-sm);
}

.avatar-sm {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 1.1rem;
}

.avatar-md {
    width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
}

.avatar-lg {
    width: 5rem;
    height: 5rem;
    font-size: 2.4rem;
    border: 3px solid var(--bg-elevated);
    box-shadow: var(--shadow-md);
}

/* Avatar selector */
.avatar-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.7rem;
    margin-top: 0.5rem;
}

.avatar-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    font-size: 1.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--surface);
    padding: 0;
    position: relative;
}

.avatar-option:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.avatar-option.active {
    border-color: var(--primary);
    transform: scale(1.12);
    box-shadow: 0 0 0 4px var(--primary-glow), var(--shadow-md);
}

.avatar-option.active::after {
    content: '✓';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 1.1rem;
    height: 1.1rem;
    background: var(--primary-soft);
    color: #fff;
    font-size: 0.6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid var(--bg-elevated);
}

/* ─── Feed ─── */
.feed-section h2,
.profile-content h2 {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    padding-left: 0.25rem;
}

/* Masonry feed using CSS columns */
.feed {
    columns: 2;
    column-gap: 1.25rem;
}

.feed .bark-card {
    break-inside: avoid;
    margin-bottom: 1.25rem;
    width: 100%;
}

/* Bark composer */
.bark-form-section {
    background: var(--card);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    animation: cardIn 0.35s ease-out;
}

.bark-form-section h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.9rem;
    letter-spacing: -0.01em;
    color: var(--text);
}

.bark-form textarea {
    border-radius: var(--radius-sm);
    min-height: 80px;
    font-size: 1rem;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════
   Creative Bark Cards — 5 rotating layouts
   Futuristic, calm, premium, non-repetitive
   ═══════════════════════════════════════════════ */

/* ─── Base card (shared) ─── */
.bark-card {
    background: var(--card);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: transform var(--transition-slow), box-shadow var(--transition-slow);
    position: relative;
}

.bark-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), 0 0 40px rgba(124, 58, 237, 0.08);
    border-color: rgba(167, 139, 250, 0.18);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Shared typography ─── */
.bark-author {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition-fast);
}

.bark-author:hover {
    color: var(--primary);
}

.bark-date {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bark-content {
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.6;
    margin: 0;
}

/* ─── Shared actions ─── */
.bark-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: auto;
}

.bark-actions-break {
    flex-basis: 100%;
    height: 0;
}

.like-btn,
.edit-btn,
.delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-pill);
    transition: all var(--transition-fast);
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.like-btn:hover {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
    transform: scale(1.05);
}

.like-btn.liked {
    color: var(--danger);
}

.like-btn.liked .like-icon {
    animation: heartPop 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes heartPop {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.45); }
    60%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.like-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.like-count {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 1.2rem;
}

.edit-btn:hover {
    background: var(--surface);
    color: var(--text);
    transform: scale(1.05);
}

.delete-btn:hover {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
    transform: scale(1.05);
}

/* ═══════════════════════════════════════════════
   LAYOUT 0 — CINEMA (image background + overlay)
   ═══════════════════════════════════════════════ */
.bark-card.layout-0 {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0;
}

.bark-card.layout-0 .bark-cinema-bg,
.bark-card.layout-0 .bark-image {
    position: absolute;
    inset: 0;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
}

.bark-card.layout-0 .bark-cinema-bg {
    background: linear-gradient(135deg, #1a103c 0%, #0f0f1a 50%, #1a0f2e 100%);
}

.bark-card.layout-0 .bark-image img,
.bark-card.layout-0 .bark-cinema-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: none;
    border-radius: 0;
    transition: transform 8s ease;
}

.bark-card.layout-0:hover .bark-image img {
    transform: scale(1.06);
}

.bark-card.layout-0 .bark-cinema-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(11, 11, 15, 0.97) 0%,
        rgba(11, 11, 15, 0.75) 35%,
        rgba(11, 11, 15, 0.25) 70%,
        rgba(11, 11, 15, 0.05) 100%
    );
    pointer-events: none;
    border-radius: var(--radius-lg);
}

.bark-card.layout-0 .bark-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.75rem 0.5rem;
}

.bark-card.layout-0 .bark-header-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.bark-card.layout-0 .bark-content {
    position: relative;
    z-index: 2;
    padding: 0.5rem 1.75rem;
    font-size: 1.15rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    max-width: 90%;
}

.bark-card.layout-0 .bark-actions {
    position: relative;
    z-index: 2;
    padding: 0.75rem 1.75rem 1.5rem;
    border-top: none;
}

.bark-card.layout-0 .like-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bark-card.layout-0 .like-btn:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.4);
    color: #fff;
}

.bark-card.layout-0 .edit-btn,
.bark-card.layout-0 .delete-btn {
    color: rgba(255, 255, 255, 0.6);
}

.bark-card.layout-0 .edit-btn:hover,
.bark-card.layout-0 .delete-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ═══════════════════════════════════════════════
   LAYOUT 1 — EDITORIAL (asymmetric 40/60 split)
   ═══════════════════════════════════════════════ */
.bark-card.layout-1 {
    display: grid;
    grid-template-columns: 42% 58%;
    min-height: 300px;
    padding: 0;
    align-items: stretch;
}

.bark-card.layout-1.no-image {
    grid-template-columns: 1fr;
}

.bark-card.layout-1 .bark-editorial-left {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(
        160deg,
        rgba(124, 58, 237, 0.08) 0%,
        rgba(59, 130, 246, 0.04) 50%,
        rgba(11, 11, 15, 0) 100%
    );
    border-right: 1px solid var(--border);
}

.bark-card.layout-1.no-image .bark-editorial-left {
    border-right: none;
    background: linear-gradient(
        160deg,
        rgba(124, 58, 237, 0.06) 0%,
        rgba(11, 11, 15, 0) 100%
    );
}

.bark-card.layout-1 .bark-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.bark-card.layout-1 .bark-header-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.bark-card.layout-1 .bark-content {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-weight: 400;
}

.bark-card.layout-1 .bark-actions {
    margin-top: 0;
}

.bark-card.layout-1 .bark-image {
    margin: 0;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
}

.bark-card.layout-1 .bark-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    transition: transform 6s ease;
}

.bark-card.layout-1:hover .bark-image img {
    transform: scale(1.04);
}

/* ═══════════════════════════════════════════════
   LAYOUT 2 — MOSAIC (top image + floating avatar)
   ═══════════════════════════════════════════════ */
.bark-card.layout-2 {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.bark-card.layout-2 .bark-mosaic-media {
    position: relative;
    height: 260px;
    overflow: hidden;
}

.bark-card.layout-2 .bark-image {
    margin: 0;
    border-radius: 0;
    height: 100%;
}

.bark-card.layout-2 .bark-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transition: transform 6s ease;
}

.bark-card.layout-2:hover .bark-image img {
    transform: scale(1.05);
}

.bark-card.layout-2 .bark-mosaic-placeholder {
    height: 100%;
    background: linear-gradient(135deg, #1a103c, #0f1629, #1a0f2e);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.bark-card.layout-2 .bark-float-header {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(11, 11, 15, 0.65);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    padding: 0.4rem 0.9rem 0.4rem 0.4rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.bark-card.layout-2 .bark-float-header .avatar-sm {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 1rem;
}

.bark-card.layout-2 .bark-float-header .bark-author {
    color: #fff;
    font-size: 0.85rem;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.bark-card.layout-2 .bark-float-header .bark-date {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.72rem;
}

.bark-card.layout-2 .bark-mosaic-body {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bark-card.layout-2 .bark-content {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.bark-card.layout-2 .bark-actions {
    margin-top: auto;
}

/* ═══════════════════════════════════════════════
   LAYOUT 3 — ASYMMETRIC (organic curve split)
   ═══════════════════════════════════════════════ */
.bark-card.layout-3 {
    display: flex;
    padding: 0;
    min-height: 280px;
    align-items: stretch;
}

.bark-card.layout-3.no-image {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.bark-card.layout-3 .bark-asym-image {
    flex: 1.15;
    position: relative;
    min-height: 280px;
    overflow: hidden;
}

.bark-card.layout-3 .bark-asym-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: none;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    transition: transform 6s ease;
}

.bark-card.layout-3:hover .bark-asym-image img {
    transform: scale(1.04);
}

.bark-card.layout-3 .bark-asym-image::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, var(--card));
    pointer-events: none;
}

.bark-card.layout-3 .bark-asym-body {
    flex: 1;
    padding: 1.75rem 1.75rem 1.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 2;
    margin-left: -1.5rem;
}

.bark-card.layout-3.no-image .bark-asym-body {
    margin-left: 0;
    padding: 0;
    align-items: center;
    text-align: center;
}

.bark-card.layout-3 .bark-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.bark-card.layout-3.no-image .bark-header {
    flex-direction: column;
    gap: 0.4rem;
}

.bark-card.layout-3 .bark-header-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.bark-card.layout-3 .bark-content {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.bark-card.layout-3 .bark-actions {
    margin-top: 0;
}

/* ─── Profile ─── */
.profile-header {
    background: var(--card);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
    position: relative;
    overflow: hidden;
    animation: cardIn 0.4s ease-out;
}

.profile-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(135deg, var(--primary-soft), var(--primary-deep));
    opacity: 0.35;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.profile-info {
    position: relative;
    z-index: 1;
}

.profile-info .avatar-lg {
    margin: 1.5rem auto 0.75rem;
    position: relative;
    z-index: 2;
}

.profile-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.meta {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    margin-top: 0.3rem;
}

.profile-content {
    margin-bottom: 2rem;
}

/* ═══════════════════════════════════════════════
   LAYOUT EDIT — overrides all creative layouts
   when the card is in edit mode
   ═══════════════════════════════════════════════ */

.bark-card.layout-edit {
    display: block !important;
    grid-template-columns: none !important;
    flex-direction: column !important;
    min-height: auto !important;
    padding: 0 !important;
}

.bark-card.layout-edit .bark-cinema-bg,
.bark-card.layout-edit .bark-cinema-overlay,
.bark-card.layout-edit .bark-asym-image,
.bark-card.layout-edit .bark-mosaic-media,
.bark-card.layout-edit .bark-mosaic-placeholder,
.bark-card.layout-edit .bark-float-header,
.bark-card.layout-edit .bark-editorial-left,
.bark-card.layout-edit .bark-asym-body,
.bark-card.layout-edit .bark-accent-image {
    display: none !important;
}

.bark-card.layout-edit .bark-header,
.bark-card.layout-edit .bark-content,
.bark-card.layout-edit .bark-actions {
    display: none !important;
}

/* ─── Edit mode ─── */
.bark-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1.5rem;
    width: 100%;
}

.edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.2rem;
}

.edit-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.edit-textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    resize: vertical;
    transition: all var(--transition-fast);
    line-height: 1.55;
    min-height: 100px;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--primary-soft);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-elevated);
}

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

/* Meta row: file + remove check */
.edit-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Styled file input */
.edit-file-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.edit-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.edit-file-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    background: var(--surface);
    user-select: none;
}

.edit-file-label:hover {
    border-color: var(--primary-soft);
    color: var(--primary);
    background: rgba(139, 92, 246, 0.08);
    transform: translateY(-1px);
}

.edit-file-label svg {
    flex-shrink: 0;
}

.edit-file-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Remove image checkbox */
.edit-remove-img {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    transition: color var(--transition-fast);
}

.edit-remove-img:hover {
    color: var(--danger);
}

.edit-remove-img input[type="checkbox"] {
    display: none;
}

.edit-remove-img .check-box {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid var(--border-hover);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.edit-remove-img input[type="checkbox"]:checked + .check-box {
    background: var(--danger-soft);
    border-color: var(--danger-soft);
}

.edit-remove-img input[type="checkbox"]:checked + .check-box::after {
    content: '✓';
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
}

/* Current image thumbnail */
.edit-current-image {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.edit-current-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.edit-current-img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    opacity: 0.85;
    transition: opacity var(--transition-fast);
}

.edit-current-img:hover {
    opacity: 1;
}

/* Edit preview */
.edit-image-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    max-width: 100%;
    display: block;
    width: fit-content;
    animation: previewIn 0.3s ease-out;
}

.edit-image-preview img {
    display: block;
    max-width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

/* Actions */
.edit-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

/* ─── File input ─── */
.file-group {
    margin-top: 0.6rem;
}

.file-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.file-label:hover {
    border-color: var(--primary-soft);
    color: var(--primary);
    background: var(--surface);
}

.file-input {
    display: none;
}

.file-name {
    margin-left: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ─── Image preview ─── */
.image-preview {
    position: relative;
    margin-top: 0.75rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    max-width: 100%;
    display: block;
    width: fit-content;
    animation: previewIn 0.3s ease-out;
}

@keyframes previewIn {
    from { opacity: 0; transform: scale(0.96) translateY(4px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.image-preview img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.remove-image-btn {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.remove-image-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.1);
}

/* ─── Guest CTA ─── */
.guest-cta {
    text-align: center;
    padding: 1.5rem 1rem;
}

.guest-cta h2 {
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.guest-cta p {
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

.cta-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--surface);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    color: var(--text);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 500;
    z-index: 400;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 90vw;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-soft), var(--primary));
    border-radius: 0 0 0 var(--radius-md);
    animation: toastProgress 3s linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ─── Modal ─── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-card {
    position: relative;
    background: var(--card);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
    animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.7rem;
}

/* ─── Utilities ─── */
.hidden {
    display: none !important;
}

.loading {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.errors {
    margin-top: 0.75rem;
    color: var(--danger);
    font-size: 0.88rem;
    font-weight: 500;
}

.errors ul {
    list-style: none;
    padding: 0;
}

.errors li {
    margin-bottom: 0.3rem;
}

.auth-link {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

.pagination-controls {
    text-align: center;
    margin-top: 1.25rem;
}

/* ─── Spinner ─── */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Skeleton Loading ─── */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface) 25%,
        var(--bg-elevated) 50%,
        var(--surface) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    min-height: 280px;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-lg);
    break-inside: avoid;
    width: 100%;
}

.skeleton-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.8rem;
}

.skeleton-avatar {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-line {
    height: 0.7rem;
    border-radius: 4px;
    flex: 1;
}

.skeleton-line.short {
    flex: 0 0 40%;
}

/* ─── FAB (mobile) ─── */
.fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-soft), var(--primary-deep));
    color: #fff;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 90;
    transition: all var(--transition-fast);
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.5);
}

.fab:active {
    transform: scale(0.94);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .feed {
        columns: 1;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 0 0.75rem;
    }

    .nav-search {
        max-width: 260px;
        margin: 0 0.5rem;
    }

    .search-input {
        padding: 0.45rem 0.8rem 0.45rem 2.2rem;
        font-size: 0.85rem;
        background-position: 0.7rem center;
    }

    .logo {
        font-size: 0;
    }

    .logo span {
        font-size: 1.4rem;
    }

    .nav-links a, .nav-links button {
        padding: 0.4rem 0.7rem;
        font-size: 0.82rem;
    }

    .auth-card {
        padding: 1.75rem;
        border-radius: var(--radius-md);
    }

    .bark-form-section {
        padding: 1rem;
        border-radius: var(--radius-md);
    }

    .bark-card {
        border-radius: var(--radius-md);
    }

    /* Cinema mobile */
    .bark-card.layout-0 {
        min-height: 340px;
    }
    .bark-card.layout-0 .bark-header {
        padding: 1.25rem 1.25rem 0.4rem;
    }
    .bark-card.layout-0 .bark-content {
        padding: 0.4rem 1.25rem;
        font-size: 1.05rem;
    }
    .bark-card.layout-0 .bark-actions {
        padding: 0.6rem 1.25rem 1.25rem;
    }

    /* Editorial mobile */
    .bark-card.layout-1 {
        grid-template-columns: 1fr;
    }
    .bark-card.layout-1 .bark-editorial-left {
        padding: 1.25rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        order: 2;
    }
    .bark-card.layout-1 .bark-image {
        order: 1;
        height: 220px;
    }
    .bark-card.layout-1 .bark-image img {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    /* Mosaic mobile */
    .bark-card.layout-2 .bark-mosaic-media {
        height: 220px;
    }

    /* Asymmetric mobile */
    .bark-card.layout-3 {
        flex-direction: column;
        min-height: auto;
    }
    .bark-card.layout-3 .bark-asym-image {
        min-height: 220px;
        flex: none;
    }
    .bark-card.layout-3 .bark-asym-image img {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
    .bark-card.layout-3 .bark-asym-image::after {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 50%;
        background: linear-gradient(to top, var(--card), transparent);
    }
    .bark-card.layout-3 .bark-asym-body {
        margin-left: 0;
        padding: 1.25rem;
    }

    .bark-image img {
        border-radius: var(--radius-sm);
    }

    .profile-header {
        padding: 1.5rem 1rem 1.25rem;
        border-radius: var(--radius-md);
    }

    .profile-banner {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .fab {
        display: flex;
    }

    .bark-form-section.guest-cta {
        padding: 1.25rem 1rem;
    }

    .guest-cta h2 {
        font-size: 1.15rem;
    }
}

@media (max-width: 400px) {
    .nav-search {
        max-width: 120px;
    }

    .avatar-selector {
        gap: 0.5rem;
    }

    .avatar-option {
        font-size: 1.4rem;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
