:root {
  --primary-blue: #0028CD;
  --primary-orange: #FF500F;
  --dark-blue: #001a8a;
  --light-blue: #e6f2ff;
  --dark-orange: #cc3f0c;
  --light-orange: #fff2ee;
  --text-dark: #1a1a1a;
  --text-light: #6b7280;
  --text-muted: #9ca3af;
  --bg-light: #f8fafc;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --accent-gradient: linear-gradient(135deg, #0028CD 0%, #FF500F 100%);
  --subtle-gradient: linear-gradient(135deg, rgba(0, 40, 205, 0.05) 0%, rgba(255, 80, 15, 0.05) 100%);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px 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);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-blue: 0 10px 25px rgba(0, 40, 205, 0.15);
  --shadow-orange: 0 10px 25px rgba(255, 80, 15, 0.15);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --sidebar-width: 280px;
  --sidebar-collapsed: 70px;
  --header-height: 90px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --content-max-width: 1600px;
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;
}

/* --- Fonts --- */
@font-face {
  font-family: "Neue Haas Unica Pro";
  src: url("assets/fonts/Linotype - Neue Haas Unica Pro.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Neue Haas Unica Pro";
  src: url("assets/fonts/Linotype - Neue Haas Unica Pro Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
}
@font-face {
  font-family: "Neue Haas Unica Pro";
  src: url("assets/fonts/Linotype - Neue Haas Unica Pro Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
}
@font-face {
  font-family: "Neue Haas Unica Pro";
  src: url("assets/fonts/Linotype - Neue Haas Unica Pro Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: "Neue Haas Unica Pro";
  src: url("assets/fonts/Linotype - Neue Haas Unica Pro Black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
}

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

html {
  -webkit-text-size-adjust: 100%;
  font-family: "Neue Haas Unica Pro", -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

body {
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  overflow: hidden; /* App-like feel, scroll inside main-content */
  font-family: "Neue Haas Unica Pro", -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

/* --- Layout Structure --- */

.dashboard-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

.dashboard-header {
  height: var(--header-height);
  background: linear-gradient(to right, var(--white) 0%, #fafbfc 100%);
  border-bottom: 2px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dashboard-body {
  display: flex;
  flex: 1;
  overflow: hidden; /* Contain scrolls */
  position: relative;
}

/* --- Sidebar --- */

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(to bottom, var(--white) 0%, #fafbfc 100%);
  border-right: 2px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, transform 0.3s ease;
  z-index: 200;
  flex-shrink: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 70px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px 12px 0;
}

/* --- Main Content --- */

.main-content {
  flex: 1;
  position: relative;
  background: var(--bg-light);
  overflow-y: auto;
  overflow-x: hidden;
  transition: margin 0.3s ease;
  display: flex;
  flex-direction: column;
}

.content-wrapper {
  flex: 1;
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  position: relative;
  min-height: 100%;
}

/* --- Welcome Screen & Grid --- */

.welcome-screen {
  padding: var(--spacing-lg) var(--spacing-xl);
  width: 100%;
}

.welcome-content {
  width: 100%;
}

.welcome-content h1 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 var(--spacing-sm) 0;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #001a99 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-content > p {
  font-size: 16px;
  color: var(--text-light);
  margin: 0 0 var(--spacing-xl) 0;
  line-height: 1.5;
  max-width: 800px;
}

/* The Grid - Auto Fit for Responsiveness */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-lg);
  width: 100%;
  margin-bottom: var(--spacing-xl);
}

.service-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius-lg);
  padding: 32px 32px 48px 32px; /* Consistent padding with extra bottom space */
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-blue);
  transform: scaleX(0);
  transition: var(--transition);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(0, 40, 205, 0.2);
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-icon {
  width: 100%;
  height: 100px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-icon img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  filter: drop-shadow(var(--shadow));
  transition: var(--transition);
}

.service-card:hover .service-icon img {
  transform: scale(1.05);
  filter: drop-shadow(var(--shadow-lg));
}

.service-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-blue);
  text-align: center;
}

.service-description {
  color: var(--text-light);
  margin-bottom: 2rem;
  line-height: 1.6;
  text-align: center;
  flex-grow: 1; /* Pushes button to bottom */
}

.service-btn {
  background: transparent;
  color: var(--primary-blue);
  padding: 0.875rem 2rem;
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: var(--transition);
  display: inline-flex; /* Better centering for icon/text */
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 250px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--primary-blue);
  margin: 0 auto; /* Center button */
  cursor: pointer;
  font-family: "Neue Haas Unica Pro", sans-serif;
  margin-top: auto;
  margin-bottom: 4px; /* Visual safety margin */
}

.service-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
  transition: var(--transition);
  z-index: 1;
}

.service-btn:hover::before {
  left: 100%;
}

.service-btn:hover {
  transform: translateY(-2px);
  color: var(--primary-blue);
  border-color: #FF500F;
}

.service-btn i {
  margin-left: 0.5rem;
}

