/* ========================================
   Mycrobrews App Styles
   Design tokens from landing page
   ======================================== */

:root {
  --amber: #D4850F;
  --amber-light: #F5A623;
  --amber-glow: rgba(212, 133, 15, 0.15);
  --dark: #0D0B08;
  --dark-mid: #1A1610;
  --cream: #FAF5ED;
  --cream-muted: #E8DFD0;
  --white: #FFFDF8;
  --foam: #F2E8D5;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--dark);
  color: var(--cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
}

a { color: inherit; }

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

/* ========================================
   Navigation
   ======================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.5rem;
  background: rgba(13, 11, 8, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(212, 133, 15, 0.1);
}

.nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Nav links (Discover, etc.) */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  padding: 0 0.75rem;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--cream-muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover,
.nav-link-active {
  color: var(--amber-light);
  background: var(--amber-glow);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.3rem;
  border-radius: 100px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-amber {
  background: var(--amber);
  color: var(--white);
}

.btn-amber:hover {
  background: var(--amber-light);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--amber-light);
  border: 1px solid rgba(212, 133, 15, 0.3);
}

.btn-outline:hover {
  border-color: var(--amber);
  background: var(--amber-glow);
}

.btn-full {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
}

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

/* ========================================
   Layout
   ======================================== */

.container {
  max-width: 620px;
  margin: 0 auto;
  padding: 1.5rem;
  position: relative;
  z-index: 2;
}

/* ========================================
   Post Card
   ======================================== */

.post-card {
  background: var(--dark-mid);
  border: 1px solid rgba(212, 133, 15, 0.08);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.25rem;
  transition: border-color 0.3s;
}

.post-card:hover {
  border-color: rgba(212, 133, 15, 0.2);
}

.post-photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: rgba(26, 22, 16, 0.5);
}

.post-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.post-rating {
  color: var(--amber-light);
  font-size: 1rem;
  margin-bottom: 0.4rem;
  letter-spacing: 2px;
}

.post-rating .empty {
  color: rgba(212, 133, 15, 0.25);
}

.post-beer-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.post-style {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--amber-light);
  background: rgba(212, 133, 15, 0.1);
  border: 1px solid rgba(212, 133, 15, 0.15);
  border-radius: 100px;
  padding: 0.15rem 0.55rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.post-brewery-link {
  color: var(--amber);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
}

.post-brewery-link:hover {
  color: var(--amber-light);
}

.post-brewery-text {
  color: var(--amber);
  font-weight: 500;
  font-size: 0.92rem;
}

.post-location {
  color: var(--cream-muted);
  font-size: 0.85rem;
}

.post-notes {
  margin-top: 0.9rem;
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--cream-muted);
}

.post-meta {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: rgba(232, 223, 208, 0.35);
}

.post-author-link {
  color: rgba(232, 223, 208, 0.5);
  text-decoration: none;
  transition: color 0.15s;
}

.post-author-link:hover {
  color: var(--amber-light);
}

/* ========================================
   Form Styles
   ======================================== */

.form-group {
  margin-bottom: 1.5rem;
}

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

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: rgba(26, 22, 16, 0.8);
  border: 1px solid rgba(212, 133, 15, 0.12);
  border-radius: 12px;
  color: var(--cream);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: rgba(232, 223, 208, 0.3);
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--amber);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* Star Selector */
.star-select {
  display: flex;
  gap: 0.35rem;
}

.star-select .star {
  font-size: 2.2rem;
  cursor: pointer;
  color: rgba(212, 133, 15, 0.25);
  transition: color 0.12s, transform 0.12s;
  user-select: none;
  -webkit-user-select: none;
  line-height: 1;
}

.star-select .star:hover,
.star-select .star.active {
  color: var(--amber-light);
  transform: scale(1.15);
}

/* Photo Upload */
.photo-upload {
  border: 2px dashed rgba(212, 133, 15, 0.18);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}

