/* ========================================
   GLOBAL DESIGN SYSTEM (Refined - BD Style)
   ======================================== */

:root {
  /* --- PALETTE --- */
  --primary: #0077b6;
  --primary-light: #0096c7;
  --primary-dark: #023e8a;
  --primary-bg: #f0f9ff;

  --secondary: #0f172a;
  /* Navy (Keep for text/contrast) */
  --secondary-light: #334155;

  --accent: #f59e0b;
  /* Amber (Keep for warm highights) */

  /* Neutrals */
  --background: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;

  /* --- TYPOGRAPHY --- */
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  /* --- SPACING & SIZING --- */
  --container-width: 1440px;
  --header-height: 80px;
  --radius-sm: 4px;
  /* Sharper corners for corporate feel */
  --radius-md: 8px;
  --radius-lg: 12px;

  /* --- EFFECTS --- */
  /* Cleaner, more subtle shadows (BD Style) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  /* Adjusted for Blue theme */
  --shadow-primary: 0 10px 15px -3px rgba(0, 119, 182, 0.25);

  --danger: #ef4444;
  --success: #10b981;
  --accent-hover: #d97706;

  --transition: all 0.2s ease-out;
  /* Snappier */
}

/* Base Reset */
body {
  font-family: var(--font-main);
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.6;
}

/* ========================================
   HEADER (Clean White, No Glassmorphism)
   ======================================== */
.public-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 3px solid var(--primary);
  /* Brand accent line */
  box-shadow: var(--shadow-sm);
  /* Subtle depth */
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
}

/* Navigation Links - Clear & bold */
.public-header nav a {
  color: var(--secondary);
  font-weight: 600;
  padding: 0.5rem 0;
  margin: 0 0.5rem;
}

.public-header nav a:hover {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  /* Underline interaction */
}

/* ========================================
   HERO SECTIONS
   ======================================== */
/* Main Hero */
.hero {
  background: linear-gradient(to right, var(--secondary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 5rem 1rem;
  clip-path: polygon(0 0, 100% 0, 100% 95%, 0 100%);
  /* Dynamic angle */
}

/* Inner Hero - Compact corporate banner */
.hero-inner {
  background: var(--secondary);
  /* Solid corporate color or subtle gradient */
  background: linear-gradient(to right, var(--secondary), #1e293b);
  padding: 3rem 0 4rem;
  text-align: center;
  position: relative;
}

.hero-inner h1 {
  color: white;
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.hero-inner p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
}

/* ========================================
   CARDS & CONTENT (Clean, Boxy)
   ======================================== */
.section-overlap {
  margin-top: -3rem;
  padding-bottom: 3rem;
  position: relative;
  z-index: 10;
}

.content-card,
.card,
.service-card {
  background: white;
  border: 1px solid var(--border);
  border-top: 4px solid transparent;
  /* Prepare for accent */
  border-radius: var(--radius-md);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.content-card {
  border-top: 4px solid var(--accent);
  /* Accent for main content */
  box-shadow: var(--shadow-md);
}

/* Hover effects */
.service-card:hover,
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-top-color: var(--primary);
  /* Pop of color on hover */
}

/* Buttons - Stronger shape */
.btn,
.cta-primary {
  border-radius: 4px;
  /* More corporate, less "app-like" */
  font-weight: 700;
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 0.5px;
}



/* Base Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-main);
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 16px;
  /* Optimized for mobile readability */
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--secondary);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Utilities */
.container {
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: var(--container-width);
  }
}

.text-center {
  text-align: center;
}

.text-primary {
  color: var(--primary);
}

.mt-2 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

/* ========================================
   COMPONENTS
   ======================================== */

/* Buttons */
.btn,
.cta-primary,
.cta-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 99px;
  /* Pill shape */
  transition: var(--transition);
  cursor: pointer;
  border: none;
  font-size: 1rem;
  text-decoration: none;
}

.btn,
.cta-primary {
  background: var(--primary);
  /* Gradient logic preferred but solid for robustness */
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn:hover,
.cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 20px -5px rgba(15, 118, 110, 0.3);
  color: white;
}

.btn-outline,
.cta-secondary {
  background: transparent;
  border: 2px solid white;
  /* Default to white for Hero context */
  color: white;
}

.cta-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* Contextual button fix for non-hero areas */
.btn-outline.dark {
  border-color: var(--border);
  color: var(--secondary);
}

/* Cards */
.card,
.service-card,
.package-card,
.trust-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.5);
  /* For glass feel */
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card:hover,
.service-card:hover,
.package-card:hover,
.trust-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-bg);
}

/* Add a subtle top border highlight on hover */
.service-card::after,
.trust-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
  transform-origin: left;
}

.service-card:hover::after,
.trust-item:hover::after {
  transform: scaleX(1);
}


/* ========================================
   HEADER & NAV
   ======================================== */
/* ========================================
   HEADER & NAV (Responsive)
   ======================================== */
.public-header {
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.public-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
  display: flex;
  /* Ensure inner content aligns */
  align-items: center;
}

.logo-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  /* Add spacing between logo and text */
}

.logo-img {
  height: 60px;
  width: auto;
  object-fit: contain;
}

/* Mobile Toggle */
.mobile-menu-toggle {
  display: block;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--secondary);
  cursor: pointer;
  padding: 0.5rem;
}

/* Navigation Links - Mobile First (Drawer) */
.public-header nav {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  padding: 1rem 0;
  flex-direction: column;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  display: none;
  /* Hidden by default via JS class toggle or pure CSS state */
  border-top: 1px solid var(--border);
}

.public-header nav.active {
  display: flex;
}

.public-header nav a {
  padding: 1rem 2rem;
  color: var(--secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--surface-alt);
  width: 100%;
  display: block;
}

