@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,700;1,9..144,400&display=swap');

/* ═══════════════════════════════════════════════
   UBIPET 2.0 — Design System
   Tone: Warm · Bold · Modern · Pet-forward
   ═══════════════════════════════════════════════ */

:root {
  /* Brand */
  --clay:         #D08C61;
  --clay-d:       #B8734A;
  --clay-l:       #EAC4A8;
  --clay-bg:      #FDF4EE;
  --clay-glow:    rgba(208,140,97,0.20);
  --sage:         #5A7A57;
  --sage-d:       #3E5C3B;
  --sage-l:       #A8BDA6;
  --sage-bg:      #EEF4ED;

  /* Surface */
  --bg:           #F7F6F3;
  --surface:      #FFFFFF;
  --surface-2:    #F2F1EE;
  --border:       rgba(0,0,0,0.08);
  --border-strong:rgba(0,0,0,0.14);

  /* Text */
  --ink:          #1A1A18;
  --ink-soft:     #4A4A46;
  --ink-muted:    #9A9990;

  /* Semantic */
  --success:      #4A8A5A;
  --success-bg:   #EBF5EE;
  --error:        #C0392B;
  --error-bg:     #FDECEA;
  --warning:      #D4811A;
  --warning-bg:   #FEF3E2;

  /* Shadows */
  --shadow-xs:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  --shadow:       0 4px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.10), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-clay:  0 4px 24px rgba(208,140,97,0.25);

  /* Shape */
  --r-sm:   8px;
  --r:      14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-full: 999px;

  /* Motion */
  --ease:        cubic-bezier(0.25,0.46,0.45,0.94);
  --ease-spring: cubic-bezier(0.34,1.56,0.64,1);
  --fast:        140ms;
  --mid:         240ms;
  --slow:        380ms;

  /* Layout */
  --header-h: 60px;
}

[data-theme="dark"] {
  --bg:           #141412;
  --surface:      #1E1E1B;
  --surface-2:    #252522;
  --border:       rgba(255,255,255,0.08);
  --border-strong:rgba(255,255,255,0.14);
  --ink:          #F0EFE8;
  --ink-soft:     #B8B7B0;
  --ink-muted:    #6A6960;
  --clay-bg:      rgba(208,140,97,0.10);
  --clay-l:       rgba(208,140,97,0.25);
  --sage-bg:      rgba(90,122,87,0.12);
  --sage-l:       rgba(90,122,87,0.25);
  --success-bg:   rgba(74,138,90,0.12);
  --error-bg:     rgba(192,57,43,0.12);
  --warning-bg:   rgba(212,129,26,0.12);
  --shadow:       0 4px 24px rgba(0,0,0,0.40);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.55);
  --shadow-clay:  0 4px 24px rgba(208,140,97,0.15);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; height: 100%; }
body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--mid) var(--ease), color var(--mid) var(--ease);
}

h1,h2,h3,h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--ink);
}
h1 { font-size: clamp(28px,6vw,48px); }
h2 { font-size: clamp(22px,4vw,34px); }
h3 { font-size: clamp(18px,3vw,24px); }
h4 { font-size: 17px; }
p  { color: var(--ink-soft); line-height: 1.7; }
a  { color: var(--clay); text-decoration: none; transition: color var(--fast); }
a:hover { color: var(--clay-d); }

/* ── AUTH SCREEN ── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(208,140,97,0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(90,122,87,0.08), transparent);
}

#auth-screen.hidden { display: none; }

.auth-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 40px 36px;
  animation: fadeUp var(--slow) var(--ease) both;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo-img {
  height: 56px;
  width: auto;
}

.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 4px;
  margin-bottom: 28px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 9px 16px;
  border: none;
  background: transparent;
  border-radius: calc(var(--r) - 4px);
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}

.auth-tab.active {
  background: var(--surface);
  color: var(--clay);
  box-shadow: var(--shadow-xs);
}

.auth-panel { display: none; }
.auth-panel.active { display: block; }

/* ── APP SHELL ── */
#app { display: none; min-height: 100vh; flex-direction: column; }
#app:not(.hidden) { display: flex; }
.hidden { display: none !important; }

/* ── HEADER ── */
.app-header {
  height: var(--header-h);
  background: rgba(247,246,243,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  transition: background var(--mid) var(--ease);
}

[data-theme="dark"] .app-header {
  background: rgba(20,20,18,0.92);
}

.header-inner {
  max-width: 680px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  height: 32px;
  width: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── ICON BUTTON ── */
.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--r);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease-spring);
  color: var(--ink-soft);
}

.icon-btn:hover {
  background: var(--surface-2);
  transform: scale(1.08);
}

.icon-btn:active { transform: scale(0.95); }

/* ── SIDE MENU ── */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--mid) var(--ease);
}

