/* ==========================================================================
   Healthy Ways Enterprise - Design System CSS
   Commercial Fitness & Enterprise Styling (Pure CSS, No External CDN)
   ========================================================================== */

:root {
  --primary: #0f172a;          /* Deep Slate Navy */
  --primary-light: #1e293b;
  --accent: #0ea5e9;           /* Modern Cyan / Blue */
  --accent-hover: #0284c7;
  --success: #10b981;          /* Emerald Green */
  --warning: #f59e0b;          /* Amber */
  --danger: #ef4444;           /* Rose Red */
  --bg-main: #f8fafc;          /* Clean Light Canvas */
  --bg-surface: #ffffff;       /* Pure White Card */
  --text-main: #0f172a;        /* High Contrast Dark */
  --text-muted: #64748b;       /* Slate Subdued */
  --border-color: #e2e8f0;     /* Subtle Border */
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Top Tab Navigation Layout (My CMS Style) */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
}

.top-nav-header {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
}

.top-nav-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Brand Link */
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  flex-shrink: 0;
}
.brand-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-svg {
  width: 30px;
  height: 30px;
}
.brand-text {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}
.brand-text strong {
  color: var(--accent);
}

/* Nav Tabs Wrapper */
.nav-tabs-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  margin-left: 12px;
}

/* Tab Item Pill Style */
.tab-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
  white-space: nowrap;
}

.tab-item:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

.tab-item.active {
  background-color: #e0f2fe;
  color: #0284c7;
  border-color: #bae6fd;
}

.tab-icon {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex-shrink: 0;
}

.dropdown-chevron {
  width: 14px;
  height: 14px;
  fill: currentColor;
  margin-left: -2px;
  transition: transform 0.2s ease;
}

/* Dropdown Container */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown.active > .tab-item {
  background-color: #e0f2fe;
  color: #0284c7;
  border-color: #bae6fd;
}

.nav-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  padding: 6px;
  display: none;
  z-index: 1000;
  animation: dropdownFade 0.15s ease-out;
}

.nav-dropdown.open .dropdown-menu {
  display: block;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none !important;
  transition: all 0.12s ease;
}

.dropdown-item:hover {
  background-color: #f8fafc;
  color: #0284c7;
}

.dropdown-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #cbd5e1;
}
.dropdown-item:hover .dropdown-dot {
  background-color: #0ea5e9;
}

/* Right Side Controls */
.top-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.branch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.branch-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  border-radius: 9999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
}
.user-role {
  font-size: 10.5px;
  color: #64748b;
}

.logout-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
}
.logout-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}
.logout-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Page Container (Max-width centered canvas) */
.page-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px;
  flex: 1;
}


/* Typography & Titles */
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.card-body {
  padding: 20px;
}

/* Grid System */
.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

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

.stat-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  text-decoration: none;
}

.btn-secondary {
  background-color: #f1f5f9;
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #e2e8f0;
  text-decoration: none;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

/* Action Icons (Eye, Pencil, Trash, Shield) */
.btn-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: #ffffff;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.btn-icon:hover {
  background: #f1f5f9;
}
.btn-icon.view:hover { color: var(--accent); border-color: var(--accent); }
.btn-icon.edit:hover { color: var(--warning); border-color: var(--warning); }
.btn-icon.delete:hover { color: var(--danger); border-color: var(--danger); }
.btn-icon.shield:hover { color: #8b5cf6; border-color: #8b5cf6; }

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #e0f2fe; color: #0369a1; }

/* Form Controls */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 13px;
  outline: none;
  background-color: #ffffff;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

/* Search Box Container */
.search-wrapper {
  position: relative;
  display: inline-block;
}
.search-wrapper input {
  padding-left: 32px;
}
.search-icon-pos {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  fill: var(--text-muted);
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop.show {
  display: flex;
}
.modal-box {
  background: #ffffff;
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}
.modal-body {
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f8fafc;
}

/* ==========================================================================
   Responsive & Mobile Navigation Enhancements
   ========================================================================== */

@media (max-width: 992px) {
  .top-nav-container {
    padding: 0 16px;
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .nav-tabs-wrapper {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs-wrapper::-webkit-scrollbar {
    height: 4px;
  }
  .nav-tabs-wrapper::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
  }

  .page-container {
    padding: 16px;
  }

  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-cols-2 {
    grid-template-columns: 1fr;
  }

  .pos-container-split {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
}

@media (max-width: 640px) {
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .branch-pill {
    display: none;
  }

  .user-info {
    display: none;
  }

  .modal-box {
    width: 95%;
    margin: 10px;
  }
}

