/* ==========================================================================
   DIET & WELLNESS PRACTICE MANAGEMENT APP - MODERN STYLESHEET
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #ccfbf1;
  --primary-gradient: linear-gradient(135deg, #0d9488 0%, #059669 100%);
  --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --sidebar-width: 260px;
  --header-height: 70px;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --border-radius-sm: 8px;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   LAYOUT STRUCTURE (SIDEBAR, HEADER, MAIN CONTAINER)
   ========================================================================== */

#app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
#app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  transition: var(--transition);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

#app-sidebar .sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.6);
}

#app-sidebar .sidebar-brand .brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

#app-sidebar .sidebar-brand .brand-text h5 {
  color: #fff;
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.2px;
}

#app-sidebar .sidebar-brand .brand-text small {
  color: #14b8a6;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  padding: 1rem 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-heading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: #475569;
  padding: 0.75rem 0.75rem 0.35rem;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: #94a3b8;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none;
  transition: var(--transition);
  margin-bottom: 0.25rem;
}

.nav-link-custom:hover {
  background-color: var(--bg-sidebar-hover);
  color: #f8fafc;
}

.nav-link-custom.active {
  background: var(--primary-gradient);
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.nav-link-custom i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
}

/* Header & Content Area */
#app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

#app-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

#main-content {
  padding: 1.75rem;
  flex: 1;
  position: relative;
}

/* SPA Loading Indicator Bar */
#spa-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  z-index: 9999;
  display: none;
  animation: pulse-bar 1.5s infinite linear;
}

@keyframes pulse-bar {
  0% { transform: scaleX(0); transform-origin: left; }
  50% { transform: scaleX(0.7); transform-origin: left; }
  100% { transform: scaleX(1); transform-origin: left; }
}

/* ==========================================================================
   CARDS, WIDGETS & UI COMPONENTS
   ========================================================================== */

.card-custom {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

.card-custom:hover {
  box-shadow: var(--card-shadow-hover);
}

.card-header-custom {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body-custom {
  padding: 1.5rem;
}

/* Metric / Stat Cards */
.stat-card {
  padding: 1.35rem;
  border-radius: var(--border-radius);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-icon-primary { background: #ccfbf1; color: #0f766e; }
.stat-icon-warning { background: #fef3c7; color: #d97706; }
.stat-icon-danger  { background: #ffe4e6; color: #e11d48; }
.stat-icon-success { background: #dcfce7; color: #15803d; }
.stat-icon-info    { background: #e0e7ff; color: #4338ca; }
.stat-icon-purple  { background: #f3e8ff; color: #7e22ce; }

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Macro badges */
.macro-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.macro-cal { background-color: #fff1f2; color: #e11d48; }
.macro-pro { background-color: #f0fdf4; color: #16a34a; }
.macro-carb { background-color: #fefce8; color: #ca8a04; }
.macro-fat { background-color: #faf5ff; color: #9333ea; }
.macro-water { background-color: #eff6ff; color: #2563eb; }

/* Custom Buttons */
.btn-primary-custom {
  background: var(--primary-gradient);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  padding: 0.55rem 1.25rem;
  transition: var(--transition);
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
}

.btn-primary-custom:hover {
  background: linear-gradient(135deg, #0f766e 0%, #047857 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.btn-whatsapp {
  background-color: #25D366;
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

.btn-whatsapp:hover {
  background-color: #1ebc59;
  color: #fff;
}

/* Client Profile Header Banner */
.profile-hero {
  background: linear-gradient(135deg, #0f766e 0%, #0f172a 100%);
  color: #fff;
  border-radius: var(--border-radius);
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.profile-avatar-lg {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.3);
  object-fit: cover;
  background: #fff;
}

/* Diet Meal Slot Matrix */
.meal-slot-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: #fafafa;
  margin-bottom: 1rem;
  overflow: hidden;
}

.meal-slot-header {
  padding: 0.75rem 1rem;
  background: #f1f5f9;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.meal-slot-body {
  padding: 0.75rem 1rem;
}

.meal-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-color);
}

.meal-item-row:last-child {
  border-bottom: none;
}

/* Responsive Table */
.table-custom {
  margin-bottom: 0;
}

.table-custom th {
  background-color: #f8fafc;
  color: #64748b;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1rem;
}

.table-custom td {
  padding: 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.table-custom tr:hover td {
  background-color: #f8fafc;
}

/* ==========================================================================
   PRINT STYLES FOR DIET PLANS & INVOICES
   ========================================================================== */

@media print {
  body {
    background-color: #fff !important;
    color: #000 !important;
  }

  #app-sidebar, #app-header, .no-print, .btn, .modal {
    display: none !important;
  }

  #app-main {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  #main-content {
    padding: 0 !important;
  }

  .print-page {
    width: 100% !important;
    margin: 0 !important;
    padding: 15mm !important;
    box-shadow: none !important;
    border: none !important;
  }

  .card-custom {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

/* Mobile Sidebar Toggle */
@media (max-width: 991.98px) {
  #app-sidebar {
    transform: translateX(-100%);
  }

  #app-sidebar.show {
    transform: translateX(0);
  }

  #app-main {
    margin-left: 0;
  }
}