/* --- Iframe Container --- */
/* Completely reworked to be absolute within content-wrapper */
.iframe-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--white);
  z-index: 100;
  display: none; /* Controlled by JS */
}

.iframe-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#serviceFrame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* --- Header Elements --- */

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.header-center {
  flex: 2;
}

.header-right {
  justify-content: flex-end;
}

.logo {
  display: flex;
  align-items: center;
  height: 50px;
}

.logo img {
  height: 100%;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

/* Buttons in Header */
.hero-nav-btn, #loginBtn {
  padding: 0.6rem 1.5rem;
  border-radius: 6px; /* Match home.html service-btn */
  border: 2px solid var(--primary-blue);
  background: transparent;
  color: var(--primary-blue);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-family: "Neue Haas Unica Pro", sans-serif;
}

.hero-nav-btn::before, #loginBtn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, rgba(255, 80, 15, 0.1), transparent);
  transition: var(--transition);
  z-index: 1;
}

.hero-nav-btn:hover::before, #loginBtn:hover::before {
  left: 100%;
}

.hero-nav-btn:hover, #loginBtn:hover {
  background: transparent;
  border-color: #FF500F; /* primary-orange */
  color: var(--primary-blue);
  transform: translateY(-2px);
}

#loginBtn.hide-login {
  display: none !important;
}

#loginBtn.show-login {
  display: inline-flex !important;
}

/* User Info Action Buttons */
.user-action-btn {
  background: none;
  border: none;
  color: var(--primary-blue);
  margin-left: 5px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.user-action-btn:hover {
  color: var(--primary-orange);
  background-color: rgba(255, 80, 15, 0.1);
}

/* --- Navigation Items --- */

.nav-section {
  margin-bottom: 12px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  padding: 8px 12px 8px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--gray-100);
}

.nav-item.active {
  background: linear-gradient(to right, rgba(0, 40, 205, 0.12) 0%, rgba(0, 40, 205, 0.06) 100%);
  color: var(--primary-blue);
  font-weight: 600;
  border-left: 3px solid var(--primary-blue);
}

.nav-item i, .nav-icon-img {
  width: 20px;
  height: 20px;
  text-align: center;
  flex-shrink: 0;
  object-fit: contain;
}

.nav-item span {
  opacity: 1;
  transition: opacity 0.2s;
}

/* Styled Badge (like .service-btn in home.html but smaller) */
.service-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--primary-blue);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 2px solid var(--primary-blue);
  margin-left: 8px;
  margin-right: 0;
  font-family: "Neue Haas Unica Pro", sans-serif;
  transition: var(--transition);
  flex-shrink: 0;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  max-width: 140px;
  min-width: 100px;
  word-wrap: break-word;
  hyphens: auto;
}

/* Add hover effect for the badge when the nav-item is hovered */
.nav-item:hover .service-badge {
  border-color: #FF500F; /* Match service-btn hover */
  transform: translateY(-1px);
}

.nav-item.active .service-badge {
  background: var(--primary-blue);
  color: var(--white);
  border-color: var(--primary-blue);
}

/* Collapsed Sidebar Styles */
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .service-badge,
.sidebar.collapsed .nav-section-title {
  display: none; /* Hide text */
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .nav-item i,
.sidebar.collapsed .nav-icon-img {
  margin: 0;
}

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid var(--gray-200);
  color: var(--primary-blue);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Mobile Menu Toggle --- */
.mobile-menu-toggle {
  display: none; /* Hidden on desktop */
  background: transparent;
  border: 1px solid var(--gray-200);
  color: var(--primary-blue);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  transition: var(--transition);
}

.mobile-menu-toggle:hover {
  background: var(--gray-50);
  border-color: var(--primary-blue);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s;
}

/* --- Responsive Media Queries --- */

@media (max-width: 1024px) {
  .dashboard-header {
    padding: 0 20px;
  }
  
  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%);
    box-shadow: 4px 0 16px rgba(0,0,0,0.1);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .sidebar-toggle-btn {
    display: none; /* Hide internal toggle on mobile */
  }

  .sidebar.collapsed {
    width: var(--sidebar-width); /* Ignore collapsed width on mobile, show full menu */
  }
  
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
  
  .services-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .dashboard-header {
    height: 70px;
    padding: 0 16px;
  }
  
  .logo img {
    max-width: 140px;
  }
  
  .welcome-content h1 {
    font-size: 28px;
  }
  
  .services-grid {
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 16px;
  }
  
  .user-name {
    display: none; /* Hide name on small screens */
  }
  
  .welcome-screen {
    padding: var(--spacing-md);
  }
}

@media (max-width: 480px) {
  .header-center {
    display: none;
  }
  
  .hero-nav-btn {
    padding: 0.5rem 0.8rem; /* Reduced horizontal padding */
    font-size: 0.8rem;
  }
  
  .logo img {
    max-width: 100px; /* Reduced logo size */
  }

  .welcome-content h1 {
    font-size: 24px;
  }
  
  .service-card {
    padding: 20px;
  }
}
