:root {
  --primary-color: #000000;
  --bg-color: #f7f9f9;
  --card-bg: #ffffff;
  --text-primary: #111111;
  --text-secondary: #666666;
  --accent-color: #000000;
  --accent-hover: #333333;
  --border-color: #e9e9e9;
  --danger-color: #ff3b30;
}

html {
  overflow-y: scroll; /* Force scrollbar to prevent layout shift */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border-radius: 1rem;
}

.glass-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
  border-radius: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.8);
}

.glass-btn {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  text-decoration: none;
}

.glass-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.glass-input {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.8rem 1rem;
  border-radius: 0.8rem;
  width: 100%;
  font-size: 1rem;
  transition: all 0.2s;
  color: var(--text-primary);
}

.glass-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

/* Liquid Button Styles - Advanced */
.liquid-btn {
    --glass-bg: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    --glass-border: rgba(255,255,255,0.10);
    position: relative;
    display: flex; /* Changed from inline-flex to flex for better width control */
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.4rem;
    border-radius: 1.6rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.06rem;
    background: var(--glass-bg);
    border: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    box-shadow: 0 8px 28px rgba(19, 24, 30, 0.12), inset 0 1px 0 rgba(255,255,255,0.04);
    overflow: hidden;
    transition: transform 220ms cubic-bezier(.2,.9,.2,1), box-shadow 220ms ease, background 220ms ease;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box; /* Ensure padding doesn't overflow width */
}

.liquid-btn .liquid-inner { display:inline-block; position: relative; z-index: 2; }

.liquid-btn .liquid-sheen { 
    position:absolute; 
    z-index:1; 
    top:-40%; 
    left:-50%; 
    width:60%; 
    height:200%; 
    background: linear-gradient(120deg, rgba(255,255,255,0.24), rgba(255,255,255,0.02)); 
    transform: rotate(-25deg) translateX(-120%); 
    filter: blur(6px); 
    opacity:0.85; 
    transition: transform 1.6s cubic-bezier(.25,.8,.25,1); 
    pointer-events:none; 
}

.liquid-btn .liquid-blob { 
    position:absolute; 
    z-index:0; 
    right:-30%; 
    bottom:-20%; 
    width:120px; 
    height:120px; 
    background: radial-gradient(circle at 30% 30%, rgba(0,0,0,0.1), rgba(0,0,0,0.05) 40%, rgba(255,255,255,0)); 
    border-radius:50%; 
    filter: blur(10px); 
    transform: scale(0.9); 
    opacity:0.95; 
    transition: transform 420ms ease; 
    pointer-events:none; 
}

.liquid-btn:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    text-decoration: none;
}

.liquid-btn:hover .liquid-sheen {
    transform: rotate(-25deg) translateX(12%);
}

.liquid-btn:active {
    transform: translateY(-1px) scale(0.995);
}

.liquid-btn:focus {
    outline: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12), 0 0 0 4px rgba(0,0,0,0.06);
}

.liquid-btn.liquid-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.liquid-btn.liquid-enabled {
    transform: translateY(0) scale(1);
    box-shadow: 0 12px 36px rgba(19,24,30,0.16);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
}

.liquid-btn.liquid-enabled:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08));
}

.liquid-btn.liquid-enabled .liquid-sheen {
    transform: rotate(-25deg) translateX(-20%);
    opacity: 0.9;
    transition: transform 1.2s cubic-bezier(.25,.8,.25,1), opacity 220ms ease;
}

.liquid-btn.liquid-enabled:hover .liquid-sheen {
    transform: rotate(-25deg) translateX(12%);
}

.liquid-btn.liquid-enabled .liquid-blob {
    transform: scale(1.02) translateX(-4%);
    opacity: 1;
}

/* Navigation */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  margin-bottom: 2rem;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Specific override for nav items to prevent underline */
.nav-item, .nav-item:hover {
  text-decoration: none !important;
}

.btn, button {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  text-decoration: none;
  font-size: 0.95rem;
}

.btn:hover, button:hover {
  background-color: var(--accent-hover);
  text-decoration: none;
}

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

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

input, textarea, select {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Hide default password reveal button in Edge/IE */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

/* Hide default password reveal button in some other browsers if applicable */
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
    height: 0;
    width: 0;
    margin: 0;
}

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

/* Layout & Responsive */
h1, h2, h3 {
  color: var(--text-primary);
  margin-top: 0;
}

