/* ==========================================================================
   Alliance IT Solution - Master Stylesheet
   Bespoke Brand Palette Derived From Official Brand Logo & Favicon
   ========================================================================== */

/* Configure Tailwind CSS v4 class-based dark mode */
@custom-variant dark (&:where(.dark, .dark *));

/* Modern CSS Root & Theming */
:root {
  color-scheme: light dark;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Authentic Brand Colors extracted from Alliance IT Solution logo */
  --brand-blue: #325cf4;       /* Primary Electric Cobalt */
  --brand-blue-hover: #2147dc;
  --brand-sky: #33affe;        /* Vivid Cerulean Sky */
  --brand-coral: #fe7577;      /* Distinctive Warm Coral */
  --brand-coral-hover: #ea5f61;
  --brand-teal: #00e5be;       /* Neon Mint / Emerald */
  --brand-gold: #ffd34b;       /* Solar Gold */

  /* Light Scheme */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --accent-primary: var(--brand-blue);
  --accent-hover: var(--brand-blue-hover);
  --accent-light: #eff3ff;
  
  --shadow-subtle: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-card: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-hover: 0 10px 18px -3px rgb(50 92 244 / 0.12), 0 4px 6px -4px rgb(50 92 244 / 0.06);
  --shadow-elevated: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Dark Scheme Mapping */
:root:has(> head > meta[name="color-scheme"][content="dark"]),
html.dark {
  color-scheme: dark;
  --bg-primary: #080c16;
  --bg-secondary: #0e1626;
  --bg-card: #121c32;
  --border-subtle: #1c2b48;
  --border-strong: #283c66;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #4f73ff;
  --accent-hover: #688aff;
  --accent-light: #132044;
  
  --shadow-subtle: 0 1px 3px 0 rgb(0 0 0 / 0.4);
  --shadow-card: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-hover: 0 10px 20px -3px rgb(0 0 0 / 0.5), 0 4px 8px -4px rgb(0 0 0 / 0.4);
  --shadow-elevated: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.5);
}

