:root {
  --primary: #1A5AD7;
  --primary-hover: #1346aa;
  --secondary: #00AEEF;
  --secondary-hover: #0098d4;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface: #f1f5f9;
  --bg-input: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.04), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --shadow-fab: 0 8px 20px -2px rgba(0, 174, 239, 0.5);
  --shadow-sheet: 0 -10px 30px rgba(0, 0, 0, 0.12);
  
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

[data-theme="dark"] {
  --bg-page: #0b0f19;
  --bg-card: #151c2c;
  --bg-surface: #1e293b;
  --bg-input: #0f172a;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  
  --border-color: #27354a;
  --border-light: #1e293b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* App Container */
.app-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

@media (min-width: 900px) {
  .app-wrapper {
    max-width: 1100px;
    margin: 1.5rem auto;
    min-height: calc(100vh - 3rem);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border-color);
  }
}

/* Header (Matching 1.png) */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 30;
}

.pet-selector-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 0;
}

.header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.header-pet-info {
  display: flex;
  flex-direction: column;
}

.header-pet-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-light);
  letter-spacing: 0.06em;
}

.header-pet-name {
  font-size: 16.5px;
  font-weight: 900;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.dropdown-arrow {
  color: var(--text-muted);
  font-size: 13px;
  transition: transform 0.2s ease;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-new-pet {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #e0f7fe;
  color: var(--secondary);
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-new-pet:hover {
  background: #bae6fd;
}

.btn-icon-round {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

.btn-icon-round:hover {
  color: var(--text-main);
  background: var(--border-color);
}

/* App Main Body Layout */
.app-content-body {
  display: flex;
  flex: 1;
}

/* Sidebar for Desktop Widescreen */
.desktop-sidebar {
  display: none;
  width: 240px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem 1rem;
  flex-direction: column;
  gap: 0.35rem;
}

@media (min-width: 900px) {
  .desktop-sidebar {
    display: flex;
  }
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 800;
  color: var(--text-muted);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-link:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.sidebar-link.active {
  background: #e0f7fe;
  color: var(--secondary);
}

/* Main Scrollable View */
.main-view-container {
  flex: 1;
  padding: 1.1rem;
  padding-bottom: 6.5rem;
  overflow-y: auto;
}

@media (min-width: 900px) {
  .main-view-container {
    padding: 2rem;
    padding-bottom: 2rem;
  }
}

/* Ultra-Compact Alerts Container (Minimum Vertical Space) */
.alerts-compact-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.alert-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.alert-compact-row:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.alert-compact-row.critica {
  background: #fef2f2;
  border: 1.2px solid #fecaca;
}

.alert-compact-row.preventiva {
  background: #fffbeb;
  border: 1.2px solid #fef3c7;
}

.alert-compact-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.alert-compact-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.alert-compact-row.critica .alert-compact-icon {
  background: #ef4444;
}

.alert-compact-row.preventiva .alert-compact-icon {
  background: #f59e0b;
}

.alert-compact-title {
  font-size: 12.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-compact-row.critica .alert-compact-title {
  color: #991b1b;
}

.alert-compact-row.preventiva .alert-compact-title {
  color: #92400e;
}

.alert-compact-tag {
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.alert-compact-row.critica .alert-compact-tag {
  background: #fee2e2;
  color: #b91c1c;
}

.alert-compact-row.preventiva .alert-compact-tag {
  background: #fef3c7;
  color: #92400e;
}

/* Blue Ficha Médica Card (Exact 1.png Styling) */
.ficha-medica-card {
  background: linear-gradient(135deg, #00AEEF 0%, #1A5AD7 100%);
  border-radius: var(--radius-xl);
  padding: 1.35rem 1.4rem;
  color: #ffffff;
  box-shadow: 0 10px 24px -4px rgba(26, 90, 215, 0.35);
  margin-bottom: 1.4rem;
  position: relative;
}

.ficha-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.ficha-badge {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
}

.ficha-arrow-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.ficha-arrow-btn:hover {
  transform: scale(1.08);
}

.ficha-pet-name {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
}

.ficha-pet-breed {
  font-size: 13.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  margin-top: 0.15rem;
  margin-bottom: 1.1rem;
}

.ficha-grid-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 0.75rem;
}

.ficha-field-label {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.05em;
  margin-bottom: 0.1rem;
}

.ficha-field-val {
  font-size: 12.5px;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Historial Médico Section Header (Matching 1.png) */
.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.section-pulse-icon {
  color: var(--secondary);
  font-size: 20px;
}

.section-title {
  font-size: 17.5px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* 2x2 Feature Grid (Matching 1.png) */
.features-grid-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 900px) {
  .features-grid-2x2 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.feature-menu-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-card);
}

.feature-menu-card:hover {
  transform: translateY(-3px);
  border-color: var(--secondary);
  box-shadow: 0 8px 20px rgba(0, 174, 239, 0.12);
}

.feature-icon-squircle {
  width: 50px;
  height: 50px;
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  margin-bottom: 0.55rem;
}

.feature-icon-blue { background: #eff6ff; color: #2563eb; }
.feature-icon-green { background: #ecfdf5; color: #10b981; }
.feature-icon-orange { background: #fffbeb; color: #f59e0b; }
.feature-icon-purple { background: #eef2ff; color: #6366f1; }
.feature-icon-pink { background: #fdf2f8; color: #ec4899; }
.feature-icon-teal { background: #f0fdfa; color: #14b8a6; }

.feature-card-name {
  font-size: 14.5px;
  font-weight: 900;
  color: var(--text-main);
}

.feature-card-desc {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 0.15rem;
}

/* Mobile Bottom Navigation Bar (Centered Blue + Button) */
.mobile-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 66px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 40;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

@media (min-width: 900px) {
  .mobile-bottom-bar {
    display: none;
  }
}

.bar-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  flex: 1;
  height: 100%;
}

.bar-tab-btn.active {
  color: var(--secondary);
}

.bar-tab-btn span.tab-icon {
  font-size: 20px;
}

.bar-alert-counter {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Protruding Center Blue FAB Button (+ from 1.png / 2.png) */
.center-fab-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  position: relative;
}

.center-fab-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00AEEF 0%, #0098d4 100%);
  color: #ffffff;
  border: 4px solid var(--bg-card);
  font-size: 32px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  margin-top: -24px;
  transition: transform 0.15s ease;
}

.center-fab-btn:active {
  transform: scale(0.94);
}

/* Bottom Sheet Modal (Exact 2.png Styling) */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease-out;
}

@media (min-width: 600px) {
  .bottom-sheet-backdrop {
    align-items: center;
    padding: 1.5rem;
  }
}

.bottom-sheet-card {
  background: var(--bg-card);
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1rem 1.25rem 2.5rem;
  position: relative;
  box-shadow: var(--shadow-sheet);
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 600px) {
  .bottom-sheet-card {
    border-radius: 28px;
    padding-bottom: 1.75rem;
    animation: scaleUp 0.15s ease-out;
  }
}

.sheet-drag-handle {
  width: 44px;
  height: 5px;
  background: var(--border-color);
  border-radius: 9999px;
  margin: 0 auto 1.15rem;
}

.sheet-close-btn {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: none;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

.sheet-title {
  font-size: 19px;
  font-weight: 900;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

/* 9 Option Rows in 2.png */
.sheet-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sheet-option-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sheet-option-row:hover,
.sheet-option-row:active {
  background: var(--bg-surface);
}

.sheet-option-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sheet-option-text {
  display: flex;
  flex-direction: column;
}

.sheet-option-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.sheet-option-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 0.15rem;
}

/* Subview Card Sections & Forms */
.card-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
}

.card-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-section-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-action-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.btn-action-primary:hover {
  background: var(--primary-hover);
}

/* Form Controls */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--secondary);
}

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

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Record cards */
.clinical-record-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.clinical-record-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.badge-green { background: #ecfdf5; color: #10b981; }
.badge-red { background: #fef2f2; color: #ef4444; }
.badge-amber { background: #fffbeb; color: #f59e0b; }
.badge-blue { background: #eff6ff; color: #3b82f6; }

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

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

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
