/* ===================================
   SHERPA HEALTH - MULTI-TENANT STYLES
   Supports Multiple Client Branding
   =================================== */

/* Default Variables - Sherpa Health */
:root {
  /* Default to Sherpa colors */
  --primary: #1ba3da;
  --primary-dark: #0788b5;
  --primary-light: #e6f5fb;
  --primary-accent: #5cc5e8;

  /* Alert Colors */
  --success: #1ba3da;
  --error: #dc3545;
  --error-light: #ffebee;

  /* Neutral Colors (same for all themes) */
  --text-dark: #1c1c1e;
  --text-gray: #6c757d;
  --bg-light: #f8f9fa;
  --border: #e9ecef;
  --white: #ffffff;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sherpa Health Theme */
.theme-sherpa {
  --primary: #1ba3da;
  --primary-dark: #0788b5;
  --primary-light: #e6f5fb;
  --primary-accent: #5cc5e8;
  --secondary: #1ba3da; /* Same as primary for Sherpa */
  --success: #1ba3da;
}

/* Astera Cancer Care Theme */
.theme-astera {
  --primary: #fd4e1e; /* Orange rgb(253, 78, 30) */
  --primary-dark: #e54418; /* Darker orange */
  --primary-light: #fff0eb; /* Very light orange */
  --primary-accent: #ff7a52; /* Lighter orange */
  --secondary: #415bbc; /* Blue rgb(65, 91, 188) */
  --secondary-light: #e8ecfa; /* Light blue */
  --success: #fd4e1e;
}

/* FORCE Astera status bar to be solid orange */
.theme-astera .status-bar {
  background: #fd4e1e !important;
  background-image: none !important;
}

/* NYCBS Theme */
.theme-nycbs {
  --primary: #5f2e63; /* Purple */
  --primary-dark: #4a2450; /* Darker purple */
  --primary-light: #f4eff5; /* Very light purple */
  --primary-accent: #7b4b7f; /* Lighter purple */
  --secondary: #118bce; /* Blue */
  --secondary-light: #e6f3fa; /* Light blue */
  --success: #5f2e63;
}

/* Apply theme colors throughout */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-dark);
  background-color: var(--bg-light);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  opacity: 0;
  animation: fadeIn 0.3s ease-out forwards;
  transition: color 0.3s ease, background-color 0.3s ease;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5rem 0;
  color: var(--text-dark);
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
}
h2 {
  font-size: 1.25rem;
  font-weight: 600;
}
h3 {
  font-size: 1.125rem;
  font-weight: 500;
}
h4 {
  font-size: 1rem;
  font-weight: 500;
}
h5 {
  font-size: 0.875rem;
  font-weight: 500;
}

p {
  margin: 0 0 1rem 0;
  color: var(--text-gray);
}

/* App Container */
#page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-light);
}

