/* ========================================
   Giftrou — Paper-aesthetic stylesheet
   ======================================== */

:root {
  --bg: #f5f0e8;
  --bg-card: #faf7f2;
  --text: #3d3529;
  --text-muted: #8a7e6b;
  --accent: #c46d3b;
  --accent-hover: #a85a2f;
  --border: #e2dace;
  --success: #5a8a5e;
  --danger: #b54e4e;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(61, 53, 41, 0.08);
}

/* ---- Reset / Base ---- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      rgba(61, 53, 41, 0.015) 40px,
      rgba(61, 53, 41, 0.015) 41px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      rgba(61, 53, 41, 0.01) 40px,
      rgba(61, 53, 41, 0.01) 41px
    );
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  margin: 0;
}

/* ---- Typography ---- */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Lora', Georgia, serif;
  color: var(--text);
  margin-bottom: 0.5em;
  line-height: 1.3;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.4rem; }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p {
  margin-bottom: 1em;
}

/* ---- Layout ---- */

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

/* ---- Navigation ---- */

nav {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  box-shadow: var(--shadow);
}

nav .nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.nav-brand:hover {
  text-decoration: none;
}

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

.nav-links a {
  color: var(--text);
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-link-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.nav-link-btn:hover {
  color: var(--accent);
}

/* ---- Cards ---- */

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

/* ---- Forms ---- */

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

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background-color: white;
  color: var(--text);
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 109, 59, 0.1);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
}

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

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

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

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

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

.btn-danger:hover {
  background-color: #9a3f3f;
  text-decoration: none;
}

.btn-google {
  background-color: white;
  color: #333;
  border: 1px solid var(--border);
  gap: 0.5rem;
}

.btn-google:hover {
  background-color: #f5f5f5;
  text-decoration: none;
}

.btn-sm {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.1rem;
}

/* ---- Flash Messages ---- */

.flash {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.95rem;
  transition: opacity 0.4s ease;
}

.flash-error,
.flash-danger {
  background-color: #fde8e8;
  color: var(--danger);
  border: 1px solid #f5c6c6;
}

.flash-success {
  background-color: #e8f5e9;
  color: var(--success);
  border: 1px solid #c8e6c9;
}

.flash-info {
  background-color: #e8f0f5;
  color: #3d6b8a;
  border: 1px solid #c6dae6;
}

/* ---- Hero (Landing Page) ---- */

.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}

.hero h1 {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* ---- Features ---- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}

.feature {
  text-align: center;
  padding: 1.5rem;
}

.feature h3 {
  margin-bottom: 0.5rem;
}

.feature p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---- Wishlist Items ---- */

.item-list {
  list-style: none;
  padding: 0;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

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

.item-title {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.item-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.item-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
}

.badge-reserved {
  background-color: #e8f5e9;
  color: var(--success);
}

.badge-available {
  background-color: #f5f0e8;
  color: var(--text-muted);
}

/* ---- Share Link ---- */

.share-link-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.share-link-box input {
  flex: 1;
  background-color: var(--bg);
  font-size: 0.9rem;
}

/* ---- Auth Forms ---- */

.auth-form {
  max-width: 420px;
  margin: 2rem auto;
}

.auth-form h1 {
  text-align: center;
}

.auth-divider {
  text-align: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background-color: var(--border);
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

/* ---- Cookie Banner ---- */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  display: none;
}

.cookie-banner p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.cookie-banner.show {
  display: block;
}

/* ---- Footer ---- */

footer {
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

footer a {
  color: var(--text-muted);
}

footer a:hover {
  color: var(--accent);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

/* ---- Dashboard ---- */

.wishlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.wishlist-card h3 {
  margin-bottom: 0.25rem;
}

.wishlist-card .meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---- Empty State ---- */

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

.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

/* ---- Detail Page ---- */

.section {
  margin-bottom: 2rem;
}

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

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* ---- Account Page ---- */

.danger-zone {
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 2rem;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2rem;
  }

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

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

  .item {
    flex-direction: column;
  }
}

/* ---- Misc Utilities ---- */

.text-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin-top: 0.25rem;
}

/* ---- Toggle Switch ---- */

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background-color: var(--border);
  border-radius: 12px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}

