/* ──────────────────────────────────────────
   CSS Custom Properties
────────────────────────────────────────── */
:root {
    --color-primary:      #2d6a4f;
    --color-primary-dark: #1b4332;
    --color-accent:       #52b788;
    --color-sidebar-bg:   #1a1a2e;
    --color-sidebar-text: #cdd5d0;
    --color-sidebar-w:    250px;
    --color-body-bg:      #f5f6f8;
    --color-card-border:  #e0e5e2;
    --bs-primary:         #2d6a4f;
    --bs-primary-rgb:     45, 106, 79;
    --transition:         0.2s ease-in-out;
}

/* ──────────────────────────────────────────
   Global
────────────────────────────────────────── */
html, body {
    overflow-x: hidden;
}
body {
    background-color: var(--color-body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #2c3e50;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}
a:hover { color: var(--color-primary-dark); }

/* ──────────────────────────────────────────
   Bootstrap overrides
────────────────────────────────────────── */
.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}
.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline-primary:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}
.badge.bg-primary { background-color: var(--color-primary) !important; }
.text-primary      { color: var(--color-primary) !important; }
.border-primary    { border-color: var(--color-primary) !important; }

/* ──────────────────────────────────────────
   Public Navbar
────────────────────────────────────────── */
.site-navbar {
    background: #fff;
    border-bottom: 2px solid var(--color-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.site-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--color-primary);
    letter-spacing: -.3px;
}
.site-navbar .nav-link {
    color: #4a5568;
    font-weight: 500;
    padding-left: .9rem;
    padding-right: .9rem;
    transition: color var(--transition);
}
.site-navbar .nav-link:hover,
.site-navbar .nav-link.active {
    color: var(--color-primary);
}

/* ──────────────────────────────────────────
   Public Site Footer
────────────────────────────────────────── */
.site-footer {
    background: var(--color-primary-dark);
    color: #b7d5c7;
    padding: 2.5rem 0 1.5rem;
    margin-top: 4rem;
}
.site-footer a { color: var(--color-accent); }
.site-footer a:hover { color: #fff; }

/* ──────────────────────────────────────────
   Hero
────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    color: #fff;
    padding: 2.5rem 0;
}
.hero h1 {
    font-weight: 700;
    font-size: 2.8rem;
    line-height: 1.2;
}
.hero p { font-size: 1.2rem; opacity: .9; }
.hero.hero-light { color: #1a1a2e; }
.hero.hero-light h1 { color: #1a1a2e; }
.hero.hero-light p  { opacity: .75; }
.hero.hero-light .btn-outline-light { --bs-btn-color:#1a1a2e;--bs-btn-border-color:#1a1a2e;--bs-btn-hover-bg:#1a1a2e;--bs-btn-hover-color:#fff; }
.hero.hero-light .btn-light { background:#1a1a2e;color:#fff;border-color:#1a1a2e; }
.hero-feature-image { max-width:100%; object-fit:contain; display:block; margin:0 auto; }

/* ──────────────────────────────────────────
   Post cards
────────────────────────────────────────── */
.post-card {
    border: 1px solid var(--color-card-border);
    border-radius: .75rem;
    background: #fff;
    transition: box-shadow var(--transition), transform var(--transition);
    overflow: hidden;
}
.post-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,.1);
    transform: translateY(-2px);
}
.post-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.post-card .card-body { padding: 1.25rem; }
.post-card .post-meta { font-size: .8rem; color: #6c757d; }
.post-card .access-badge { font-size: .7rem; }

/* ──────────────────────────────────────────
   Dashboard – Sidebar
────────────────────────────────────────── */
.dash-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--color-sidebar-w);
    height: 100vh;
    background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    transition: transform var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }
.sidebar-collapsed .sidebar { transform: translateX(-100%); }

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: .6rem;
}
.sidebar-brand i { color: var(--color-accent); }

