/**
 * MyMed Web App - Custom Medical Design System Stylesheet
 */

:root {
  --primary-teal: #0d9488;
  --primary-teal-dark: #0f766e;
  --primary-teal-light: #14b8a6;
  --primary-teal-subtle: #f0fdfa;
  --primary-teal-border: #99f6e4;
  
  --brand-navy: #0f172a;
  --brand-slate: #334155;
  --brand-muted: #64748b;
  --brand-light: #f8fafc;
  --brand-border: #e2e8f0;
  
  --rx-red: #dc2626;
  --rx-red-bg: #fef2f2;
  --rx-red-border: #fecaca;

  --otc-blue: #0284c7;
  --otc-blue-bg: #f0f9ff;
  --otc-blue-border: #bae6fd;

  --best-price-green: #16a34a;
  --best-price-green-bg: #f0fdf4;
  --best-price-green-border: #bbf7d0;

  --pharmacy-indigo: #4f46e5;
  --pharmacy-indigo-bg: #eef2ff;

  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-card: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-card-hover: 0 12px 24px -4px rgba(13, 148, 136, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
  --shadow-modal: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #f8fafc;
  color: var(--brand-navy);
  min-height: 100vh;
  padding-bottom: 80px; /* Space for mobile bottom bar */
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Header & Navigation */
.navbar-custom {
  background: #ffffff;
  border-bottom: 1px solid var(--brand-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1020;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--brand-navy);
  letter-spacing: -0.03em;
}

.brand-icon-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary-teal), var(--primary-teal-dark));
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
}

.location-badge {
  background-color: var(--primary-teal-subtle);
  border: 1px solid var(--primary-teal-border);
  color: var(--primary-teal-dark);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid var(--brand-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  z-index: 1030;
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--brand-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
  min-width: 64px;
}

.mobile-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.mobile-nav-item.active {
  color: var(--primary-teal);
  background-color: var(--primary-teal-subtle);
}

@media (min-width: 992px) {
  .mobile-bottom-nav {
    display: none !important;
  }
  body {
    padding-bottom: 30px;
  }
}

/* Hero & Search Header */
.hero-search-section {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--brand-border);
  padding: 24px 0 20px;
}

.search-container {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
}

.search-input-group {
  background: #ffffff;
  border: 2px solid var(--brand-border);
  border-radius: 14px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.search-input-group:focus-within {
  border-color: var(--primary-teal);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.15);
}

.search-input {
  border: none;
  outline: none;
  font-size: 1rem;
  width: 100%;
  padding: 8px 10px;
  color: var(--brand-navy);
}

.search-input::placeholder {
  color: #94a3b8;
}

.search-icon {
  color: var(--primary-teal);
  font-size: 1.25rem;
  padding-left: 6px;
}

.search-clear-btn {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 4px 8px;
  cursor: pointer;
  display: none;
}

.search-clear-btn:hover {
  color: var(--brand-navy);
}

/* Quick Pills & Filters */
.quick-pills-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 2px 4px;
  scrollbar-width: none;
}
.quick-pills-scroll::-webkit-scrollbar {
  display: none;
}

.quick-pill {
  white-space: nowrap;
  background: #ffffff;
  border: 1px solid var(--brand-border);
  color: var(--brand-slate);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.quick-pill:hover {
  border-color: var(--primary-teal);
  color: var(--primary-teal-dark);
}

.quick-pill.active {
  background: var(--primary-teal);
  border-color: var(--primary-teal);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.3);
}

/* Main Cards Grid & Styling */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