.toggle-label input:checked + .toggle-switch {
  background-color: var(--success);
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

.toggle-label input:focus-visible + .toggle-switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Settings Row ---- */

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

.setting-info {
  flex: 1;
}

.setting-name {
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.setting-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.account-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
}

.account-details dt {
  font-weight: 500;
  color: var(--text-muted);
}

.auth-switch {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.95rem;
}

.share-hint {
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.wishlist-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--accent);
}

.flash-messages {
  margin-top: 1rem;
}

/* ---- Focus / Accessibility ---- */

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Navbar Dropdown ---- */

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-dropdown-toggle:hover {
  background-color: var(--border);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(61, 53, 41, 0.12);
  min-width: 200px;
  z-index: 100;
  padding: 0.35rem 0;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a,
.nav-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-item:hover {
  background-color: var(--bg);
  text-decoration: none;
}

.nav-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.35rem 0;
}

/* ---- Notification Badge ---- */

.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  padding: 0 5px;
}

/* ---- Modal / Dialog ---- */

dialog {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(61, 53, 41, 0.18);
  padding: 2rem;
  max-width: 500px;
  width: calc(100% - 2rem);
  background: var(--bg-card);
  color: var(--text);
}

dialog::backdrop {
  background: rgba(61, 53, 41, 0.4);
}

dialog h2 {
  margin-top: 0;
}

.dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ---- Emoji Picker ---- */

.emoji-preview-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.emoji-preview {
  font-size: 1.8rem;
  line-height: 1;
  min-width: 40px;
  text-align: center;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.emoji-picker-grid .emoji-option {
  font-size: 1.8rem;
  padding: 0.5rem;
  text-align: center;
}

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.emoji-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 1.5rem;
  padding: 0.25rem;
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.15s;
}

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

.emoji-btn.selected {
  border-color: var(--accent);
  background: rgba(196, 109, 59, 0.08);
}

/* ---- Item Card with Image ---- */

.item-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.item-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.item-image-placeholder {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.5rem;
  flex-shrink: 0;
}

.item-price {
  font-weight: 500;
  color: var(--accent);
  font-size: 0.95rem;
}

/* ---- Days Left Badge ---- */

.days-left {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.days-left.urgent {
  color: var(--danger);
}

.days-left.past {
  color: var(--text-muted);
  font-style: italic;
}

/* ---- How It Works ---- */

.how-it-works {
  padding: 3rem 0;
  text-align: center;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.step {
  text-align: center;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.step h3 {
  margin-bottom: 0.35rem;
}

.step p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---- Wishlist Header with Emoji ---- */

.wishlist-title-emoji {
  font-size: 1.8rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* ---- Reserve Form Inline ---- */

.reserve-form-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.reserve-form-inline input[type="text"] {
  width: auto;
  flex: 1;
  max-width: 200px;
}

/* ---- Notifications List ---- */

.notif-list {
  list-style: none;
  padding: 0;
}

.notif-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

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

.notif-time {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ---- Verification Banner ---- */

.verify-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---- Loading Spinner ---- */

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ---- Emoji option (template class) ---- */

.emoji-option {
  background: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 1.5rem;
  padding: 0.25rem;
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.15s;
}

.emoji-option:hover {
  border-color: var(--border);
}

.emoji-option.selected {
  border-color: var(--accent);
  background: rgba(196, 109, 59, 0.08);
}

/* ---- Modal ---- */

.modal-content {
  /* Already handled by dialog styles */
}

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

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

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

/* ---- Feature icons ---- */

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* ---- Item details layout ---- */

.item-details {
  flex: 1;
  min-width: 0;
}

/* ---- Inline input ---- */

.input-inline {
  width: auto;
  max-width: 180px;
}

/* ---- Status indicators ---- */

.status-ok {
  color: var(--success);
  font-weight: 500;
}

.status-warning {
  color: #b8860b;
  font-weight: 500;
}

/* ---- Form row between ---- */

.form-row-between {
  display: flex;
  justify-content: flex-end;
}

/* ---- Text link ---- */

.text-link {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.text-link:hover {
  color: var(--accent);
}

/* ---- Share header ---- */

.share-header {
  margin-bottom: 1rem;
}

.share-header h1 {
  margin-bottom: 0.25rem;
}

/* ---- Item info with image ---- */

.item-info {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}
