/* ═══════════════════════════════════════════════════════════
   LigriPets Mini App — Premium Warm Design System
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Custom Properties ──────────────────────────────── */
:root {
  --bg-primary: #CCC0B2;
  --bg-secondary: #C0B4A6;
  --bg-dark: #B0A496;
  --bg-card: rgba(255, 255, 255, 0.12);
  --bg-card-solid: #D4C8BA;
  --bg-input: rgba(255, 255, 255, 0.18);
  --bg-input-focus: rgba(255, 255, 255, 0.28);

  --text-primary: #3E3229;
  --text-secondary: #6B5D50;
  --text-light: #8C7E70;
  --text-white: #FAF7F4;
  --text-placeholder: #9E9185;

  --accent: #8B7355;
  --accent-light: #A68E6E;
  --accent-hover: #7A6348;
  --accent-glow: rgba(139, 115, 85, 0.3);

  --success: #6B8F71;
  --error: #C4625A;
  --warning: #C4A35A;

  --border-light: rgba(62, 50, 41, 0.12);
  --border-medium: rgba(62, 50, 41, 0.2);

  --shadow-sm: 0 2px 8px rgba(62, 50, 41, 0.08);
  --shadow-md: 0 4px 20px rgba(62, 50, 41, 0.12);
  --shadow-lg: 0 8px 40px rgba(62, 50, 41, 0.18);
  --shadow-glow: 0 0 20px rgba(139, 115, 85, 0.15);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-medium: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(165deg, var(--bg-primary) 0%, var(--bg-secondary) 40%, var(--bg-dark) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ── App Container ──────────────────────────────────────── */
#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ── Screen System ──────────────────────────────────────── */
.screen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
  pointer-events: none;
  overflow-y: auto;
}

.screen.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
  position: relative;
}

.screen.fade-out {
  opacity: 0;
  transform: translateY(-20px);
}

/* ── Splash Screen ──────────────────────────────────────── */
#splash-screen {
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}

.logo-container {
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto 32px;
  animation: logoReveal 1s ease-out forwards;
}

.logo-container img {
  width: 100%;
  height: auto;
  display: block;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at center, black 45%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 70% at center, black 45%, transparent 80%);
}

@keyframes logoReveal {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.welcome-text {
  animation: fadeInUp 0.8s ease-out 0.4s forwards;
  opacity: 0;
}

.welcome-text h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.welcome-text p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

.welcome-fade-out {
  animation: fadeOutDown 0.6s ease-in forwards !important;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutDown {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(16px); }
}

/* ── Auth Screen ────────────────────────────────────────── */
#auth-screen {
  padding: 20px 24px 40px;
  justify-content: flex-start;
  padding-top: 28px;
}

.auth-logo {
  width: 280px;
  height: auto;
  margin-bottom: 20px;
}

.auth-logo img {
  width: 100%;
  height: auto;
  display: block;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at center, black 45%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 70% at center, black 45%, transparent 80%);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 4px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 28px;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
}

.auth-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: calc(var(--radius-lg) - 4px);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  background: var(--accent);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* ── Auth Forms ─────────────────────────────────────────── */
.auth-form {
  width: 100%;
  max-width: 320px;
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: fadeInUp 0.4s ease-out forwards;
}

.auth-form.active {
  display: flex;
}

/* ── Form Elements (shared) ─────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding-left: 4px;
}

.field-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.field-input::placeholder {
  color: var(--text-placeholder);
}

.field-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(196, 98, 90, 0.2);
}

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

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

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after {
  opacity: 1;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1.5px solid var(--border-medium);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: var(--bg-input-focus);
}

.btn-nav {
  padding: 10px 20px;
  font-size: 0.88rem;
}

/* ── Error/Status Messages ──────────────────────────────── */
.form-error {
  font-size: 0.82rem;
  color: var(--error);
  padding: 8px 12px;
  background: rgba(196, 98, 90, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(196, 98, 90, 0.2);
  text-align: center;
  animation: shakeX 0.4s ease-out;
}

.form-success {
  font-size: 0.82rem;
  color: var(--success);
  padding: 8px 12px;
  background: rgba(107, 143, 113, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(107, 143, 113, 0.2);
  text-align: center;
}

@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ── Language Selector ──────────────────────────────────── */
.lang-switch {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 3px;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
}

.lang-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: calc(var(--radius-lg) - 3px);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn.active {
  background: var(--accent);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
}

.lang-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
}

/* ── Questionnaire Screen ───────────────────────────────── */
#form-screen {
  justify-content: flex-start;
  padding: 20px 20px 40px;
  align-items: stretch;
}