.photo-upload:hover {
  border-color: var(--amber);
  background: var(--amber-glow);
}

.photo-upload.has-photo {
  padding: 0;
  border-style: solid;
  border-color: rgba(212, 133, 15, 0.15);
}

.photo-upload img {
  width: 100%;
  display: block;
  border-radius: 14px;
}

.photo-upload-text {
  color: var(--cream-muted);
  font-size: 0.92rem;
}

.photo-upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* ========================================
   Autocomplete
   ======================================== */

.autocomplete-wrapper {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--dark-mid);
  border: 1px solid rgba(212, 133, 15, 0.2);
  border-radius: 12px;
  margin-top: 4px;
  overflow: hidden;
  z-index: 50;
  display: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.autocomplete-list.visible {
  display: block;
}

.autocomplete-item {
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-size: 0.93rem;
  color: var(--cream);
  transition: background 0.12s;
}

.autocomplete-item:hover {
  background: var(--amber-glow);
}

/* ========================================
   Brewery Header
   ======================================== */

.brewery-header {
  padding: 1.5rem 0 2rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(212, 133, 15, 0.1);
}

.brewery-header h1 {
  font-size: 2rem;
  color: var(--white);
  margin-bottom: 0.5rem;
  line-height: 1.15;
}

.brewery-meta {
  color: var(--cream-muted);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.brewery-meta .rating {
  color: var(--amber-light);
}

/* ========================================
   States
   ======================================== */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--white);
}

.empty-state p {
  color: var(--cream-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--cream-muted);
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(212, 133, 15, 0.15);
  border-top: 3px solid var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

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

/* ========================================
   Misc
   ======================================== */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--amber);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0;
}

.back-link:hover {
  color: var(--amber-light);
}

.load-more {
  text-align: center;
  padding: 1rem 0 3rem;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.4rem;
}

.page-subtitle {
  color: var(--cream-muted);
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amber);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 200;
  animation: toastIn 0.3s ease;
  box-shadow: 0 4px 20px rgba(212, 133, 15, 0.3);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Feed header */
.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(212, 133, 15, 0.08);
}

.feed-header h1 {
  font-size: 1.3rem;
  color: var(--white);
}

.feed-count {
  font-size: 0.82rem;
  color: var(--cream-muted);
}

/* ========================================
   Auth Page
   ======================================== */

.auth-card {
  max-width: 400px;
  margin: 2rem auto 0;
}

.auth-error {
  background: rgba(220, 53, 69, 0.12);
  border: 1px solid rgba(220, 53, 69, 0.3);
  color: #f8a0a8;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.88rem;
  color: var(--cream-muted);
}

.auth-switch-link {
  color: var(--amber);
  text-decoration: none;
  font-weight: 600;
  margin-left: 0.3rem;
}

.auth-switch-link:hover {
  color: var(--amber-light);
}

/* ========================================
   Nav Auth
   ======================================== */

.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-user,
.nav-user-link {
  font-size: 0.82rem;
  color: var(--cream-muted);
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s;
}

.nav-user-link:hover {
  color: var(--amber-light);
}

.btn-sm {
  padding: 0.35rem 0.9rem;
  font-size: 0.78rem;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }

  .post-body {
    padding: 1rem 1.15rem 1.15rem;
  }

  .post-beer-name {
    font-size: 1.15rem;
  }

  .nav {
    padding: 0.7rem 1rem;
  }

  .nav-brand {
    font-size: 1.1rem;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .brewery-header h1 {
    font-size: 1.6rem;
  }
}

/* ========================================
   Comments
   ======================================== */