.menu-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100vh;
  background: var(--surface);
  z-index: 400;
  transform: translateX(100%);
  transition: transform var(--mid) var(--ease);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.side-menu.open {
  transform: translateX(0);
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.menu-email {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.menu-items {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.menu-item {
  width: 100%;
  padding: 13px 16px;
  border: none;
  background: transparent;
  border-radius: var(--r);
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: all var(--fast) var(--ease);
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.menu-item--danger { color: var(--error); margin-top: auto; }
.menu-item--danger:hover { background: var(--error-bg); }

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* ── FIELDS ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r);
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  transition: border-color var(--fast), box-shadow var(--fast), background var(--mid);
  outline: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--clay);
  box-shadow: 0 0 0 3px var(--clay-glow);
}

textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  margin-bottom: 18px;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--clay);
  cursor: pointer;
}

/* ── BUTTONS ── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  background: var(--clay);
  color: #FFF;
  border: none;
  border-radius: var(--r);
  font-family: 'Sora', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
  box-shadow: var(--shadow-clay);
  letter-spacing: -0.01em;
}

.btn-primary:hover {
  background: var(--clay-d);
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(208,140,97,0.35);
}

.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-clay); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 24px;
  background: transparent;
  color: var(--ink-muted);
  border: none;
  border-radius: var(--r);
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
  margin-top: 8px;
}

.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }

.btn-sage {
  background: var(--sage);
  color: #FFF;
  box-shadow: 0 4px 20px rgba(90,122,87,0.25);
}

.btn-sage:hover { background: var(--sage-d); }

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--r-sm);
  width: auto;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: box-shadow var(--mid) var(--ease), transform var(--mid) var(--ease);
}

.card-hover:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: var(--bg);
  padding: 13px 20px;
  border-radius: var(--r-full);
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  opacity: 0;
  transition: all var(--mid) var(--ease-spring);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 48px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.err { background: var(--error); }
.toast.warn { background: var(--warning); }

#toast-icon { font-size: 16px; flex-shrink: 0; }

/* ── ALERTS ── */
.alert {
  padding: 13px 16px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  margin: 12px 0;
  display: none;
  border: 1px solid transparent;
  line-height: 1.5;
}

.alert.show { display: block; animation: alertIn 0.2s var(--ease-spring); }
.alert-ok   { background: var(--success-bg); color: var(--success); border-color: rgba(74,138,90,0.2); }
.alert-err  { background: var(--error-bg);   color: var(--error);   border-color: rgba(192,57,43,0.2); }
.alert-info { background: var(--clay-bg);    color: var(--clay-d);  border-color: rgba(208,140,97,0.2); }

/* ── LOADER ── */
.view-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  font-size: 32px;
  animation: pulse 1.2s ease-in-out infinite;
}

.view-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 12px;
  color: var(--ink-muted);
}

.placeholder-icon { font-size: 48px; opacity: 0.6; }
.placeholder-title { font-family: 'Fraunces', serif; font-size: 22px; color: var(--ink-soft); }
.placeholder-sub { font-size: 14px; }

/* ── SPINNER ── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--clay);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}

/* ── AVATAR ── */
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--clay-l);
  background: var(--clay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar-lg { width: 96px; height: 96px; font-size: 40px; border-width: 3px; }
.avatar-xl { width: 120px; height: 120px; font-size: 52px; border-width: 4px; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-clay { background: var(--clay-bg); color: var(--clay-d); }
.badge-sage { background: var(--sage-bg); color: var(--sage-d); }
.badge-ok   { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-err  { background: var(--error-bg); color: var(--error); }

/* ── DIVIDER ── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── ANIMATIONS ── */
@keyframes fadeUp   { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn   { from { opacity:0; } to { opacity:1; } }
@keyframes scaleIn  { from { opacity:0; transform:scale(0.93); } to { opacity:1; transform:scale(1); } }
@keyframes alertIn  { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes pulse    { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

.anim-fade-up  { animation: fadeUp  var(--slow) var(--ease) both; }
.anim-fade-in  { animation: fadeIn  var(--slow) var(--ease) both; }
.anim-scale-in { animation: scaleIn var(--mid) var(--ease-spring) both; }

.stagger > * { animation: fadeUp var(--slow) var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }

/* ── UTILS ── */
.text-center  { text-align: center; }
.text-muted   { color: var(--ink-muted); font-size: 14px; }
.text-small   { font-size: 13px; }
.text-clay    { color: var(--clay); }
.text-sage    { color: var(--sage); }
.fw-bold      { font-weight: 700; }
.fw-semi      { font-weight: 600; }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col     { display: flex; flex-direction: column; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-sm{margin-top:8px;} .mt-md{margin-top:16px;} .mt-lg{margin-top:24px;}
.mb-sm{margin-bottom:8px;} .mb-md{margin-bottom:16px;} .mb-lg{margin-bottom:24px;}

/* ── RESPONSIVE ── */
@media (max-width: 520px) {
  .auth-box { padding: 32px 24px; }
  .main-content { padding: 20px 16px 32px; }
}