.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}

/* Left: logo + title */
.form-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Center: user badge takes remaining space, centered */
#user-badge {
  flex: 1;
  text-align: center;
  justify-content: center;
}

.form-logo-small {
  width: 44px;
  height: 44px;
}

.form-logo-small img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.form-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Progress Bar ───────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin-bottom: 24px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 2px;
  transition: width var(--transition-medium);
  box-shadow: var(--shadow-glow);
}

/* ── Block Tabs ─────────────────────────────────────────── */
.block-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.block-tabs::-webkit-scrollbar {
  display: none;
}

.block-tab {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-light);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

.block-tab.active {
  background: var(--accent);
  color: var(--text-white);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.block-tab.completed {
  border-color: var(--success);
  color: var(--success);
}

.block-tab .tab-icon {
  font-size: 1rem;
}

.block-tab .tab-check {
  display: none;
  font-size: 0.7rem;
}

.block-tab.completed .tab-check {
  display: inline;
}

/* ── Form Block ─────────────────────────────────────────── */
.form-block {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: fadeInUp 0.35s ease-out forwards;
}

.form-block.active {
  display: flex;
}

.block-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}

/* ── Photo Upload ───────────────────────────────────────── */
.photo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.photo-preview {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-input);
}

.photo-preview:hover {
  border-color: var(--accent);
  background: var(--bg-input-focus);
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview .placeholder-icon {
  font-size: 2rem;
  color: var(--text-placeholder);
}

.photo-input {
  display: none;
}

.photo-label {
  font-size: 0.82rem;
  color: var(--text-light);
}

/* ── Navigation Footer ──────────────────────────────────── */
.form-nav {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.form-nav .btn {
  flex: 1;
}

/* ── AI Scan Card ───────────────────────────────────────── */
.ai-scan-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  backdrop-filter: blur(10px);
}

.ai-scan-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.ai-scan-card .score-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
}

.score-good {
  background: rgba(107, 143, 113, 0.15);
  color: var(--success);
}

.score-warn {
  background: rgba(196, 163, 90, 0.15);
  color: var(--warning);
}

.ai-scan-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Checkbox ───────────────────────────────────────────── */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.checkbox-group span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Success Screen ─────────────────────────────────────── */
#success-screen {
  text-align: center;
}

.success-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