.public-header nav a:hover {
  background: var(--primary-bg);
  color: var(--primary);
  padding-left: 2.5rem;
  /* Slide effect */
}

/* Login btn in mobile menu */
.login-dropdown {
  padding: 1rem 2rem;
  width: 100%;
}

.login-btn {
  display: inline-block;
  width: 100%;
  text-align: center;
  background: var(--primary);
  color: white !important;
  padding: 0.75rem !important;
  border-radius: var(--radius-sm);
}

/* Desktop Styles */
@media (min-width: 900px) {
  .mobile-menu-toggle {
    display: none;
  }

  .public-header nav {
    position: static;
    display: flex;
    flex-direction: row;
    width: auto;
    background: transparent;
    box-shadow: none;
    padding: 0;
    border: none;
    height: auto;
  }

  /* Reset active state issues if resizing window */
  .public-header nav.active {
    display: flex;
  }

  .public-header nav a {
    padding: 0.5rem 0;
    margin: 0 0.75rem;
    width: auto;
    border: none;
    color: var(--secondary-light);
    font-weight: 500;
  }

  .public-header nav a:hover {
    background: transparent;
    padding-left: 0;
    /* Reset slide */
    color: var(--primary);
  }

  .login-dropdown {
    padding: 0;
    width: auto;
    margin-left: 1rem;
  }

  .login-btn {
    width: auto;
    background: var(--surface);
    color: var(--primary) !important;
    border: 1px solid var(--border);
    padding: 0.5rem 1.25rem !important;
    border-radius: 99px;
  }

  .login-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
  }
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 4rem 1rem 6rem;
  /* Extra padding bottom for overlap if needed */
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Abstract shapes for premium feel */
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
  border-radius: 50%;
  z-index: 0;
}

.hero h1 {
  font-size: 2.5rem;
  color: white;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.hero p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

.hero-cta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  position: relative;
  z-index: 1;
}

@media (min-width: 640px) {
  .hero-cta {
    flex-direction: row;
  }

  .hero h1 {
    font-size: 3.5rem;
  }
}

/* ========================================
   PAGE SECTIONS
   ======================================== */
.trust-section {
  margin-top: -3rem;
  /* Overlap hero */
  padding-bottom: 3rem;
  position: relative;
  z-index: 10;
}

.trust-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .trust-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .trust-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.trust-item h3 {
  font-size: 1.25rem;
  color: var(--primary-dark);
}

.trust-item p {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Card Grids */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 1rem;
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

/* Footer */
.public-footer {
  background: var(--secondary);
  color: white;
  padding: 4rem 1rem 2rem;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .footer-content {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.footer-section h4 {
  color: white;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.footer-section a {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.75rem;
}

.footer-section a:hover {
  color: white;
  transform: translateX(4px);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.875rem;
}

/* ========================================
   ADMIN & DASHBOARD STYLES (Preserved/Updated)
   ======================================== */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
}

/* Forms */
.form-input,
.form-select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--background);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--background);
  font-weight: 600;
  color: var(--secondary-light);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Utilities specific to internal app */
.emergency-row {
  background-color: #fef2f2;
  border-left: 4px solid var(--danger);
}

.text-red {
  color: var(--danger);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-danger {
  background: var(--danger);
  color: white;
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider:before {
  transform: translateX(24px);
}

/* ========================================
   INNER PAGE REFINEMENTS
   ======================================== */

/* Inner Page Hero (Compacted but same Premium Gradient) */
.hero-inner {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 3rem 1rem 6rem;
  /* Reduced top padding, kept bottom for overlap */
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-inner h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: white;
}

.hero-inner p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto;
}

/* Abstract decoration for inner pages */
.hero-inner::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -5%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}

/* Overlapping Content Section ("Life" to content) */
.section-overlap {
  position: relative;
  z-index: 10;
  margin-top: -4rem;
  /* The overlap magic */
  padding-bottom: 3rem;
}

.content-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  /* Premium shadow */
  padding: 3rem;
  border: 1px solid rgba(255, 255, 255, 1);
  max-width: 1000px;
  /* Constrain width for readability */
  margin: 0 auto;
}

@media (max-width: 768px) {
  .hero-inner {
    padding: 2.5rem 1rem 5rem;
  }

  .hero-inner h1 {
    font-size: 2rem;
  }

  .content-card {
    padding: 1.5rem;
  }
}

/* ========================================
   CHAT WIDGET
   ======================================== */
#d2h-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: var(--font-primary);
}

#chat-launcher-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#chat-launcher-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(15, 118, 110, 0.5);
}

#d2h-chat-widget.open #chat-launcher-btn {
  display: none;
}

#d2h-chat-widget:not(.open) #chat-header,
#d2h-chat-widget:not(.open) #chat-messages,
#d2h-chat-widget:not(.open) #chat-input-area {
  display: none;
}

#d2h-chat-widget.open {
  width: 350px;
  height: 500px;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

#chat-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

#chat-toggle-btn {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem;
  transition: transform 0.2s;
}

#chat-toggle-btn:hover {
  transform: scale(1.2);
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--background);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-msg {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-msg.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.bot {
  background: white;
  color: var(--text);
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

#chat-input-area {
  display: flex;
  padding: 1rem;
  background: white;
  border-top: 1px solid var(--border);
}

#chat-msg-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

#chat-msg-input:focus {
  border-color: var(--primary);
}

#chat-input-area button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  margin-left: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#chat-input-area button:hover {
  background: var(--primary-dark);
}

@media (max-width: 768px) {
  #d2h-chat-widget.open {
    width: calc(100vw - 40px);
    height: calc(100vh - 100px);
    bottom: 10px;
    right: 10px;
  }
}