/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--teal-shine);
  color: #fff;
  box-shadow: var(--teal-shadow);
  text-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.btn-primary:hover  { box-shadow: 0 6px 28px rgba(26,95,90,0.42); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--teal-shadow); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 0.9rem;
}
.btn-ghost:hover { color: var(--text); background: rgba(26,95,90,0.06); border-radius: var(--radius-sm); }

.btn-icon {
  background: transparent;
  border: none;
  padding: 9px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  font-size: 1.1rem;
  transition: color 0.2s, background 0.2s;
}
.btn-icon:hover { color: var(--text); background: rgba(26,95,90,0.06); }

.btn-block { display: flex; width: 100%; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.2s;
}
.btn-danger:hover { background: var(--red-bg); }
.btn-danger svg { width: 16px; height: 16px; }


/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: var(--space-md);
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.form-input,
.form-select,
.form-textarea {
  padding: 14px 16px;
  background: var(--surface-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-light); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,95,90,0.12);
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235A6B68' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.password-field {
  position: relative;
}
.password-field .form-input {
  padding-right: 44px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}
.password-toggle:hover { color: var(--text); }
.password-toggle i { width: 18px; height: 18px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}


/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: var(--space-md);
  line-height: 1.6;
}
.alert-icon { flex-shrink: 0; margin-top: 1px; }
.alert-error   { background: var(--red-bg);    border: 1px solid #E0B8B8; color: #7A2020; }
.alert-warning { background: var(--orange-bg); border: 1px solid #E0CCB0; color: #7A4820; }
.alert-success { background: var(--green-bg);  border: 1px solid #B8D4C4; color: #1E5C3A; }
.alert-info    { background: var(--primary-light); border: 1px solid #C0D8D6; color: var(--primary-dark); }


/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.card-padded { padding: var(--space-lg); }
.card + .card { margin-top: var(--space-md); }

.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.card-section {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
}
.card-section:first-child { border-top: none; }

.card-link {
  display: block;
  transition: box-shadow 0.2s, transform 0.15s;
}
.card-link:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}


/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-green   { background: var(--green-bg);      color: var(--green); }
.badge-orange  { background: var(--orange-bg);     color: var(--orange); }
.badge-red     { background: var(--red-bg);        color: var(--red); }
.badge-muted   { background: var(--border);        color: var(--text-muted); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-accent  { background: var(--accent-light);  color: #8A5E10; }


/* ============================================================
   LOADING / SPINNER
   ============================================================ */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
.spinner-dark {
  border-color: rgba(26,95,90,0.18);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: 72px var(--space-md);
  color: var(--text-muted);
  font-size: 0.9rem;
}


/* ============================================================
   TOP NAV
   ============================================================ */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  z-index: 1200;
  box-shadow: var(--shadow-xs);
}

.top-nav-brand {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.top-nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.top-nav-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}


/* ============================================================
   BOTTOM NAV (mobile)
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 1200;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 24px rgba(26,95,90,0.06);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 8px 4px 10px;
  transition: color 0.2s;
  border: none;
  background: none;
}
.bottom-nav-item:hover  { color: var(--text-muted); }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.nav-add { color: var(--text-muted); }


/* ============================================================
   ICONS (Lucide)
   ============================================================ */
[data-lucide], .lucide {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.top-nav-brand svg     { width: 18px; height: 18px; color: var(--primary); }
.btn-icon svg          { width: 18px; height: 18px; }
.bottom-nav-item > svg { width: 22px; height: 22px; }
.alert-icon svg        { width: 16px; height: 16px; }

.nav-add-circle {
  width: 38px;
  height: 38px;
  background: var(--teal-shine);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--teal-shadow);
}
.nav-add-circle svg { width: 18px; height: 18px; color: #fff; }

.login-brand-icon {
  display: block;
  margin: 0 auto 20px;
  color: var(--primary);
}
.login-brand-icon svg { width: 52px; height: 52px; }


/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-lg) var(--space-md);
  background: var(--bg);
}

.login-card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 480px) {
  .login-card { padding: 44px 28px; }
}

.login-brand {
  text-align: center;
  margin-bottom: 36px;
}

.login-brand h1 {
  font-size: 2.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
}

.login-tagline {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.login-tabs {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: var(--space-lg);
}

.login-tab {
  flex: 1;
  padding: 9px;
  background: none;
  border: none;
  border-radius: 3px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: var(--font-sans);
}
.login-tab.active {
  background: var(--primary);
  color: #fff;
}


/* ============================================================
   DESKTOP SIDEBAR
   ============================================================ */
.side-nav {
  display: none;
}

@media (min-width: 900px) {
  /* Lines up the "Roamory" text with the sidebar nav item text below it: the
     two containers have different padding/icon/gap sizes, so without this
     the text starts ~29px further left here than in the sidebar. Only
     applied once the sidebar is actually visible (900px+). */
  .top-nav-brand {
    margin-left: 29px;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface-raised);
    border-right: 1px solid var(--border);
    padding: var(--space-xl) var(--space-lg);
    z-index: 300;
    gap: var(--space-lg);
    box-shadow: var(--shadow-sm);
  }

  /* Kept in the layout (same padding/gap) so the nav items below don't shift,
     but not rendered — the brand already shows in the top bar on every page,
     so this would otherwise duplicate it. */
  .side-nav-brand {
    font-family: var(--font-serif);
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
    visibility: hidden;
  }
  .side-nav-brand svg { width: 20px; height: 20px; color: var(--primary); }

  .side-nav-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
  }

  .side-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: background 0.15s, color 0.15s;
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    font-family: var(--font-sans);
    text-align: left;
  }
  .side-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
  .side-nav-item:hover  { background: var(--primary-light); color: var(--primary-dark); }
  .side-nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }

  .side-nav-footer {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border);
  }

  .side-nav-logout:hover { background: var(--red-bg); color: var(--red); }

  .bottom-nav { display: none; }
}