.success-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.success-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ── Loading Spinner ────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: var(--text-white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-dark {
  border-color: var(--border-light);
  border-top-color: var(--accent);
}

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

/* ── Scan Loading ───────────────────────────────────────── */
.scan-loading {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.scan-loading.visible {
  display: flex;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 380px) {
  .block-tab {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .field-input {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .btn {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}

/* ── Password Toggle ────────────────────────────────────── */
.password-wrapper {
  position: relative;
}

.password-wrapper .field-input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  transition: color var(--transition-fast);
}

.toggle-password:hover {
  color: var(--text-primary);
}

/* ── Logout Button ──────────────────────────────────────── */
.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-light);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px 12px;
  backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
  z-index: 100;
}

.logout-btn:hover {
  color: var(--error);
  border-color: var(--error);
  background: rgba(230, 57, 70, 0.08);
  transform: scale(1.04);
}

/* Profile screen — absolute positioned logout stays top-right */
#profile-screen .logout-btn {
  position: absolute;
  top: 15px;
  right: 15px;
}

.user-badge {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-light);
  padding: 5px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-lang-switch {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 100;
  margin: 0;
}


/* ── Paw decoration ─────────────────────────────────────── */
.paw-decoration {
  position: fixed;
  bottom: -30px;
  right: -20px;
  font-size: 8rem;
  opacity: 0.04;
  transform: rotate(-20deg);
  pointer-events: none;
  z-index: 0;
}

/* ── bottom-nav styles ──────────────────────────────────── */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  padding: 10px 12px 20px 12px;
  background: rgba(204, 189, 175, 0.85); /* Glassy beige matching image */
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  backdrop-filter: blur(24px);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.bottom-nav-btn {
  background: transparent;
  border: none;
  color: #FFFFFF;
  opacity: 0.8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 52px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.bottom-nav-btn:active .nav-icon-svg {
  transform: scale(0.85);
}

.bottom-nav-btn.active {
  background: #5E4028; /* Rich dark brown pill */
  color: #FFFFFF;
  opacity: 1;
  box-shadow: 0 4px 12px rgba(94, 64, 40, 0.3);
}

.bottom-nav-btn .nav-icon-svg {
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.bottom-nav-btn .nav-text {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── profile-screen layout ──────────────────────────────── */
#profile-screen {
  padding-bottom: 82px; /* space for bottom-nav */
  display: flex;
  flex-direction: column;
}

.profile-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 20px 5px;
  background: transparent;
  position: relative;
}

.profile-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.profile-sub-tab {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.profile-sub-tab.active {
  display: block;
}

.section-title {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 15px;
  font-weight: 600;
}

/* ── pet-selector-tags ─────────────────────────────────── */
.pet-selector-tags {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 15px;
  padding-bottom: 5px;
}

.pet-tag {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pet-tag.active {
  background: var(--accent);
  color: var(--text-white);
  border-color: var(--accent);
  box-shadow: 0 4px 8px rgba(139, 115, 85, 0.25);
}

/* ── premium-pet-card ──────────────────────────────────── */
.premium-pet-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.premium-pet-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}

.pet-card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.pet-photo-wrapper {
  width: min(72vw, 260px);
  height: min(72vw, 260px);
  border-radius: 20px;
  border: 3px solid rgba(166, 142, 110, 0.65);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.pet-photo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-photo-wrapper span.placeholder-emoji {
  font-size: 4rem;
}

.pet-title-block {
  display: flex;
  flex-direction: column;
}

.pet-card-name {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.pet-card-breed {
  font-size: 1rem;
  color: var(--text-primary);
  margin-top: 0;
}

/* ── pet-details-grid ─────────────────────────────────── */
.pet-details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.pet-name-detail {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 0.72rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 0.92rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2px;
}

/* ── pet-food-tracker ──────────────────────────────────── */
.pet-food-tracker {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
}

.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.tracker-title {
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 600;
}

.tracker-days {
  font-size: 0.95rem;
  font-weight: 700;
}

.tracker-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.tracker-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.tracker-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ── pet-qr-tag-section ────────────────────────────────── */
.pet-qr-tag-section {
  background: var(--text-white);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}

.qr-tag-header {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-bottom: 12px;
  width: 100%;
}

.qr-tag-icon {
  font-size: 1.5rem;
}

.qr-tag-title-group h4 {
  font-size: 0.88rem;
  color: #3E3229;
  margin: 0;
  font-weight: 600;
}

.qr-tag-title-group p {
  font-size: 0.72rem;
  color: #8C7E70;
  margin: 2px 0 0 0;
}

.qr-code-image-container {
  width: 140px;
  height: 140px;
  background: white;
  padding: 5px;
  border: 1px solid #E6DED6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.qr-code-image-container img {
  width: 100%;
  height: 100%;
}

.qr-tag-hint {
  font-size: 0.74rem;
  color: #6B5D50;
  text-align: center;
  margin: 0;
  line-height: 1.3;
}

/* ── features-grid ─────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.feature-item {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.feature-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
}

.feature-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.feature-item h4 {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin: 0 0 5px 0;
  font-weight: 600;
}

.feature-item p {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.3;
}

.feature-panel {
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px;
}

.feature-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-section h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
}

.feature-section p,
.feature-empty {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 0;
}

.feature-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.feature-row:last-child {
  border-bottom: 0;
}

.feature-row div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feature-row span {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.feature-row b {
  color: var(--accent);
  font-size: 0.82rem;
  white-space: nowrap;
}

.feature-row-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-direction: column;
}

.feature-mini-btn {
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.feature-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* Legacy chip (kept for backward compat) */
.feature-chip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
}
.feature-chip input { accent-color: var(--accent); }

/* New AI mode pill buttons */
.ai-mode-btn {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 8px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.3;
}
.ai-mode-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(139, 115, 85, 0.06);
}
.ai-mode-btn--active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text-white);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(139, 115, 85, 0.28);
}
.ai-mode-btn--active:hover {
  color: var(--text-white);
  background: var(--accent);
}

.feature-note {
  padding: 10px 12px;
  background: rgba(139, 115, 85, 0.1);
  border: 1px solid rgba(139, 115, 85, 0.16);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.4;
}

.feature-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.feature-toggle input {
  accent-color: var(--accent);
}

.feature-qr {
  width: 180px;
  height: 180px;
  align-self: center;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.qr-pet-photo {
  width: min(240px, 80vw);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  display: block;
  margin: 0 auto 14px;
}

.payment-stars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.mini-feature-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  flex-direction: column;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.mini-feature-screen.active {
  display: flex;
}

.mini-feature-header {
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
}

.mini-feature-header strong {
  font-size: 1rem;
  text-align: center;
}

.mini-feature-back {
  justify-self: start;
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.mini-feature-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.mini-feature-body .feature-section {
  max-width: 760px;
  margin: 0 auto 14px;
}

/* ── settings-list ─────────────────────────────────────── */
.settings-list {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 5px 15px;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 0.9rem;
  color: var(--text-primary);
}

#form-lang-switch {
  display: none;
}

.settings-action-row,
.settings-payment {
  align-items: flex-start;
  gap: 12px;
}

.settings-action-row > div,
.settings-payment > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-action-row span,
.settings-payment span {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.35;
}

.settings-action-btn,
.lang-switch-btn {
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.settings-action-btn:hover,
.lang-switch-btn:hover {
  background: var(--bg-input-focus);
}

.settings-action-btn.secondary {
  background: transparent;
}

.lang-switch-btn.active {
  background: var(--accent);
  color: var(--text-white);
  border-color: var(--accent);
}

.payment-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-panel {
  margin: 0 0 8px;
  padding: 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.5;
}

.payment-panel strong {
  color: var(--text-primary);
}

/* ── Profile Header Logo ───────────────────────────────── */
.profile-header-logo {
  width: 150px;
  height: auto;
  margin: 0 auto;
}

.profile-header-logo img {
  width: 100%;
  height: auto;
  display: block;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at center, black 45%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 70% at center, black 45%, transparent 80%);
}

/* ── Pet Actions Row ───────────────────────────────────── */
.pet-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.pet-action-btn {
  flex: 1;
  font-size: 0.82rem !important;
  padding: 10px 8px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pet-action-delete {
  border-color: rgba(196, 98, 90, 0.3) !important;
  color: var(--error) !important;
}

.pet-action-delete:hover {
  background: rgba(196, 98, 90, 0.08) !important;
}

/* ── Chat Overlay ──────────────────────────────────────── */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.chat-container {
  width: 100%;
  max-width: 480px;
  height: 85vh;
  background: var(--bg-primary);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  animation: slideUpChat 0.3s ease;
}

@keyframes slideUpChat {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.chat-header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  border-radius: 20px 20px 0 0;
}

.chat-header strong {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.chat-back {
  border: 1px solid var(--border-medium);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--text-white);
  border-bottom-right-radius: 4px;
}

.chat-bubble.admin {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
}

.chat-bubble .chat-time {
  display: block;
  font-size: 0.65rem;
  opacity: 0.7;
  margin-top: 4px;
  text-align: right;
}

.chat-empty {
  text-align: center;
  color: var(--text-light);
  font-size: 0.86rem;
  margin: auto;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
}

.chat-input {
  flex: 1;
  padding: 12px 14px !important;
  border-radius: 20px !important;
}

.chat-send {
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0 !important;
  border-radius: 50% !important;
  font-size: 1.2rem;
}

/* ── Delete Pet Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-primary);
  border-radius: 20px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.delete-pet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.delete-pet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.delete-pet-item button {
  border: 1px solid rgba(196, 98, 90, 0.3);
  background: rgba(196, 98, 90, 0.08);
  color: var(--error);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.delete-pet-item button:hover {
  background: rgba(196, 98, 90, 0.18);
}

/* ── Document Preview Improvements ─────────────────────── */
.doc-preview-image {
  max-width: 100%;
  border-radius: 10px;
  margin: 8px 0;
}

.doc-preview-frame {
  width: 100%;
  min-height: 400px;
  border: none;
  border-radius: 10px;
}

.ref-code {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  letter-spacing: 3px;
  color: var(--accent);
}

.ai-photo-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (max-width: 380px) {
  .settings-action-row,
  .settings-payment {
    flex-direction: column;
  }

  .payment-actions {
    flex-direction: row;
    width: 100%;
  }

  .pet-actions-row {
    flex-direction: column;
  }
}

/* Back-to-main button in form-screen header */
.form-back-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 6px;
  opacity: 0.7;
  border-radius: 6px;
  transition: opacity 0.2s, background 0.15s;
  display: none;
}
.form-back-btn:hover { opacity: 1; background: var(--bg-input); }
.has-profile .form-back-btn { display: inline-flex; align-items: center; }

/* AI answer styled output */
#ai-feature-answer p { margin: 6px 0; line-height: 1.55; }
