/* ===================================================
   PetPal — Theme su Bootstrap 5.3.8
   Palette calda: arancio terracotta + crema + sabbia
   =================================================== */

:root {
  --bs-primary: #E8621A;
  --bs-primary-rgb: 232, 98, 26;

  --orange:        #E8621A;
  --orange-light:  #F5956A;
  --orange-pale:   #FFF0E6;
  --orange-deep:   #B84A0E;
  --cream:         #FFF8F0;
  --cream-2:       #FFF1E0;
  --sand:          #F0E6D8;
  --sand-2:        #E0D0BC;
  --brown:         #4A2E1A;
  --brown-2:       #7A4F35;
  --text:          #2C1A0E;
  --text-2:        #6B4A35;
  --text-3:        #A07860;
  --gold:          #C9882A;
  --gold-pale:     #FDF3E0;

  --bs-body-bg:    var(--cream);
  --bs-body-color: var(--text);
  --bs-body-font-family: 'DM Sans', system-ui, -apple-system, sans-serif;

  --radius-card: 18px;
  --radius-sm: 12px;
  --radius-pill: 100px;
  --shadow-soft: 0 4px 24px rgba(74, 46, 26, 0.08);
  --shadow-medium: 0 8px 32px rgba(74, 46, 26, 0.12);

  --font-display: 'Fraunces', Georgia, serif;
}

* { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--cream);
  color: var(--text);
  font-family: var(--bs-body-font-family);
  padding-bottom: 80px;
}

/* Bootstrap primary override */
.btn-primary {
  --bs-btn-bg: var(--orange);
  --bs-btn-border-color: var(--orange);
  --bs-btn-hover-bg: var(--orange-deep);
  --bs-btn-hover-border-color: var(--orange-deep);
  --bs-btn-active-bg: var(--orange-deep);
  --bs-btn-active-border-color: var(--orange-deep);
}
.btn-outline-primary {
  --bs-btn-color: var(--orange);
  --bs-btn-border-color: var(--orange);
  --bs-btn-hover-bg: var(--orange);
  --bs-btn-hover-border-color: var(--orange);
}
.text-primary { color: var(--orange) !important; }
.bg-primary { background-color: var(--orange) !important; }

a { color: var(--orange); }
a:hover { color: var(--orange-deep); }

/* ===============================
   BRAND
   =============================== */
.brand-logo {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--orange);
  letter-spacing: -1px;
  line-height: 1;
}
.brand-logo span {
  font-style: italic;
  font-weight: 400;
  color: var(--brown-2);
}
.brand-logo.brand-sm { font-size: 1.4rem; }

/* ===============================
   AUTH PAGES
   =============================== */
.auth-body {
  background: linear-gradient(135deg, #FFF8F0 0%, #FFF1E0 60%, #FFE0C0 100%);
  min-height: 100vh;
  padding-bottom: 2rem;
}

.auth-card {
  border-radius: var(--radius-card) !important;
  background: white;
  overflow: hidden;
}

.pill-tabs .nav-link {
  border-radius: var(--radius-pill);
  font-weight: 500;
  color: var(--text-2);
  padding: 0.55rem 1.25rem;
  font-size: 0.9rem;
  background: transparent;
  border: none;
}
.pill-tabs .nav-link.active {
  background-color: var(--orange);
  color: white;
}
.pill-tabs { background: var(--sand); padding: 4px; border-radius: var(--radius-pill); }

.input-group-modern .input-group-text {
  background: white;
  border: 1.5px solid var(--sand-2);
  border-right: none;
  color: var(--text-3);
}
.input-group-modern .form-control {
  border: 1.5px solid var(--sand-2);
  border-left: none;
  padding-left: 0;
  color: var(--text);
}
.input-group-modern .form-control:focus,
.form-control:focus,
.form-select:focus {
  border-color: var(--orange-light);
  box-shadow: 0 0 0 3px rgba(232, 98, 26, 0.1);
}
.form-control, .form-select {
  border: 1.5px solid var(--sand-2);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.form-label.small {
  font-size: 0.7rem !important;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 4px;
}

.btn-lg-modern {
  border-radius: var(--radius-pill);
  padding: 0.85rem;
  font-weight: 500;
  font-size: 1rem;
}
.btn-sm-modern {
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.9rem;
  font-weight: 500;
  font-size: 0.85rem;
}
.btn { transition: transform 0.1s; }
.btn:active { transform: scale(0.97); }

.toggle-pwd {
  border: 1.5px solid var(--sand-2);
  border-left: none;
  background: white;
  color: var(--text-3);
}

/* ===============================
   APP HEADER
   =============================== */
.app-header {
  background: var(--cream);
  border-bottom: 1px solid var(--sand);
  padding: 0.7rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background-color: rgba(255, 248, 240, 0.95);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--sand-2);
  background: white;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.1rem;
}
.btn-icon:hover { background: var(--cream-2); }
.btn-icon .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.6rem;
  padding: 2px 5px;
}