.page-content {
  flex: 1;
  padding-bottom: 2rem;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* App Header */
.app-header {
  background: var(--primary);
  color: white;
  padding-top: env(safe-area-inset-top);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.logo-card {
  background: var(--primary);
  text-align: center;
  padding: 1rem;
  transition: var(--transition);
}

.logo-card img {
  max-height: 40px;
  width: auto;
  transition: var(--transition);
}

/* Care Guide Title */
.care-guide-header {
  background: white;
  text-align: center;
  padding: 1.25rem 1rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.care-guide-header h1 {
  color: var(--text-dark);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.5px;
}

/* Status Bar */
.status-bar {
  background: var(--primary);
  color: white;
  padding: 1rem;
  margin: 1rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

/* Astera-specific gradient */
.theme-astera .status-bar {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 50%,
    var(--secondary) 100%
  );
}

.status-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.status-bar h2 {
  color: white;
  font-size: 1.125rem;
  font-weight: 500;
  margin: 0;
  position: relative;
  z-index: 1;
}

.status-bar a {
  color: #ffe082;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid #ffe082;
}

/* Astera status bar link */
.theme-astera .status-bar a {
  color: #fff;
  border-bottom-color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* Cards */
.app-card {
  background: white;
  border-radius: var(--radius-xl);
  margin: 0 1rem 1rem 1rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}

.app-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-sm);
}

.card-content {
  padding: 1.25rem;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  position: relative;
}

.section-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  font-size: 1.125rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
  flex: 1;
}

/* Appointment Card */
.appointment-card {
  background: #fafbfc;
  border-left: 4px solid var(--primary-accent);
  transition: var(--transition);
}

.appointment-details {
  margin-top: 0.75rem;
}

.appointment-time {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.detail-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  color: var(--text-gray);
  font-size: 0.9375rem;
}

.detail-item i {
  width: 20px;
  margin-right: 0.75rem;
  color: var(--text-gray);
  font-size: 0.875rem;
}

/* Info Items */
.info-list {
  margin-top: 1rem;
}

.info-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.info-item:active {
  transform: scale(0.98);
  opacity: 0.8;
}

.info-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.info-icon i {
  color: white;
  font-size: 1.125rem;
}

.info-content {
  flex: 1;
}

.info-content p {
  margin: 0;
  color: var(--text-dark);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.info-badge {
  color: var(--error);
  font-weight: 600;
  font-size: 0.8125rem;
}

/* Action Buttons */
.action-section {
  padding: 0 0 0.5rem 0;
}

.action-count {
  color: var(--text-gray);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
  padding: 0 1.25rem;
}

/* Action Count - Use secondary color for each theme */
.action-count strong {
  color: var(--secondary, var(--error));
  font-size: 1.125rem;
}

.action-button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.action-button:hover {
  border-color: var(--primary);
  background: var(--bg-light);
}

.action-button:active {
  transform: scale(0.98);
  border-color: var(--primary);
  background: var(--primary-light);
}

.action-button i {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  color: var(--primary);
  font-size: 1rem;
  flex-shrink: 0;
  transition: var(--transition);
}

/* Items to Complete action buttons - use secondary colors */
#open-requests .action-button i {
  color: var(--secondary);
}

.action-button span {
  color: var(--text-dark);
  font-weight: 500;
  font-size: 1rem;
  flex: 1;
}

.action-button::after {
  content: "›";
  position: absolute;
  right: 1.25rem;
  font-size: 1.5rem;
  color: var(--text-gray);
  font-weight: 300;
}

/* Resource Cards */
.resource-card {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.resource-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.resource-image {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin-right: 1rem;
}

.resource-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.125rem 0.5rem;
  background: var(--primary);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 4px;
  transition: var(--transition);
}

.resource-content h5 {
  margin: 0 0 0.25rem 0;
  color: var(--text-dark);
  font-size: 1rem;
  font-weight: 600;
}

.resource-content p {
  margin: 0;
  color: var(--text-gray);
  font-size: 0.875rem;
}

/* Footer */
.app-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  text-align: center;
}

.footer-logo-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 1rem;
  padding: 1.25rem 2.5rem;
  background: var(--primary);
  border-radius: var(--radius-lg);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.footer-logo-wrapper img {
  max-width: 120px;
  display: block;
  position: relative;
  z-index: 1;
}

.footer-links {
  margin: 1rem 0;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
  margin: 0 0.75rem;
  transition: var(--transition);
}

.footer-copyright {
  color: var(--text-gray);
  font-size: 0.75rem;
  margin: 0;
}

/* Theme Switcher */
.theme-switcher {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.theme-switcher label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-gray);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-switcher select {
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: white;
  color: var(--text-dark);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236C757D' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  min-width: 200px;
}

.theme-switcher select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 163, 218, 0.1);
}

.theme-switcher select:hover {
  border-color: var(--primary);
}

/* Astera-specific colors for select */
.theme-astera .theme-switcher select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(253, 78, 30, 0.1);
}

