@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Modern Brokerage Color Palette */
  --primary-color: #0F2027; /* Deep FinTech Blue/Black */
  --secondary-color: #203A43;
  --accent-color: #00B4DB; /* Trustworthy vibrant blue */
  --accent-secondary: #28a745; /* Success Green */
  --text-dark: #1F2937;
  --text-light: #F3F4F6;
  --bg-main: #FAFAFA;
  --bg-card: #FFFFFF;
  --border-color: #E5E7EB;

  /* Typography */
  --font-primary: 'Inter', sans-serif;

  /* Spacing */
  --unit: 1rem;
  --border-radius: 8px;
  --border-radius-lg: 16px;

  /* WCAG Accessibility contrast overrides */
  --focus-ring: 3px solid #005fcc;
  --font-size-base: 16px;
}

/* High Contrast Mode Variables */
body.theme-high-contrast {
  --primary-color: #000000;
  --secondary-color: #000000;
  --accent-color: #FFFF00; /* Yellow on Black is WCAG AAA */
  --accent-secondary: #00FF00;
  --text-dark: #FFFFFF;
  --text-light: #000000;
  --bg-main: #000000;
  --bg-card: #121212;
  --border-color: #FFFF00;
  background-color: var(--bg-main) !important;
  color: var(--text-dark) !important;
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  color: var(--text-dark);
  background-color: var(--bg-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  font-weight: 700;
  color: var(--header-color, var(--text-dark));
  margin-bottom: var(--unit);
}

body.theme-high-contrast h1, body.theme-high-contrast h2, body.theme-high-contrast h3,
body.theme-high-contrast h4, body.theme-high-contrast h5, body.theme-high-contrast h6 {
  color: var(--accent-color) !important;
}

/* Forms and Inputs */
input, textarea, select {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  font-family: var(--font-primary);
  background-color: var(--bg-card);
  color: var(--text-dark);
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 180, 219, 0.2);
}

body.theme-high-contrast input, body.theme-high-contrast textarea, body.theme-high-contrast select {
  border: 2px solid var(--accent-color);
  background-color: #000;
  color: #fff;
}

body.theme-high-contrast input:focus, body.theme-high-contrast textarea:focus, body.theme-high-contrast select:focus {
  box-shadow: 0 0 0 3px var(--accent-color);
}

/* Keyboard Navigation focus rings */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

body.theme-high-contrast :focus-visible {
  outline: 4px solid var(--accent-color) !important;
}

/* Modern Card Layout */
.modern-card {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  padding: 2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.modern-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body.theme-high-contrast .modern-card {
  box-shadow: none;
  border: 2px solid var(--border-color);
}

/* Modern Buttons (Expanding Target Size per WCAG) */
.btn-modern {
  display: inline-block;
  background-color: var(--accent-color);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  min-height: 48px; /* WCAG Target Size Minimum */
  min-width: 48px;
  line-height: normal; /* Removes default Bootstrap btn line height issues */
  transition: background-color 0.2s, transform 0.1s;
}

.btn-modern:hover, .btn-modern:focus {
  background-color: #008eb0;
  color: #fff;
  transform: translateY(-1px);
}

body.theme-high-contrast .btn-modern {
  background-color: var(--accent-color);
  color: #000 !important;
  border: 2px solid #000;
}

body.theme-high-contrast .btn-modern:hover, body.theme-high-contrast .btn-modern:focus {
  background-color: #000;
  color: var(--accent-color) !important;
  border: 2px solid var(--accent-color);
}

/* Structural Classes */
.section-padding {
  padding: 5rem 0;
}

.text-center { text-align: center; }
.mt-1 { margin-top: var(--unit); }
.mt-2 { margin-top: calc(var(--unit) * 2); }
.mb-1 { margin-bottom: var(--unit); }
.mb-2 { margin-bottom: calc(var(--unit) * 2); }

/* Remove ugly legacy link resets */
a.modern-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}
a.modern-link:hover, a.modern-link:focus {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

body.theme-high-contrast a {
  color: var(--accent-color) !important;
  text-decoration: underline !important;
}

/* Glassmorphism Header */
.modern-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

body.theme-high-contrast .modern-header {
  background: #000;
  border-bottom: 2px solid var(--accent-color);
}

/* High Contrast Dropdown Fix */
body.theme-high-contrast .nbs-submenu {
  background-color: #000 !important;
  border: 2px solid var(--accent-color) !important;
}

body.theme-high-contrast .nbs-submenu li a {
  color: var(--accent-color) !important;
  background-color: #000 !important;
}

body.theme-high-contrast .nbs-submenu li a:hover,
body.theme-high-contrast .nbs-submenu li a:focus {
  background-color: var(--accent-color) !important;
  color: #000 !important;
}

/* Global Subpage Banner Text Fix */
[class*="page-area-"] h1, [class*="page-area-"] h2, [class*="page-area-"] h3, [class*="page-area-"] h4,
[class*="page-area-"] p, .sub-head h4, .sub-head p {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Strict Viewport Constraint for Hero/Banners */
.hero-section {
  height: 35vh !important;
  max-height: 35vh !important;
  min-height: 280px !important;
  padding: 0 !important;
  display: block !important;
  position: relative;
  overflow: hidden;
}

[class*="page-area-"] {
  position: relative;
  height: 30vh;
  min-height: 240px;
  max-height: 350px;
  background-size: cover !important;
  background-position: center center !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden;
}

/* Bulletproof State-Aware Flexbox for Hero Carousel Items */
.nbs-hero-item {
    height: 100%;
}
.nbs-hero-item.active,
.nbs-hero-item.next,
.nbs-hero-item.prev,
.nbs-hero-item.next.left,
.nbs-hero-item.prev.right {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Comprehensive Mobile & Touch Responsiveness */
@media (max-width: 768px) {
  /* Stack legacy and modern grid elements reliably */
  section .row, .about-area .row, .project-area .row, .services-area .row {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.5rem !important;
  }
  
  .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
  .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
    width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin-bottom: 1rem !important;
    float: none !important;
    max-width: 100% !important;
  }

  /* Reset fixed heights preventing robust text wrap */
  .modern-card, .about-inner, .team-content1, .team-content2 {
    height: auto !important;
    min-height: auto !important;
  }

  /* Optimize Typography for mobile viewports */
  h1 { font-size: 2.25rem !important; }
  h2 { font-size: 1.75rem !important; }
  h3 { font-size: 1.5rem !important; }

  /* Enlarge Interactive elements to ensure touch-friendliness */
  .btn-modern, .btn-info, a, input, select, textarea {
    min-height: 54px !important; /* Larger than 48px baseline for mobile ease */
  }

  /* Re-align generic tables for horizontal scroll preventing blowout */
  .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

/* TradingView High Contrast Inversion Override */
body.theme-high-contrast .tradingview-widget-container {
    filter: invert(1) hue-rotate(180deg) brightness(1.2);
}