.badge-premium {
  background: var(--gold-pale);
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}
.badge-free {
  background: var(--sand);
  color: var(--text-3);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 500;
}

.dropdown-menu {
  border-radius: var(--radius-card);
  padding: 0.5rem;
}
.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
}
.dropdown-item:hover {
  background: var(--cream-2);
  color: var(--orange);
}

/* ===============================
   APP MAIN
   =============================== */
.app-main {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 100px !important;
}

@media (min-width: 768px) {
  .app-main { max-width: 720px; }
  .container-fluid { max-width: 720px; }
}

.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }

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

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.5px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}

/* ===============================
   HERO CARD (Home)
   =============================== */
.hero-card {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-deep) 100%);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-medium);
}
.hero-bg-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-bg-decor::before,
.hero-bg-decor::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.hero-bg-decor::before {
  width: 160px; height: 160px;
  right: -30px; top: -50px;
}
.hero-bg-decor::after {
  width: 100px; height: 100px;
  right: 40px; bottom: -30px;
}
.hero-content { position: relative; z-index: 1; }
.hero-greeting { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; }
.hero-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 0;
}
.hero-title em { font-style: italic; font-weight: 400; }

.stat-pill {
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.stat-num { font-size: 1.4rem; font-weight: 600; line-height: 1; }
.stat-lbl { font-size: 0.7rem; color: rgba(255, 255, 255, 0.8); margin-top: 2px; }

/* ===============================
   PETS SCROLL (Home carousel)
   =============================== */
.pets-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0.25rem 0.25rem 1rem;
  scrollbar-width: none;
}
.pets-scroll::-webkit-scrollbar { display: none; }

.pet-card-mini {
  min-width: 150px;
  background: white;
  border-radius: var(--radius-card);
  padding: 1rem;
  border: 1.5px solid var(--sand);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.pet-card-mini:active { transform: scale(0.97); }
.pet-card-mini:hover { box-shadow: var(--shadow-soft); }

.pet-card-mini .pet-photo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--cream-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 0.75rem;
  border: 2px solid var(--orange-pale);
  overflow: hidden;
}
.pet-card-mini .pet-photo img {
  width: 100%; height: 100%; object-fit: cover;
}
.pet-card-mini .pet-name {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 2px;
}
.pet-card-mini .pet-info {
  font-size: 0.72rem;
  color: var(--text-3);
}
.pet-card-mini .pet-tags {
  margin-top: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.add-pet-tile {
  min-width: 130px;
  background: var(--cream-2);
  border: 2px dashed var(--sand-2);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-3);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  flex-shrink: 0;
}
.add-pet-tile i { font-size: 1.6rem; color: var(--orange-light); }
.add-pet-tile:hover { border-color: var(--orange-light); color: var(--orange); }

/* ===============================
   QUICK ACTIONS
   =============================== */
.quick-action {
  background: white;
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-sm);
  padding: 0.9rem 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 0.7rem;
  font-weight: 500;
  transition: all 0.15s;
}
.quick-action i { font-size: 1.3rem; color: var(--orange); }
.quick-action:hover { background: var(--cream-2); border-color: var(--orange-light); }
.quick-action span { line-height: 1.1; }
.quick-action.premium-tile {
  background: linear-gradient(135deg, var(--gold-pale), white);
  border-color: var(--gold);
}
.quick-action.premium-tile i { color: var(--gold); }

/* ===============================
   REMINDERS LIST
   =============================== */
