/* ============================================
   ADVITA'S HEALTH TRACKER - COMPLETE STYLES
   ============================================ */

/* Tailwind Custom Colors */
@layer base {
  :root {
    --color-bg-amoled: #000000;
    --color-surface-amoled: #121212;
    --color-surface2-amoled: #1E1E1E;
    --color-bg-dark: #1a1a2e;
    --color-surface-dark: #16213e;
    --color-surface2-dark: #0f3460;
    --color-bg-light: #F8F5FF;
    --color-surface-light: #FFFFFF;
    --color-surface2-light: #F0EBF5;
    --color-primary: #FFB3C6;
    --color-primary-light: #FF8FAB;
    --color-secondary: #E0BBE4;
    --color-accent-mint: #B7E4C7;
    --color-accent-sky: #BDE0FE;
    --color-text: #FFFFFF;
    --color-text2: #B3B3B3;
    --color-success: #74C69D;
    --color-warning: #F4A261;
    --color-danger: #FF6B6B;
  }
}

/* Base */
* {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

/* Screen transitions */
.screen {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  min-height: 100vh;
}

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

.screen.hidden {
  display: none;
}

/* AMOLED Theme (default) */
.bg-amoled { background-color: #000000; }
.bg-surface-amoled { background-color: #121212; }
.bg-surface2-amoled { background-color: #1E1E1E; }
.text-pink-400 { color: #FFB3C6; }
.text-pink-500 { color: #FF8FAB; }
.bg-pink-500 { background-color: #FF8FAB; }
.bg-pink-500\/10 { background-color: rgba(255, 143, 171, 0.1); }
.bg-pink-500\/20 { background-color: rgba(255, 143, 171, 0.2); }
.border-pink-500 { border-color: #FF8FAB; }
.border-pink-500\/20 { border-color: rgba(255, 143, 171, 0.2); }
.border-pink-500\/30 { border-color: rgba(255, 143, 171, 0.3); }
.text-mint-400 { color: #B7E4C7; }
.text-mint-500 { color: #74C69D; }
.bg-mint-500 { background-color: #74C69D; }
.bg-mint-500\/10 { background-color: rgba(116, 198, 157, 0.1); }
.bg-mint-500\/20 { background-color: rgba(116, 198, 157, 0.2); }
.border-mint-500 { border-color: #74C69D; }
.text-sky-400 { color: #BDE0FE; }
.text-sky-500 { color: #74B9FF; }
.bg-sky-500 { background-color: #74B9FF; }
.bg-sky-500\/10 { background-color: rgba(116, 185, 255, 0.1); }
.bg-sky-500\/20 { background-color: rgba(116, 185, 255, 0.2); }
.border-sky-500 { border-color: #74B9FF; }
.text-lavender-400 { color: #DDA0DD; }
.text-lavender-500 { color: #E0BBE4; }
.bg-lavender-500 { background-color: #E0BBE4; }
.bg-lavender-500\/10 { background-color: rgba(224, 187, 228, 0.1); }
.bg-lavender-500\/20 { background-color: rgba(224, 187, 228, 0.2); }
.border-lavender-500 { border-color: #E0BBE4; }
.text-orange-400 { color: #F4A261; }
.text-orange-500 { color: #E76F51; }
.bg-orange-500 { background-color: #E76F51; }
.bg-orange-500\/10 { background-color: rgba(231, 111, 81, 0.1); }
.bg-orange-500\/20 { background-color: rgba(231, 111, 81, 0.2); }
.border-orange-500 { border-color: #E76F51; }

/* Dark Theme overrides */
body.theme-dark .bg-amoled { background-color: #1a1a2e; }
body.theme-dark .bg-surface-amoled { background-color: #16213e; }
body.theme-dark .bg-surface2-amoled { background-color: #0f3460; }

/* Light Theme overrides */
body.theme-light {
  background-color: #F8F5FF;
  color: #2D3436;
}
body.theme-light .bg-amoled { background-color: #F8F5FF; }
body.theme-light .bg-surface-amoled { background-color: #FFFFFF; }
body.theme-light .bg-surface2-amoled { background-color: #F0EBF5; }
body.theme-light .text-gray-400 { color: #636E72; }
body.theme-light .text-gray-500 { color: #B2BEC3; }
body.theme-light .border-gray-700 { border-color: #E0E0E0; }
body.theme-light .border-gray-800 { border-color: #E8E8E8; }
body.theme-light #bottom-nav {
  background-color: rgba(255, 255, 255, 0.95);
  border-color: #E0E0E0;
}
body.theme-light .sticky {
  background-color: rgba(248, 245, 255, 0.95);
  border-color: #E0E0E0;
}

/* PIN Screen */
.pin-dot.filled {
  background-color: #FF8FAB;
  border-color: #FF8FAB;
}

.pin-dot.error {
  background-color: #FF6B6B;
  border-color: #FF6B6B;
  animation: shake 400ms ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Animations */
@keyframes pulse-slow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.animate-pulse-slow {
  animation: pulse-slow 4s ease-in-out infinite;
}

@keyframes slide-down {
  from { transform: translate(-50%, -100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

#toast.show {
  display: block;
  animation: slide-down 300ms ease-out;
}

/* Button interactions */
button, .quick-add-btn, .meal-slot {
  cursor: pointer;
  user-select: none;
}

button:active, .quick-add-btn:active, .meal-slot:active {
  transform: scale(0.96);
}

/* Segmented button selected states */
.portion-btn.selected, .finished-btn.selected, .appetite-btn.selected,
.potty-type-btn.selected, .consistency-btn.selected, .colour-btn.selected,
.discomfort-btn.selected, .sleep-type-btn.selected, .sleep-quality-btn.selected,
.med-cat-btn.selected, .theme-setting-btn.selected, .theme-btn.selected {
  border-color: #FF8FAB;
  background-color: rgba(255, 143, 171, 0.15);
}

body.theme-light .portion-btn.selected,
body.theme-light .finished-btn.selected,
body.theme-light .appetite-btn.selected {
  border-color: #FF8FAB;
  background-color: rgba(255, 143, 171, 0.1);
}

/* Medicine category selected */
.med-cat-btn.selected {
  border-color: #74B9FF;
  background-color: rgba(116, 185, 255, 0.15);
}

/* Potty type selected */
.potty-type-btn.selected[data-value="Dirty"] {
  border-color: #F4A261;
  background-color: rgba(244, 162, 97, 0.15);
}
.potty-type-btn.selected[data-value="Both"] {
  border-color: #74B9FF;
  background-color: rgba(116, 185, 255, 0.15);
}

/* Sleep type selected */
.sleep-type-btn.selected[data-value="Nap"] {
  border-color: #F4A261;
  background-color: rgba(244, 162, 97, 0.15);
}
.sleep-type-btn.selected[data-value="Night Sleep"] {
  border-color: #DDA0DD;
  background-color: rgba(221, 160, 221, 0.15);
}

/* Supplement cards */
.supp-card {
  min-width: 240px;
  flex-shrink: 0;
}

.supp-card.missed {
  border-color: #FF6B6B;
  background-color: rgba(255, 107, 107, 0.05);
}

/* Meal slots filled */
.meal-slot.filled {
  border-style: solid;
  border-color: rgba(255, 143, 171, 0.3);
}

/* Scrollbar hiding */
#supplement-scroll::-webkit-scrollbar,
#med-category-scroll::-webkit-scrollbar {
  display: none;
}

#supplement-scroll,
#med-category-scroll {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Chart containers */
canvas {
  max-width: 100%;
}

/* Input styling */
input, select, textarea {
  color: inherit;
}

input::placeholder, textarea::placeholder {
  color: #636E72;
}

body.theme-light input::placeholder,
body.theme-light textarea::placeholder {
  color: #B2BEC3;
}

/* Select arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23B3B3B3' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Doctor Mode */
#doctor-screen {
  background-color: #000000;
}

/* Nav active state */
.nav-btn.active {
  color: #FF8FAB;
}

body.theme-light .nav-btn.active {
  color: #FF8FAB;
}

/* Fever card pulse for high fever */
#fever-card.high-fever {
  animation: fever-pulse 2s ease-in-out infinite;
}

@keyframes fever-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.3); }
  50% { box-shadow: 0 0 20px 4px rgba(255, 107, 107, 0.2); }
}

/* History cards */
.history-card {
  transition: all 200ms ease-out;
}

.history-card:active {
  transform: scale(0.98);
}

/* Responsive */
@media (max-width: 380px) {
  .pin-key {
    width: 56px;
    height: 56px;
    font-size: 18px;
  }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .pb-24 {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }
}

/* Focus visible for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #FF8FAB;
  outline-offset: 2px;
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 143, 171, 0.3);
  border-top-color: #FF8FAB;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Offline indicator */
.offline-badge {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #F4A261;
  color: #000;
  text-align: center;
  padding: 4px;
  font-size: 11px;
  font-weight: 600;
  z-index: 100;
  transform: translateY(-100%);
  transition: transform 300ms ease-out;
}

.offline-badge.show {
  transform: translateY(0);
}