@media (max-width: 576px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.med-card {
  background: #ffffff;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.med-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary-teal-border);
}

.med-img-wrapper {
  position: relative;
  width: 100%;
  height: 170px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid #f1f5f9;
}

.med-img {
  max-width: 90%;
  max-height: 85%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.med-card:hover .med-img {
  transform: scale(1.05);
}

.med-img-placeholder {
  color: #94a3b8;
  font-size: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.med-img-placeholder span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Prescription & OTC Badges */
.badge-rx {
  background: var(--rx-red-bg);
  color: var(--rx-red);
  border: 1px solid var(--rx-red-border);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.02em;
}

.badge-otc {
  background: var(--otc-blue-bg);
  color: var(--otc-blue);
  border: 1px solid var(--otc-blue-border);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-top-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 2;
}

.med-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.med-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-navy);
  margin-bottom: 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.med-generic {
  font-size: 0.82rem;
  color: var(--brand-muted);
  font-weight: 500;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pharmacy-badge-link {
  background: #f8fafc;
  border: 1px solid var(--brand-border);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  text-decoration: none;
  color: var(--brand-slate);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.pharmacy-badge-link:hover {
  background: var(--primary-teal-subtle);
  border-color: var(--primary-teal-border);
  color: var(--primary-teal-dark);
}

.pharmacy-badge-link .pharm-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-call-inline {
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  flex-shrink: 0;
}
.btn-call-inline:hover {
  background: #16a34a;
  color: #ffffff;
}

.med-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.med-price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary-teal-dark);
}

.med-unit {
  font-size: 0.75rem;
  color: var(--brand-muted);
  font-weight: 500;
}

.med-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

/* Buttons */
.btn-primary-teal {
  background: var(--primary-teal);
  border: 1px solid var(--primary-teal);
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--radius-btn);
  padding: 8px 14px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary-teal:hover, .btn-primary-teal:focus {
  background: var(--primary-teal-dark);
  border-color: var(--primary-teal-dark);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25);
}

.btn-compare-outline {
  background: #ffffff;
  border: 1px solid var(--primary-teal-border);
  color: var(--primary-teal-dark);
  font-weight: 600;
  border-radius: var(--radius-btn);
  padding: 7px 10px;
  font-size: 0.82rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
}
.btn-compare-outline:hover {
  background: var(--primary-teal-subtle);
  border-color: var(--primary-teal);
  color: var(--primary-teal-dark);
}

.btn-details-ghost {
  background: #f8fafc;
  border: 1px solid var(--brand-border);
  color: var(--brand-slate);
  font-weight: 600;
  border-radius: var(--radius-btn);
  padding: 7px 10px;
  font-size: 0.82rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
}
.btn-details-ghost:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--brand-navy);
}

/* Pharmacy Cards */
.pharmacy-card {
  background: #ffffff;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.pharmacy-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary-teal-border);
}

.pharmacy-header-banner {
  height: 100px;
  background: linear-gradient(135deg, #0d9488 0%, #1e293b 100%);
  position: relative;
  overflow: hidden;
}

.pharmacy-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
}

.pharmacy-logo-box {
  position: absolute;
  bottom: -24px;
  left: 16px;
  width: 58px;
  height: 58px;
  border-radius: 12px;
  background: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pharmacy-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pharmacy-card-body {
  padding: 34px 16px 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.pharmacy-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-navy);
  margin-bottom: 4px;
}

.pharmacy-address {
  font-size: 0.82rem;
  color: var(--brand-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.pharmacy-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.meta-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  color: var(--brand-slate);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-pill.open {
  background: #dcfce7;
  color: #15803d;
}

.meta-pill.items-count {
  background: var(--primary-teal-subtle);
  color: var(--primary-teal-dark);
}

/* Price Comparison Banner & Modal */
.best-price-hero-card {
  background: linear-gradient(135deg, #0f766e 0%, #064e3b 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.2);
}

.best-price-badge {
  background: #22c55e;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.compare-item-card {
  background: #ffffff;
  border: 1px solid var(--brand-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.compare-item-card.is-winner {
  border: 2px solid var(--best-price-green);
  background: var(--best-price-green-bg);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.15);
}

.compare-item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

/* Skeleton Loading Animation */
.skeleton-box {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Active Pharmacy Filter Banner */
.active-filter-alert {
  background: #ffffff;
  border: 1px solid var(--primary-teal-border);
  border-left: 4px solid var(--primary-teal);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

/* Section Header */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-navy);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  font-size: 0.85rem;
  color: var(--brand-muted);
  font-weight: 500;
}

/* View Tab Switcher on Desktop */
.nav-pills-custom {
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  display: inline-flex;
  gap: 4px;
}

.nav-pills-custom .nav-link {
  color: var(--brand-slate);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  transition: all 0.15s ease;
}

.nav-pills-custom .nav-link.active {
  background: #ffffff;
  color: var(--primary-teal);
  box-shadow: var(--shadow-sm);
}
