/*
 * Pet Owner Mobile App - Petyar (پت‌یار)
 * Styled adhering to ui-ux-pro-max guidelines:
 * - Caring Teal (#0D9488) + Warm Amber (#EA580C)
 * - Claymorphic soft cards with 16-24px rounded corners
 * - Complete RTL & Vazirmatn Persian typography
 * - Mobile-first Android native feel with >=48dp touch targets and safe area insets
 */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --color-primary: #0D9488;
  --color-primary-dark: #0F766E;
  --color-primary-light: #F0FDFA;
  --color-primary-surface: #CCFBF1;
  --color-accent: #EA580C;
  --color-accent-light: #FFEDD5;
  --color-secondary: #14B8A6;
  --color-bg: #F8FAFC;
  --color-card: #FFFFFF;
  --color-text-main: #0F172A;
  --color-text-muted: #64748B;
  --color-text-light: #94A3B8;
  --color-border: #E2E8F0;
  --color-danger: #EF4444;
  --color-danger-light: #FEE2E2;
  --color-success: #10B981;
  --color-success-light: #D1FAE5;
  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-card: 0 4px 18px -2px rgba(13, 148, 136, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 12px 30px -4px rgba(13, 148, 136, 0.2), 0 4px 10px -2px rgba(0, 0, 0, 0.06);
  --shadow-inset: inset 0 2px 4px rgba(0,0,0,0.03);

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --nav-height: 68px;
  --header-height: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, textarea, select {
  user-select: text;
}

body {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  direction: rtl;
  background-color: #042F2E;
  color: var(--color-text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
}

/* Mobile Container Frame for Desktop Simulation */
.app-viewport {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--color-bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  padding: calc(var(--safe-top) + 10px) 16px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(13, 148, 136, 0.3);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

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

.btn-sos-header {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);
  animation: pulse-sos 2.5s infinite;
  min-height: 36px;
}

@keyframes pulse-sos {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5); }
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: white;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Pet Switcher Strip */
.pet-strip-container {
  padding: 12px 16px 4px 16px;
  background: white;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.pet-strip-container::-webkit-scrollbar {
  display: none;
}

.pet-chips-row {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.pet-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  border-radius: 24px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.pet-chip.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15);
}

.pet-chip-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 1px solid rgba(13, 148, 136, 0.2);
  overflow: hidden;
}

.btn-add-pet-chip {
  padding: 6px 12px;
  border-radius: 24px;
  border: 1.5px dashed var(--color-primary);
  color: var(--color-primary);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-height: 44px;
}

/* Main Content Area */
.app-content {
  flex: 1;
  padding: 16px 16px calc(var(--nav-height) + var(--safe-bottom) + 24px) 16px;
  overflow-y: auto;
}

/* Tab Screens */
.tab-screen {
  display: none;
  animation: fadeIn 0.25s ease-out;
}
.tab-screen.active {
  display: block;
}

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

/* Hero & Summary Cards */
.hero-card {
  background: linear-gradient(135deg, #0D9488, #0F766E);
  color: white;
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-float);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
}

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

.hero-greeting {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.85);
}

.hero-name {
  font-size: 1.25rem;
  font-weight: 800;
}

.hero-pet-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 0.76rem;
  backdrop-filter: blur(4px);
}

.hero-pet-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.12);
  padding: 12px 14px;
  border-radius: var(--radius-lg);
}

.hero-pet-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: white;
  border: 3px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.hero-pet-details {
  flex: 1;
}