.post-actions {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comment-toggle {
  background: none;
  border: none;
  padding: 0.3rem 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  color: rgba(232, 223, 208, 0.45);
  cursor: pointer;
  transition: color 0.15s;
  letter-spacing: 0.01em;
}

.comment-toggle:hover {
  color: var(--amber-light);
}

.post-comments {
  border-top: 1px solid rgba(212, 133, 15, 0.08);
  padding: 1rem 1.5rem 1.25rem;
  background: rgba(13, 11, 8, 0.35);
  border-radius: 0 0 16px 16px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.comment-item {
  padding: 0.6rem 0.75rem;
  background: rgba(212, 133, 15, 0.04);
  border: 1px solid rgba(212, 133, 15, 0.07);
  border-radius: 8px;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.comment-author {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cream-muted);
  text-decoration: none;
}

.comment-author:hover {
  color: var(--amber-light);
}

.comment-time {
  font-size: 0.72rem;
  color: rgba(232, 223, 208, 0.3);
  flex: 1;
}

.comment-delete {
  background: none;
  border: none;
  padding: 0 0.2rem;
  font-size: 1rem;
  color: rgba(232, 223, 208, 0.25);
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}

.comment-delete:hover {
  color: #e05;
}

.comment-content {
  font-size: 0.85rem;
  color: var(--cream-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.comment-input {
  flex: 1;
  background: rgba(26, 22, 16, 0.7);
  border: 1px solid rgba(212, 133, 15, 0.15);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.83rem;
  color: var(--cream);
  outline: none;
  transition: border-color 0.2s;
}

.comment-input::placeholder {
  color: rgba(232, 223, 208, 0.3);
}

.comment-input:focus {
  border-color: rgba(212, 133, 15, 0.4);
}

.comment-submit {
  background: var(--amber);
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
}

.comment-submit:hover {
  background: var(--amber-light);
}

.comment-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comments-loading,
.comments-empty {
  font-size: 0.8rem;
  color: rgba(232, 223, 208, 0.35);
  text-align: center;
  padding: 0.5rem 0;
  font-style: italic;
}

.comment-login-hint {
  font-size: 0.8rem;
  color: rgba(232, 223, 208, 0.35);
  margin-top: 0.5rem;
}

.comment-login-hint a {
  color: var(--amber-light);
  text-decoration: none;
}

.comment-login-hint a:hover {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .post-comments {
    padding: 0.85rem 1rem 1rem;
  }

  .comment-input-row {
    flex-direction: column;
  }

  .comment-submit {
    width: 100%;
  }
}

/* ========================================
   Notification Bell & Panel
   ======================================== */

.nav-bell-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-bell-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s;
  color: var(--cream-muted);
  font-size: 1.15rem;
  line-height: 1;
}

.nav-bell-btn:hover {
  background: rgba(245, 166, 35, 0.1);
  color: var(--cream);
}

.bell-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #E53E3E;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  pointer-events: none;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: #1A1610;
  border: 1px solid rgba(212, 133, 15, 0.2);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 200;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.6rem;
  border-bottom: 1px solid rgba(212, 133, 15, 0.1);
  position: sticky;
  top: 0;
  background: #1A1610;
}

.notif-panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cream);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notif-mark-all {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--amber-light);
  font-family: 'DM Sans', sans-serif;
  padding: 0;
  transition: opacity 0.15s;
}

.notif-mark-all:hover {
  opacity: 0.75;
}

.notif-list {
  padding: 0.25rem 0;
}

.notif-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 1rem;
  text-decoration: none;
  color: var(--cream-muted);
  font-size: 0.85rem;
  line-height: 1.4;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: rgba(245, 166, 35, 0.06);
}

.notif-unread {
  background: rgba(212, 133, 15, 0.07);
  color: var(--cream);
}

.notif-unread .notif-msg {
  font-weight: 500;
}

.notif-msg {
  color: inherit;
}

.notif-time {
  font-size: 0.75rem;
  color: rgba(232, 223, 208, 0.4);
}

.notif-empty {
  padding: 1.25rem 1rem;
  text-align: center;
  color: rgba(232, 223, 208, 0.4);
  font-size: 0.85rem;
}

@media (max-width: 480px) {
  .notif-panel {
    width: calc(100vw - 2rem);
    right: -0.5rem;
  }
}