/* Post Button Styles */
.publish-btn {
  background: linear-gradient(135deg, #000000, #333333);
  color: white;
  border: none;
  transition: all 0.3s ease;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.publish-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, #222222, #555555);
}

.publish-btn:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.publish-btn:disabled,
.publish-btn-disabled {
  background: #e5e7eb !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
  opacity: 0.6 !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Diary List Mobile Adjustments */
.diary-list-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.diary-list-item > div:last-child {
  width: 100%;
  justify-content: space-between;
}

/* Sidebar Navigation */
.sidebar {
  position: sticky;
  top: 2rem;
  height: fit-content;
  align-self: start;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 3.5rem;
  padding: 0 1rem;
  color: var(--text-secondary);
  border-radius: 1rem;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  background: transparent;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  transform: scale(1.02);
}

.nav-item.active {
  background: rgba(0, 0, 0, 0.05);
  color: var(--accent-color) !important;
  font-weight: 700;
  border: 1px solid rgba(0,0,0,0.05);
}

.nav-item.danger {
  color: var(--danger-color);
}

.nav-item.danger:hover, .nav-item.danger:active {
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger-color);
}

/* Main Dashboard Header */
.main-dashboard-header {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.05);
  text-align: center;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero-content h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

.hero-content p {
  color: #666;
  font-size: 1rem;
  margin-bottom: 2rem;
}

/* Filter Bar */
.home-filters-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  color: #555;
  background: #f5f5f5;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.filter-pill:hover {
  background: #e0e0e0;
  color: #000;
  transform: translateY(-1px);
  text-decoration: none;
}

.filter-pill.active {
  background: #000;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Post Grid */
.post-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
}

.post-card {
  background-color: white;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  margin-bottom: 1rem;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  border-color: rgba(0,0,0,0.1);
}

.post-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.post-card-body {
  flex: 1;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.reply-count {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  padding: 2.5rem;
  border-radius: 1rem;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
  position: relative;
  border: 1px solid rgba(0,0,0,0.05);
  box-sizing: border-box;
}

.modal-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

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

.tab-group {
  display: flex;
  margin-bottom: 2rem;
  background: rgba(0,0,0,0.03);
  padding: 0.25rem;
  border-radius: 0.75rem;
  position: relative;
  border: none;
}

.tab-indicator {
  position: absolute;
  top: 0;
  left: 0;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1;
}

.home-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  background: transparent !important;
  padding: 0 !important;
}

.filter-btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  color: #000;
  background: white;
  border: 2px solid #000;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  font-weight: 600;
  box-shadow: 2px 2px 0px #000;
}

.filter-btn:hover {
  color: #000;
  background: white;
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px #000;
  text-decoration: none;
}

.filter-btn.active {
  background: #000;
  color: white;
  border-color: #000;
  font-weight: 600;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
  transform: translate(1px, 1px);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 0.6rem;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
  z-index: 2;
  border-bottom: none;
  text-align: center;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: transparent;
}

.tab-btn.active {
  color: var(--text-primary);
  background: transparent;
  border-bottom: none;
  box-shadow: none;
  font-weight: 600;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.pwd-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.2s;
}

.pwd-toggle:hover {
  opacity: 1;
  color: var(--text-primary);
}

/* Specific Emotion Tags */
.emotion-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.emotion-tag.anxiety,
.emotion-tag.depression,
.emotion-tag.anger,
.emotion-tag.relief,
.emotion-tag.confused,
.emotion-tag.neutral {
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}

/* Filter Tabs Customization */
#latest-posts {
  scroll-margin-top: 100px;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,0.05);
  padding: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none !important;
  transition: all 0.2s;
  display: inline-block;
  position: relative;
  z-index: 2;
}

.filter-btn:hover {
  text-decoration: none !important;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.8);
}

.filter-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Liquid Glass Hover Effect */
.filter-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.glass-btn.blue {
  background: rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: #000000 !important;
}

.glass-btn.blue:not(:disabled):hover {
  background: rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  color: #000000 !important;
}

.glass-btn.blue:disabled {
  background: rgba(0, 0, 0, 0.02);
  color: #9ca3af !important;
  cursor: not-allowed;
}

.glass-btn.danger {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #000000 !important;
}

.glass-btn.danger:hover {
  background: rgba(0, 0, 0, 0.1);
}

.badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #000000;
    border: 1px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.beian-footer {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  font-size: 14px;
  color: #666;
  width: 100%;
  margin-top: auto;
}

.beian-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.beian-footer-icon {
  width: 20px;
  height: 20px;
}

.beian-footer-link {
  color: #666;
  text-decoration: none;
  text-align: center;
}

.container {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 4rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  min-height: 80vh; /* Prevent blank screen feeling */
}