.hero-pet-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.hero-pet-meta {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Quick Actions Grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.quick-action-btn {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  text-align: right;
  min-height: 84px;
}

.quick-action-btn:active {
  transform: scale(0.97);
  background: var(--color-primary-light);
}

.quick-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.quick-icon-teal { background: #CCFBF1; color: #0D9488; }
.quick-icon-amber { background: #FFEDD5; color: #EA580C; }
.quick-icon-blue { background: #DBEAFE; color: #2563EB; }
.quick-icon-emerald { background: #D1FAE5; color: #059669; }

.quick-action-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.quick-action-desc {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* Alert Banner */
.alert-card {
  background: var(--color-accent-light);
  border: 1px solid rgba(234, 88, 12, 0.3);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-card.danger {
  background: var(--color-danger-light);
  border-color: rgba(239, 68, 68, 0.3);
}

.alert-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.alert-text-group {
  flex: 1;
}

.alert-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #9A3412;
  margin-bottom: 2px;
}

.alert-card.danger .alert-title {
  color: #991B1B;
}

.alert-desc {
  font-size: 0.75rem;
  color: #C2410C;
}

.alert-card.danger .alert-desc {
  color: #B91C1C;
}

/* Sections */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-link {
  font-size: 0.78rem;
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

/* Standard Soft Card */
.card-soft {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

/* Digital Passport / Health Card Layout */
.health-pass-card {
  background: linear-gradient(145deg, #FFFFFF 0%, #F0FDFA 100%);
  border: 2px solid #99F6E4;
  border-radius: var(--radius-xl);
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.pass-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #99F6E4;
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.pass-badge {
  background: #0D9488;
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pass-clinic-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.pass-pet-body {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
}

.pass-avatar-box {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-lg);
  background: white;
  border: 2px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
  flex-shrink: 0;
}

.pass-info-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
}

.pass-data-item {
  display: flex;
  flex-direction: column;
}

.pass-label {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.pass-value {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.pass-qr-row {
  background: white;
  border: 1px solid #CCFBF1;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.pass-qr-visual {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-sm);
  background: #042F2E;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-family: monospace;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.pass-security-info {
  flex: 1;
}

.pass-sec-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 2px;
}

.pass-sec-hash {
  font-size: 0.7rem;
  font-family: monospace;
  color: var(--color-text-muted);
  word-break: break-all;
}

/* Vaccine Stamp Records */
.stamp-item {
  background: white;
  border: 1px solid var(--color-border);
  border-right: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stamp-item.overdue {
  border-right-color: var(--color-danger);
}
.stamp-item.due_soon {
  border-right-color: var(--color-warning);
}

.stamp-main {
  flex: 1;
}

.stamp-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 3px;
}

.stamp-meta {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  display: flex;
  gap: 10px;
}

.stamp-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
}

.status-done { background: var(--color-success-light); color: #065F46; }
.status-due_soon { background: var(--color-warning-light); color: #92400E; }
.status-overdue { background: var(--color-danger-light); color: #991B1B; }

/* Timeline Visits */
.timeline-list {
  position: relative;
  padding-right: 18px;
}

.timeline-list::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  right: 6px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 18px;
}

.timeline-dot {
  position: absolute;
  top: 14px;
  right: -18px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--color-primary);
}

.visit-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.visit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.visit-date {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.visit-vet {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.visit-complaint {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin-bottom: 8px;
}

.visit-vitals-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.vital-chip {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.prescription-box {
  background: #F0FDFA;
  border: 1px solid #99F6E4;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-top: 10px;
}

.prescription-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prescription-content {
  font-size: 0.78rem;
  color: var(--color-text-main);
  line-height: 1.5;
  white-space: pre-line;
}

/* Mobile Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 60;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  padding: 4px 0;
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

.nav-label {
  font-size: 0.68rem;
  font-weight: 700;
}

/* Buttons */
.btn-primary {
  width: 100%;
  min-height: 48px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  min-height: 48px;
  background: white;
  color: var(--color-primary-dark);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

/* Modal Bottom Sheets */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 16px 20px calc(var(--safe-bottom) + 24px) 20px;
  overflow-y: auto;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-handle {
  width: 40px;
  height: 4px;
  background: #CBD5E1;
  border-radius: 2px;
  margin: 0 auto 16px auto;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  min-height: 48px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text-main);
  background: white;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: #0F172A;
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.toast.success { background: #065F46; }
.toast.danger { background: #991B1B; }

/* Segmented Control */
.segmented-control {
  display: flex;
  background: #E2E8F0;
  border-radius: var(--radius-lg);
  padding: 3px;
  margin-bottom: 16px;
}

.segment-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.segment-btn.active {
  background: white;
  color: var(--color-primary-dark);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
