/*
 * Application Styles - Editorial / Paper Theme (Design V2)
 */

:root {
  /* Palette: Earthy, Paper, Muted */
  --bg: #fdfcf8; /* Paper cream */
  --surface: #ffffff;
  --surface-alt: #f4f4f0; /* Slightly darker paper for inputs/contrast */

  --text: #2c2c2c; /* Soft charcoal */
  --text-muted: #6e6e6e; /* Medium gray */
  --border: #e6e4dc; /* Warm gray border */

  /* Brand colors */
  --primary: #5f7d76; /* Muted Green (Add place button) */
  --primary-hover: #4b635d;

  /* Accents (for lists) */
  --accent-sage: #e2e8e4;
  --accent-sage-border: #d1d8d4;
  --accent-peach: #fceddd;
  --accent-peach-border: #eedccb;
  --accent-rose: #f5e6e3;
  --accent-rose-border: #e8d5d1;
  --accent-gold: #dcb67d; /* Stars */

  /* UI Primitives */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 12px rgba(44, 44, 44, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --max: 1100px;

  /* Typography */
  --font-serif: "Georgia", "Times New Roman", Times, serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  /* Optional: Subtle paper texture pattern could be added here */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s;
}
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 40px;
}

/* Header - Clean, Integrated */
header {
  background: transparent;
}

.button_to {
  display: inline-flex;
}

.button_to button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-serif);
  font-weight: 400; /* Regular weight for serif elegance */
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #8b9d99; /* Muted icon bg */
  display: grid;
  place-items: center;
  color: white;
  font-size: 16px;
}
.logo::after {
  content: "🔒";
  font-size: 14px;
}

nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.navlink {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  color: var(--text-muted);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.navlink:hover {
  color: var(--text);
}
.navlink.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn.primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 5px rgba(95, 125, 118, 0.3);
}
.btn.primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn.ghost:hover {
  border-color: var(--text);
  color: var(--text);
}

.btn.small {
  padding: 6px 14px;
  font-size: 13px;
}

.btn.danger {
  background: #fdf2f2;
  color: #c53030;
  border-color: #fecaca;
}
.btn.danger:hover {
  background: #fee2e2;
}

/* Typography Helpers */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 400;
  margin: 0;
  color: var(--text);
}

/* Page Head */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 20px 0 30px;
}
h1 {
  font-size: 32px;
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 16px;
  font-family: var(--font-sans);
}

/* Common Components */
.panel,
.card {
  background: var(--surface);
  border-radius: var(--radius);
  /* Typically no border in this design, just shadow */
  border: none;
  box-shadow: var(--shadow-card);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: var(--font-serif);
  font-size: 18px;
}
.panel-body {
  padding: 24px;
}

/* Lists & Items (Generic) */
.item {
  display: block;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--text);
  margin-bottom: 6px;
}
.meta {
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font-sans);
  line-height: 1.5;
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-sans);
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: all 0.2s;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(95, 125, 118, 0.1);
}

/* Flash Messages */
.flash-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 400px;
}
.flash {
  padding: 16px;
  border-radius: 8px;
  background: var(--text);
  color: white;
  box-shadow: var(--shadow-card);
  display: flex;
  gap: 12px;
  align-items: center;
}
.flash__content {
  flex: 1;
}
.flash__title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.flash__message {
  font-size: 14px;
  opacity: 0.9;
}
.flash__close {
  color: white;
  opacity: 0.7;
  background: transparent;
  border: none;
  cursor: pointer;
}

/* Footer */
footer {
  padding: 60px 0;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  font-family: var(--font-sans);
}

/* Stars */
.stars {
  color: var(--accent-gold);
  letter-spacing: 2px;
  font-size: 14px;
}

/* Chips & Tags */
.chip,
.tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Hamburger Menu & Mobile Sidebar */
.hamburger {
  display: none; /* Hidden on desktop */
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text);
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 1000;
  visibility: hidden;
  transition: visibility 0.3s;
}
.mobile-menu.open {
  visibility: visible;
}

.mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
}
.mobile-menu.open .mobile-menu-backdrop {
  opacity: 1;
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 80%;
  background: var(--bg);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  flex-direction: column;
  padding: 20px;
}
.mobile-menu.open .mobile-menu-content {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.close-menu {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.mobile-nav .navlink {
  font-size: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.mobile-nav .navlink.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.mobile-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 20px 16px; /* Reduce horizontal padding */
  }

  .hamburger {
    display: block;
  }

  /* Hide desktop nav */
  #desktop-nav {
    display: none;
  }

  /* Header Layout */
  .topbar {
    justify-content: space-between;
    gap: 12px;
  }

  /* Auth actions: only show 'Add Review' icon or simplified if needed, 
     or hide logout since it is in menu. */
  .auth-actions .button_to {
    display: none;
  } /* Hide logout on topbar mobile */

  .auth-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: center;
  }

  /* Page Head: Stack Title and Actions */

  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  /* Fix button alignment in page head */
  .quick {
    display: flex;
    width: 100%;
    gap: 12px;
    margin: 0; /* Override any bottom margin if causing issues */
  }

  .quick .btn {
    flex: 1; /* Buttons take equal width for better touch targets */
    justify-content: center;
  }

  /* Fix flash messages on mobile */
  .flash-stack {
    width: auto;
    left: 16px;
    right: 16px;
    top: 16px;
  }
}