/* Astera appointment card accent */
.theme-astera .appointment-card {
  border-left-color: var(--secondary);
  background: #fafbfc; /* Same as default - light gray */
}

/* Astera resource badges */
.theme-astera .resource-badge {
  background: var(--secondary);
}

/* Astera-specific footer links */
.theme-astera .footer-links a {
  color: var(--primary);
}

.theme-astera .footer-links a:hover {
  color: var(--primary-dark);
}

/* Astera appointment icon */
.theme-astera .appointment-icon {
  color: var(--secondary) !important;
}

/* Astera button icons */
.theme-astera .action-button i {
  background: var(--primary-light);
  color: var(--primary);
}

/* Astera Items to Complete buttons - use secondary color */
.theme-astera #open-requests .action-button i {
  background: var(--secondary-light, var(--primary-light));
  color: var(--secondary);
}

/* Astera specific status message colors */
.theme-astera .status-message.success {
  background: var(--primary-light);
  border-color: var(--primary-accent);
}

.theme-astera .status-message.success i {
  color: var(--primary);
}

/* Astera footer logo background */
.theme-astera .footer-logo-wrapper {
  background: var(--primary);
}

/* Optional: Add hover effect */
.footer-logo-wrapper:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Status Messages */
.status-message {
  display: flex;
  align-items: center;
  padding: 1rem;
  margin: 1rem;
  border-radius: var(--radius-md);
  animation: fadeIn 0.5s ease-out;
}

.status-message.success {
  background: var(--primary-light);
  border: 1px solid var(--primary-accent);
}

.status-message.error {
  background: var(--error-light);
  border: 1px solid #ffcdd2;
}

.status-message i {
  font-size: 1.5rem;
  margin-right: 1rem;
  flex-shrink: 0;
}

.status-message.success i {
  color: var(--success);
}
.status-message.error i {
  color: var(--error);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.app-header {
  animation: slideDown 0.5s ease-out;
}

.care-guide-header {
  animation: slideDown 0.5s ease-out 0.1s backwards;
}

.status-bar {
  animation: fadeIn 0.5s ease-out 0.2s backwards;
}

.app-card {
  animation: fadeIn 0.5s ease-out backwards;
}

.app-card:nth-child(3) {
  animation-delay: 0.3s;
}
.app-card:nth-child(4) {
  animation-delay: 0.4s;
}
.app-card:nth-child(5) {
  animation-delay: 0.5s;
}
.app-card:nth-child(6) {
  animation-delay: 0.6s;
}

/* Mobile Specific */
@media (max-width: 375px) {
  html {
    font-size: 15px;
  }
  .card-content {
    padding: 1rem;
  }
}

/* Tablet and larger */
@media (min-width: 768px) {
  .page-content {
    max-width: 600px;
    margin: 0 auto;
  }

  .app-card {
    margin: 0 auto 1rem;
    max-width: 568px;
  }

  .status-bar {
    max-width: 568px;
    margin: 1rem auto;
  }
}

/* Fix for icon display */
.fas,
.far,
.fab,
.fa {
  display: inline-block;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ensure Font Awesome loads */
.fas:before,
.far:before,
.fab:before {
  display: inline-block;
}

/* Astera-specific action button hover */
.theme-astera .action-button:hover {
  border-color: var(--secondary);
}

.theme-astera .action-button:hover i {
  background: rgba(255, 107, 53, 0.1);
  color: var(--secondary);
}

/* NYCBS Items to Complete buttons - use secondary color */
.theme-nycbs #open-requests .action-button i {
  background: var(--secondary-light);
  color: var(--secondary);
}
.section-icon[style*="--primary-accent"] {
  color: var(--primary-accent) !important;
}
.section-icon[style*="--primary"] {
  color: var(--primary) !important;
}
.section-icon[style*="--error"] {
  color: var(--error) !important;
}

/* Items to Complete section icon - use secondary color */
.items-to-complete-icon {
  color: var(--secondary) !important;
}