/* Admin UI Overrides */
body.admin-ui .container {
  grid-template-columns: 1fr;
  display: block;
  max-width: 100%;
  padding: 0;
}

body.admin-ui .sidebar {
  display: none;
}

/* Removed mobile-nav hiding to enable bottom nav in admin */


@media (max-width: 1024px) {
  .container {
    gap: 2rem;
    grid-template-columns: 200px 1fr;
  }
}

/* Default state for mobile nav (hidden on desktop) */
.mobile-nav {
  display: none !important;
}

@media (max-width: 768px) {
  .beian-footer-inner {
    flex-direction: column;
    gap: 8px;
  }

  body {
    background: var(--bg-color);
    overflow-x: hidden;
  }

  /* Compact Hero for Mobile */
  .home-hero {
    padding: 0.9rem 0.2rem 0.8rem;
    margin: 0 0 0.9rem;
    text-align: left;
  }
  .home-hero h1 {
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0;
    letter-spacing: 0.06em;
  }
  .home-hero p {
    display: none;
  }

  .home-feed {
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
  }

  .home-feed-head {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
  }

  .home-feed-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.04em;
  }

  .home-feed-head span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
  }

  /* Scrollable Filter Tabs */
  .tab-group {
      flex-wrap: nowrap !important;
      overflow-x: auto;
      padding-bottom: 0.5rem;
      gap: 0.6rem !important;
      -webkit-overflow-scrolling: touch;
      margin-bottom: 1rem !important;
  }
  /* Hide scrollbar */
  .tab-group::-webkit-scrollbar {
      display: none;
  }
  .filter-btn {
      flex-shrink: 0;
      white-space: nowrap;
      padding: 0.4rem 1rem !important;
      font-size: 0.9rem !important;
  }

  body.admin-ui .admin-section-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 5000;
    overflow: visible !important;
  }

  body.admin-ui .admin-section-header + * {
    scroll-margin-top: 72px;
  }
  .container {
    grid-template-columns: 1fr;
    padding: 0 1rem; /* Adjust padding for mobile */
    margin: 0.75rem auto;
    gap: 1.5rem;
  }

  .post-card {
    padding: 1.1rem;
    border-radius: 1.1rem;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.04);
  }

  .post-card-header {
    margin-bottom: 0.85rem;
  }

  .post-card-body {
    margin-bottom: 1.1rem;
    -webkit-line-clamp: 5;
  }

  .post-card-footer {
    padding-top: 0.85rem;
  }

  .sidebar {
    display: none; /* Hide sidebar on mobile */
  }

  /* Bottom Navigation Bar for Mobile */
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.03);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 0.75rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 1;
    width: 64px;
    font-weight: 500;
    white-space: nowrap;
  }
  
  .mobile-nav-item svg {
    margin-bottom: 3px;
    width: 24px;
    height: 24px;
    stroke-width: 2px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .mobile-nav-item.active {
    color: var(--text-primary) !important; /* Black for contrast on liquid bg */
    background: transparent;
    font-weight: 600;
  }

  /* Apple-like Liquid Indicator */
  .mobile-nav-indicator {
    position: absolute;
    left: 0;
    top: 0.5rem; /* Matches padding-top of nav */
    height: calc(100% - 1rem - env(safe-area-inset-bottom)); /* Full height of item area */
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
    z-index: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .mobile-nav.profile-active .mobile-nav-indicator {
    background: rgba(0, 0, 0, 0.1);
  }

  main {
    box-sizing: border-box;
    margin-bottom: 0 !important;
    padding-bottom: calc(var(--vv-bottom, 0px) + 80px + env(safe-area-inset-bottom) + 2rem) !important;
  }

  .container > footer {
    margin-bottom: calc(var(--vv-bottom, 0px) + 80px + env(safe-area-inset-bottom) + 1rem) !important;
  }

  .container {
    min-height: auto;
  }

  .glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow-x: hidden;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  #regionSelect {
    min-width: 0 !important;
    width: 100%;
  }

  .glass-panel::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(0,0,0,0.1) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
  }

  .reply-bar {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(var(--vv-bottom, 0px) + 64px + env(safe-area-inset-bottom) + 0.75rem);
    padding: 0.75rem 0.9rem;
    border-radius: 1rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.28);
    z-index: 9000;
  }
  
  body.report-open .reply-bar {
    display: none;
  }

  .reply-form {
    align-items: flex-end;
    gap: 0.6rem;
  }

  .reply-input {
    min-height: 36px;
    height: 36px;
    max-height: 120px;
    font-size: 0.9rem;
    padding: 0.6rem 0.9rem;
    border-radius: 999px;
  }

  .reply-submit {
    height: 36px;
    padding: 0 1rem;
    font-size: 0.85rem;
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* Diary Detail Mobile Adjustments */
  .diary-actions {
    flex-direction: column;
  }

  .diary-actions button,
  .diary-actions form,
  .diary-actions a {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .diary-actions form button {
    width: 100%;
  }

  .publish-actions {
    gap: 0.8rem !important;
    align-items: center !important;
  }

  .publish-actions .publish-submit,
  .publish-actions .publish-cancel {
    padding: 0.8rem !important;
    justify-content: center;
    text-align: center;
  }

  .publish-actions .publish-submit {
    flex: 2 !important;
  }

  .publish-actions .publish-cancel {
    flex: 1 !important;
  }

  .reply-bar {
    max-width: 800px;
    margin: 0 auto;
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    border-radius: 999px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  }

  .reply-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
  }

  .reply-input {
    flex: 1;
    width: auto;
    padding: 0.75rem 1rem;
    margin-bottom: 0;
    border-radius: 999px;
    resize: none;
    font-size: 0.95rem;
    min-height: 44px;
    height: 44px;
    max-height: 120px;
    line-height: 1.4;
  }

  .reply-submit {
    padding: 0 1.4rem;
    height: 44px;
    border-radius: 999px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Admin UI Mobile Adjustments */
  body.admin-ui .glass-panel-clean {
    border: none;
    background: transparent;
    box-shadow: none;
  }
  
  /* Ensure admin container respects bottom nav */
  body.admin-ui .admin-container {
      height: calc(100vh - 70px) !important; 
  }
  
  /* Adjust dashboard grid for mobile */
  body.admin-ui .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  
  body.admin-ui .stat-card {
    padding: 1rem;
  }
  
  body.admin-ui .stat-card div:nth-child(2) {
    font-size: 1.4rem !important;
  }

  body.admin-ui .chat-window {
     height: calc(100vh - 180px); /* Dynamic height */
     min-height: 400px;
     overflow-y: auto;
   }
 }


/* Animations */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.post-card {
  opacity: 0;
  animation: fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.post-grid .post-card:nth-child(1) { animation-delay: 0.05s; }
.post-grid .post-card:nth-child(2) { animation-delay: 0.1s; }
.post-grid .post-card:nth-child(3) { animation-delay: 0.15s; }
.post-grid .post-card:nth-child(4) { animation-delay: 0.2s; }
.post-grid .post-card:nth-child(5) { animation-delay: 0.25s; }
.post-grid .post-card:nth-child(6) { animation-delay: 0.3s; }
.post-grid .post-card:nth-child(n+7) { animation-delay: 0.1s; }


/* Danger variant for liquid button */
.liquid-btn.danger {
    color: #ff4d4f;
    --glass-bg: linear-gradient(180deg, rgba(255, 77, 79, 0.08), rgba(255, 77, 79, 0.02));
    border: 1px solid rgba(255, 77, 79, 0.15);
}

.liquid-btn.danger .liquid-blob {
    background: radial-gradient(circle at 30% 30%, rgba(255, 77, 79, 0.15), rgba(255, 77, 79, 0.05) 40%, rgba(255, 255, 255, 0));
}

.liquid-btn.danger:hover {
    box-shadow: 0 18px 48px rgba(255, 77, 79, 0.15);
    background: linear-gradient(180deg, rgba(255, 77, 79, 0.12), rgba(255, 77, 79, 0.04));
}


/* Danger variant for glass input */
.glass-input.danger {
    background: rgba(255, 77, 79, 0.05);
    border-color: rgba(255, 77, 79, 0.2);
    color: var(--text-primary);
}

.glass-input.danger:focus {
    background: rgba(255, 77, 79, 0.08);
    border-color: #ff4d4f;
    box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.1);
}

.glass-input.danger::placeholder {
    color: rgba(255, 77, 79, 0.5);
}

/* Beian Footer Styles */
.beian-footer {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  font-size: 14px;
  color: #666;
  width: 100%;
  margin-top: auto;
}

.beian-footer-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-direction: row;
}

.beian-footer-icon {
  width: 20px;
  height: 20px;
}

.beian-footer-link {
  color: #666;
  text-decoration: none;
}

@media (max-width: 768px) {
  .container > footer.beian-footer {
    margin-bottom: calc(var(--vv-bottom, 0px) + 80px + env(safe-area-inset-bottom) + 1rem) !important;
  }
  
  .beian-footer-inner {
      flex-direction: row !important;
      flex-wrap: nowrap;
  }
}