.reminders-list { display: flex; flex-direction: column; gap: 8px; }
.reminder-item {
  background: white;
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s;
}
.reminder-item:hover { border-color: var(--orange-light); }
.reminder-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--orange-pale);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}
.reminder-icon.urgent { background: #FDECEA; color: #C0392B; }
.reminder-icon.soon { background: var(--gold-pale); color: var(--gold); }
.reminder-icon.normal { background: #E6F2FA; color: #1A6FA8; }
.reminder-text { flex: 1; min-width: 0; }
.reminder-title { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.reminder-sub { font-size: 0.74rem; color: var(--text-3); margin-top: 2px; }
.reminder-time { font-size: 0.74rem; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }
.reminder-time.urgent { color: #C0392B; font-weight: 500; }

/* ===============================
   BOTTOM NAVIGATION
   =============================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--sand);
  display: flex;
  padding: 0.3rem 0 0.6rem;
  z-index: 99;
  max-width: 480px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .bottom-nav { max-width: 720px; }
}

.bottom-nav .nav-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-3);
  padding: 0.4rem 0;
  transition: color 0.15s;
}
.bottom-nav .nav-btn.active { color: var(--orange); }
.bottom-nav .nav-btn i { font-size: 1.3rem; }
.bottom-nav .nav-btn span { font-size: 0.65rem; font-weight: 500; }

/* ===============================
   PET LIST CARDS (Pets view)
   =============================== */
.pet-list-card {
  background: white;
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-card);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.pet-list-card:hover { border-color: var(--orange-light); transform: translateY(-2px); }
.pet-list-card .pet-avatar {
  width: 64px; height: 64px;
  border-radius: 14px;
  background: var(--cream-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--orange);
  overflow: hidden;
  flex-shrink: 0;
}
.pet-list-card .pet-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}

.tag-mini {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 500;
}
.tag-green { background: #E8F5EA; color: #3A7D44; }
.tag-orange { background: var(--orange-pale); color: var(--orange-deep); }
.tag-blue { background: #E6F2FA; color: #1A6FA8; }
.tag-gold { background: var(--gold-pale); color: var(--gold); }
.tag-red { background: #FDECEA; color: #C0392B; }

/* ===============================
   MODALS
   =============================== */
.modal-content {
  border-radius: 24px 24px 0 0 !important;
  border: none !important;
}
@media (min-width: 768px) {
  .modal-content { border-radius: var(--radius-card) !important; }
}
.modal-dialog-bottom {
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  min-height: 100%;
}
@media (min-width: 768px) {
  .modal-dialog-bottom { align-items: center; min-height: 100%; }
}
.modal-dialog-bottom .modal-content {
  width: 100%;
  max-height: 90vh;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  color: var(--text);
}

/* species grid */
.species-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.species-tile {
  background: white;
  border: 1.5px solid var(--sand-2);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-2);
  margin: 0;
}
.species-tile i { font-size: 1.3rem; color: var(--text-3); }
.btn-check:checked + .species-tile {
  background: var(--orange-pale);
  border-color: var(--orange);
  color: var(--orange-deep);
}
.btn-check:checked + .species-tile i { color: var(--orange); }

/* ===============================
   HEALTH VIEW
   =============================== */
.health-card {
  background: white;
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-card);
  padding: 1.1rem;
}
.health-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
}
.health-card-header i { color: var(--orange); font-size: 1.1rem; }
.health-card-header h6 { margin: 0; font-weight: 500; font-size: 0.95rem; color: var(--text); }

.health-stat-box {
  background: var(--cream-2);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  text-align: left;
}
.health-stat-box .label {
  font-size: 0.65rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.health-stat-box .value {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
}
.health-stat-box .unit { font-size: 0.75rem; color: var(--text-3); font-weight: 400; }

.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 1rem;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  width: 1px;
  height: calc(100% - 16px);
  background: var(--sand-2);
}
.timeline-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--orange-pale);
  border: 2px solid var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--orange);
  flex-shrink: 0;
  z-index: 1;
}
.timeline-dot.done {
  background: #E8F5EA;
  border-color: #3A7D44;
  color: #3A7D44;
}
.timeline-content {
  flex: 1;
  padding-top: 1px;
}
.timeline-content .tl-title { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.timeline-content .tl-sub { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.timeline-content .tl-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

.premium-lock {
  background: linear-gradient(135deg, var(--gold-pale), white);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  color: var(--gold);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
}
.premium-lock i { font-size: 1.5rem; display: block; margin-bottom: 6px; }
.premium-lock:hover { box-shadow: var(--shadow-soft); }

/* ===============================
   PREMIUM HERO
   =============================== */
.premium-hero {
  background: linear-gradient(135deg, var(--brown) 0%, var(--brown-2) 100%);
  border-radius: var(--radius-card);
  color: white;
  position: relative;
  overflow: hidden;
}
.premium-deco {
  position: absolute;
  font-size: 8rem;
  top: -20px;
  right: -20px;
  color: rgba(255, 255, 255, 0.05);
  transform: rotate(-15deg);
  pointer-events: none;
}
.premium-hero h2 {
  font-family: var(--font-display);
  font-weight: 500;
  position: relative;
  z-index: 1;
}
.premium-hero h2 em { color: var(--orange-light); font-style: italic; }
.premium-hero .text-warning { color: var(--orange-light) !important; }
#paypal-button-container { position: relative; z-index: 2; }

.compare-table {
  font-size: 0.85rem;
}
.compare-table thead th {
  background: var(--cream-2);
  font-weight: 500;
  color: var(--text-2);
  border: none;
  padding: 0.7rem;
}
.compare-table td { padding: 0.65rem; border-color: var(--sand); color: var(--text-2); }
.compare-table tr:last-child td { border-bottom: none; }

/* ===============================
   PROFILE
   =============================== */
.profile-avatar {
  width: 70px; height: 70px;
  border-radius: 50%;
  background: var(--orange-pale);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 2px solid var(--orange);
}

.menu-list {
  border-radius: var(--radius-card);
  overflow: hidden;
}
.menu-list .list-group-item {
  display: flex;
  align-items: center;
  padding: 0.9rem 1rem;
  border-color: var(--sand);
  background: white;
  font-size: 0.9rem;
  color: var(--text);
}
.menu-list .list-group-item:hover {
  background: var(--cream-2);
  cursor: pointer;
}
.menu-list .list-group-item.text-danger:hover { color: #C0392B; }

/* ===============================
   TOAST
   =============================== */
.toast {
  background: var(--text);
  color: white;
  border-radius: var(--radius-pill);
  border: none;
  padding: 0.7rem 1.2rem;
  min-width: 200px;
  box-shadow: var(--shadow-medium);
  font-size: 0.85rem;
}
.toast.toast-success { border-left: 4px solid #3A7D44; }
.toast.toast-error { border-left: 4px solid #C0392B; }
.toast.toast-warning { border-left: 4px solid var(--gold); }

/* ===============================
   ALERTS / EMPTY STATES
   =============================== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-3);
}
.empty-state i {
  font-size: 3rem;
  color: var(--orange-light);
  display: block;
  margin-bottom: 1rem;
}
.empty-state h6 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-2);
  margin-bottom: 0.5rem;
}

.alert {
  border-radius: var(--radius-sm);
  border: none;
}
.alert-warning {
  background: var(--gold-pale);
  color: var(--brown);
  border-left: 4px solid var(--gold);
}

/* ===============================
   ANIMATIONS
   =============================== */
@media (prefers-reduced-motion: no-preference) {
  .pet-card-mini, .quick-action, .reminder-item, .pet-list-card {
    will-change: transform;
  }
}

/* Override Bootstrap default form-check */
.form-check-input:checked {
  background-color: var(--orange);
  border-color: var(--orange);
}
.form-check-input:focus {
  border-color: var(--orange-light);
  box-shadow: 0 0 0 3px rgba(232, 98, 26, 0.15);
}

/* Card hover */
.card { border-radius: var(--radius-card); border-color: var(--sand); }
.card-body { padding: 1.2rem; }

/* Spinner */
.spinner-border-sm { width: 1rem; height: 1rem; border-width: 2px; }

/* Diary entry card */
.diary-card {
  background: white;
  border: 1.5px solid var(--sand);
  border-radius: var(--radius-card);
  padding: 1.1rem;
  margin-bottom: 10px;
}
.diary-card .diary-date {
  font-size: 0.7rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.diary-card .diary-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  margin-bottom: 6px;
}
.diary-card .diary-content {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}