.sidebar-user {
    padding: .85rem 1.5rem;
    font-size: .8rem;
    color: rgba(255,255,255,.5);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-user strong { display: block; color: rgba(255,255,255,.8); font-size: .9rem; }

.sidebar-nav { flex: 1; padding: .75rem 0; }

.sidebar-section {
    padding: .5rem 1.5rem .25rem;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    margin-top: .5rem;
}

.sidebar-nav .nav-link {
    color: var(--color-sidebar-text);
    padding: .55rem 1.5rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .9rem;
    border-left: 3px solid transparent;
    transition: all var(--transition);
}
.sidebar-nav .nav-link i {
    width: 18px;
    text-align: center;
    color: rgba(255,255,255,.4);
    transition: color var(--transition);
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: rgba(255,255,255,.07);
    border-left-color: var(--color-accent);
    color: #fff;
}
.sidebar-nav .nav-link:hover i,
.sidebar-nav .nav-link.active i {
    color: var(--color-accent);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ──────────────────────────────────────────
   Dashboard – Main content
────────────────────────────────────────── */
.dash-main {
    margin-left: var(--color-sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dash-topbar {
    background: #fff;
    border-bottom: 1px solid #e5e9ec;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.dash-content {
    padding: 1.75rem;
    flex: 1;
}

.dash-page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 1.5rem;
}

/* ──────────────────────────────────────────
   Stat cards
────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: .75rem;
    border: 1px solid var(--color-card-border);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    color: #1a202c;
}
.stat-card .stat-label {
    font-size: .78rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ──────────────────────────────────────────
   Data tables
────────────────────────────────────────── */
.data-table {
    background: #fff;
    border-radius: .75rem;
    border: 1px solid var(--color-card-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.data-table .table {
    margin: 0;
}
.data-table .table th {
    background: #f8fafc;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6c757d;
    border-bottom: 1px solid var(--color-card-border);
    white-space: nowrap;
}
.data-table .table td {
    vertical-align: middle;
    font-size: .875rem;
}
.data-table .table tbody tr:hover { background: #f9fafb; }

/* ──────────────────────────────────────────
   File grid
────────────────────────────────────────── */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.file-thumb {
    border: 1px solid var(--color-card-border);
    border-radius: .6rem;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
}
.file-thumb:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    transform: translateY(-2px);
}
.file-thumb img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.file-thumb .file-icon {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #adb5bd;
    background: #f8f9fa;
}
.file-thumb .file-name {
    padding: .4rem .6rem;
    font-size: .73rem;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ──────────────────────────────────────────
   Upload zone
────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed #adb5bd;
    border-radius: .75rem;
    padding: 3rem 1.5rem;
    text-align: center;
    background: #fafbfc;
    cursor: pointer;
    transition: all var(--transition);
}
.upload-zone.drag-over, .upload-zone:hover {
    border-color: var(--color-primary);
    background: #edf7f1;
}
.upload-zone i { font-size: 2.5rem; color: #adb5bd; margin-bottom: .75rem; }
.upload-zone.drag-over i { color: var(--color-primary); }

/* ──────────────────────────────────────────
   Progress list
────────────────────────────────────────── */
.upload-list { list-style: none; padding: 0; margin-top: 1rem; }
.upload-list li {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    background: #fff;
    border: 1px solid var(--color-card-border);
    border-radius: .5rem;
    margin-bottom: .5rem;
    font-size: .85rem;
}
.upload-list li .upload-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.upload-list li .progress {
    height: 14px;
    border-radius: .35rem;
    background: #e9ecef;
}
.upload-list li .progress-bar {
    font-size: .7rem;
    font-weight: 600;
    color: #fff;
    line-height: 14px;
    text-shadow: 0 1px 1px rgba(0,0,0,.3);
}
.upload-list li .upload-filename {
    font-size: .82rem;
    color: var(--color-text);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-list li .upload-filename a {
    color: var(--color-primary);
    text-decoration: none;
}
.upload-list li .upload-filename a:hover { text-decoration: underline; }

/* ──────────────────────────────────────────
   Access type badges
────────────────────────────────────────── */
.badge-access-public         { background: #198754; }
.badge-access-family         { background: #0d6efd; }
.badge-access-friends        { background: #6f42c1; }
.badge-access-paying_member  { background: #fd7e14; }
.badge-access-private        { background: #dc3545; }

/* ──────────────────────────────────────────
   Role badges
────────────────────────────────────────── */
.badge-role-admin         { background: #dc3545; }
.badge-role-family        { background: #0d6efd; }
.badge-role-friends       { background: #6f42c1; }
.badge-role-paying_member { background: #fd7e14; }
.badge-role-pending       { background: #6c757d; }

/* ──────────────────────────────────────────
   Forms
────────────────────────────────────────── */
.form-card {
    background: #fff;
    border: 1px solid var(--color-card-border);
    border-radius: .75rem;
    padding: 2rem;
}
.form-label { font-weight: 600; font-size: .875rem; }
.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 .2rem rgba(45, 106, 79, .2);
}

/* ──────────────────────────────────────────
   Quill editor
────────────────────────────────────────── */
#editor-container { background: #fff; }
.ql-toolbar { border-radius: .375rem .375rem 0 0 !important; }
.ql-container { border-radius: 0 0 .375rem .375rem !important; min-height: 300px; }

/* ──────────────────────────────────────────
   Toast
────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
}

/* ──────────────────────────────────────────
   Cookie consent banner
────────────────────────────────────────── */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a2e;
    color: #cdd5d0;
    z-index: 10000;
    border-top: 2px solid var(--color-accent);
    padding: .85rem 1.25rem;
    box-shadow: 0 -4px 16px rgba(0,0,0,.25);
}
.cookie-banner-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.cookie-banner a { color: #f4a261; }

/* ──────────────────────────────────────────
   Lightbox
────────────────────────────────────────── */
#_lb { display:none; position:fixed; inset:0; z-index:9999; }
#_lb._lb-active { display:block; }
#_lb-overlay { position:absolute; inset:0; background:rgba(0,0,0,.93); }
#_lb-wrap { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none; }
#_lb-wrap > * { pointer-events:auto; }
#_lb-img-wrap { display:flex; align-items:center; justify-content:center; max-width:90vw; max-height:85vh; }
#_lb-img { max-width:90vw; max-height:85vh; object-fit:contain; border-radius:4px; user-select:none; display:block; }
#_lb-close, #_lb-prev, #_lb-next {
    position:absolute; background:none; border:none; color:#fff;
    cursor:pointer; opacity:.65; transition:opacity .15s; line-height:1; padding:4px;
}
#_lb-close:hover, #_lb-prev:hover, #_lb-next:hover { opacity:1; }
#_lb-close { top:14px; right:18px; font-size:2.4rem; }
#_lb-prev, #_lb-next { font-size:3.5rem; top:50%; transform:translateY(-50%); }
#_lb-prev { left:10px; }
#_lb-next { right:10px; }
#_lb-meta { position:absolute; bottom:14px; left:0; right:0; text-align:center; pointer-events:none; }
#_lb-caption { color:rgba(255,255,255,.85); font-size:.9rem; margin-bottom:4px; }
#_lb-counter { color:rgba(255,255,255,.5); font-size:.8rem; }

/* Gallery admin (create-post) */
.gallery-admin-grid { display:flex; flex-wrap:wrap; gap:.5rem; min-height:48px; }
.gallery-admin-tile { position:relative; width:80px; height:80px; border-radius:6px; overflow:hidden; border:2px solid transparent; cursor:grab; flex-shrink:0; }
.gallery-admin-tile img { width:100%; height:100%; object-fit:cover; display:block; pointer-events:none; }
.gallery-admin-tile.drag-over { border-color:var(--color-primary); opacity:.7; }
.gallery-remove-btn { position:absolute; top:2px; right:2px; width:20px; height:20px; border-radius:50%; background:rgba(0,0,0,.6); border:none; color:#fff; font-size:.9rem; line-height:1; padding:0; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.gallery-remove-btn:hover { background:rgba(200,0,0,.85); }

/* Gallery grids (post & homepage) */
.gallery-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:.5rem; }
.gallery-grid a { display:block; aspect-ratio:1; overflow:hidden; border-radius:6px; }
.gallery-grid a img { width:100%; height:100%; object-fit:cover; transition:transform .2s; }
.gallery-grid a:hover img { transform:scale(1.04); }

/* ──────────────────────────────────────────
   Responsive
────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .dash-main { margin-left: 0; }
    .dash-content { padding: 1rem; }
    .file-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .hero h1 { font-size: 2rem; }
}