/* Guaranteed Global Dark Mode Surface & Text Fallbacks */
html.dark {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

html.dark body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

html.dark .bg-white {
  background-color: var(--bg-card);
}

html.dark dialog {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.form-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

/* Base Document Reset & Scrollbars */
*, *::before, *::after {
  box-sizing: border-box;
}

::selection {
  background-color: #325cf4;
  color: #ffffff;
}

html, body {
  max-width: 100%;
  overflow-x: clip;
}

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  accent-color: var(--accent-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, p, span, a {
  overflow-wrap: break-word;
}

main {
  flex: 1 0 auto;
}

/* Scrollbar styling per Modern Web Guidance */
:root {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* Modal Dialog & Overlay Architecture */
dialog:not([open]) {
  display: none !important;
}

dialog:modal {
  overscroll-behavior: contain;
  border: none;
  padding: 0;
  margin: auto;
  border-radius: 1rem;
  background: transparent;
  max-width: 90vw;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Dialog Animation */
dialog[open] {
  animation: dialog-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

dialog.dialog-closing {
  animation: dialog-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

dialog#inquiry-modal:not([open]) {
  display: none !important;
}

dialog#inquiry-modal[open] {
  display: block;
  position: fixed;
  inset: 0;
  margin: auto;
  max-width: min(92vw, 32rem);
  max-height: min(90dvh, 760px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 10000;
}

@media (max-width: 640px) {
  dialog#inquiry-modal > div {
    padding: 1.25rem 1rem !important;
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes dialog-out {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
}

/* Mobile Navigation Drawer Architecture */
.mobile-nav-dialog:not([open]) {
  display: none !important;
}

/* On desktop viewports (>= 768px), mobile drawer is strictly hidden */
@media (min-width: 768px) {
  .mobile-nav-dialog,
  dialog#mobile-drawer {
    display: none !important;
  }
}

.mobile-nav-dialog {
  display: none;
  margin: 0;
  inset: 0 auto 0 0;
  width: min(85vw, 320px);
  height: 100%;
  max-height: 100dvh;
  border: none;
  background: var(--bg-card);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-dialog::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.mobile-nav-dialog[open] {
  display: block;
  position: fixed;
  z-index: 9999;
  animation: drawer-slide-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.mobile-nav-dialog.drawer-closing {
  animation: drawer-slide-out 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes drawer-slide-in {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes drawer-slide-out {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* Shadcn/UI Inspired Component Utilities */
.shadcn-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.shadcn-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
}

.shadcn-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  letter-spacing: 0.025em;
  transition: all 0.2s ease;
}

.badge-indigo,
.badge-blue {
  background-color: rgba(50, 92, 244, 0.1);
  color: #325cf4;
  border: 1px solid rgba(50, 92, 244, 0.25);
}

html.dark .badge-indigo,
html.dark .badge-blue {
  background-color: rgba(50, 92, 244, 0.18);
  color: #7d9bff;
  border: 1px solid rgba(50, 92, 244, 0.35);
}

.badge-coral {
  background-color: rgba(254, 117, 119, 0.12);
  color: #ea5052;
  border: 1px solid rgba(254, 117, 119, 0.3);
}

html.dark .badge-coral {
  background-color: rgba(254, 117, 119, 0.2);
  color: #ff9193;
  border: 1px solid rgba(254, 117, 119, 0.4);
}

.badge-teal {
  background-color: rgba(0, 229, 190, 0.12);
  color: #00a88b;
  border: 1px solid rgba(0, 229, 190, 0.3);
}

html.dark .badge-teal {
  background-color: rgba(0, 229, 190, 0.2);
  color: #00e5be;
  border: 1px solid rgba(0, 229, 190, 0.35);
}

/* Brand Accent & Gradient Utility Classes */
.text-brand-blue { color: var(--brand-blue); }
.text-brand-coral { color: var(--brand-coral); }
.text-brand-sky { color: var(--brand-sky); }
.text-brand-teal { color: var(--brand-teal); }

.bg-brand-blue { background-color: var(--brand-blue); }
.bg-brand-coral { background-color: var(--brand-coral); }
.bg-brand-teal { background-color: var(--brand-teal); }

.brand-gradient-text {
  background: linear-gradient(135deg, #325cf4 0%, #33affe 50%, #fe7577 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Scroll Reveal States */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* Accessible Form Validation States (:user-invalid / :user-valid) */
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Modern Web Guidance: Validate only after interaction */
.form-input:user-invalid,
.form-textarea:user-invalid,
.form-select:user-invalid {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.03);
}

.form-input:user-invalid:focus,
.form-textarea:user-invalid:focus,
.form-select:user-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-input:user-valid:not(:placeholder-shown),
.form-textarea:user-valid:not(:placeholder-shown) {
  border-color: #10b981;
}

.field-error-msg {
  display: none;
  font-size: 0.8rem;
  color: #ef4444;
  margin-top: 0.35rem;
  align-items: center;
  gap: 0.35rem;
}

.field-group.has-error .field-error-msg {
  display: flex;
}

.field-group.has-error .form-input,
.field-group.has-error .form-textarea,
.field-group.has-error .form-select {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.03);
}

/* Honeypot Anti-Spam Hidden Style */
.alliance-hp {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
  width: 0;
  z-index: -1;
  pointer-events: none;
}

/* Toast System Container */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
  width: calc(100% - 3rem);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-elevated);
  transform: translateY(20px);
  opacity: 0;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-dismissing {
  animation: toast-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

.toast-success {
  border-left: 4px solid #10b981;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-info {
  border-left: 4px solid #3b82f6;
}

/* Background Subtle Mesh Gradients Derived from Logo */
.hero-mesh-gradient {
  background-image: 
    radial-gradient(at 10% 20%, rgba(50, 92, 244, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(51, 175, 254, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 10%, rgba(254, 117, 119, 0.06) 0px, transparent 55%);
}

html.dark .hero-mesh-gradient {
  background-image: 
    radial-gradient(at 10% 20%, rgba(50, 92, 244, 0.18) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(51, 175, 254, 0.14) 0px, transparent 50%),
    radial-gradient(at 50% 10%, rgba(254, 117, 119, 0.10) 0px, transparent 55%);
}

/* Feature Table Responsive Wrapper */
.table-responsive-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

/* ==========================================================================
   Mobile Ergonomics & Responsive Enhancements
   ========================================================================== */

/* Prevent iOS auto-zoom on field focus */
@media (max-width: 640px) {
  .form-input,
  .form-textarea,
  .form-select,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Touch Targets: Ensure min 44x44px for primary mobile tap targets */
@media (max-width: 768px) {
  #mobile-nav-toggle,
  #mobile-nav-close,
  [data-theme-toggle] {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Toast container positioning on mobile */
@media (max-width: 480px) {
  #toast-container {
    bottom: 1rem;
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: 100%;
  }
}

