@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;600;700;800;900&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-sans);
  --font-mono: 'Space Grotesk', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  --bg-dark: #06090e;
  --bg-card: #0a111a;
  --bg-card-glass: rgba(10, 17, 26, 0.78);
  --bg-card-glass-hover: rgba(14, 23, 36, 0.9);
  
  --border-color: rgba(255, 255, 255, 0.09);
  --border-hover: rgba(34, 197, 94, 0.45);
  --border-gold: rgba(234, 179, 8, 0.35);
  
  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-light: #22c55e;
  --primary-glow: rgba(34, 197, 94, 0.28);
  --primary-dark: #0e3d26;
  
  --gold: #eab308;
  --gold-hover: #ca8a04;
  --gold-glow: rgba(234, 179, 8, 0.28);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1.0);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Safe Area Variables */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-color: var(--border-color);
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  background-color: var(--bg-dark);
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: var(--sat);
  padding-bottom: var(--sab);
  padding-left: var(--sal);
  padding-right: var(--sar);
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Fluid Typography with Smart Clamps */
.text-fluid-lg {
  font-size: clamp(2rem, 5.5vw + 1rem, 4.8rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.text-fluid-h2 {
  font-size: clamp(1.6rem, 3.5vw + 0.5rem, 2.8rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.text-fluid-base {
  font-size: clamp(0.9rem, 1.2vw + 0.4rem, 1.15rem);
  line-height: 1.65;
}

/* Glassmorphism & UI Components */
.premium-glass {
  background: var(--bg-card-glass);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.7);
}

.premium-card {
  background: rgba(12, 19, 31, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  transition: all 0.35s var(--ease-apple);
}

.premium-card:hover {
  background: var(--bg-card-glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 20px 40px -15px var(--primary-glow);
}

.card-gold-glow:hover {
  border-color: var(--border-gold);
  box-shadow: 0 20px 40px -15px var(--gold-glow);
}

.gnp-text-shadow-premium,
.gnr-text-shadow-premium {
  text-shadow: 0 10px 35px rgba(0, 0, 0, 0.85);
}

.gnp-glow-text,
.gnr-glow-text {
  text-shadow: 0 0 25px rgba(34, 197, 94, 0.4);
}

.institutional-glow {
  position: relative;
}

.institutional-glow::after {
  content: "";
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  z-index: -1;
  filter: blur(40px);
  pointer-events: none;
}

.paper-texture-subtle {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
}

/* Custom Tactical Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #06090e;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* Animations */
@keyframes pulseGlow {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

.pulse-glow {
  animation: pulseGlow 4s infinite ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.animate-scale-in {
  animation: scaleIn 0.3s var(--ease-out-back) forwards;
}

/* Modal and Dialogs - Fluid & Scrollable on all viewports */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: rgba(9, 15, 24, 0.98);
  border: 1px solid var(--border-color);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.95);
  border-radius: 1.75rem;
  width: 100%;
  max-width: 54rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  transform: scale(0.96) translateY(10px);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto;
}

.modal-backdrop.active .modal-content {
  transform: scale(1) translateY(0);
}

/* Custom Toast Notification System */
#toast-container {
  position: fixed;
  top: max(1rem, var(--sat));
  right: max(1rem, var(--sar));
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: calc(100vw - 2rem);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: 1.15rem;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(11, 18, 28, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65);
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.55);
  color: #4ade80;
  box-shadow: 0 16px 40px -10px rgba(34, 197, 94, 0.35);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.55);
  color: #f87171;
  box-shadow: 0 16px 40px -10px rgba(239, 68, 68, 0.35);
}

.toast.info {
  border-color: rgba(59, 130, 246, 0.55);
  color: #60a5fa;
  box-shadow: 0 16px 40px -10px rgba(59, 130, 246, 0.35);
}

/* Form element enhancements - iOS auto zoom prevention (min 16px) */
input, textarea, select {
  outline: none;
  font-family: inherit;
  font-size: 16px !important; /* Prevents auto-zoom on iOS safari / webviews */
}

@media (min-width: 640px) {
  input, textarea, select {
    font-size: 0.925rem !important;
  }
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-glow) !important;
}

/* Custom Select Dropdown Options - Dark theme & high contrast */
select {
  background-color: #0a111a !important;
  color: #f8fafc !important;
  cursor: pointer;
}

select option {
  background-color: #0a111a !important;
  color: #f8fafc !important;
  padding: 8px 12px !important;
}

select optgroup {
  background-color: #060a10 !important;
  color: #22c55e !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.1em !important;
  padding: 6px 10px !important;
}

/* Button & Interactive Touch Ergonomics */
button, a.cursor-pointer, .btn-gnp, .btn-gnr {
  user-select: none;
  font-family: var(--font-display);
  touch-action: manipulation;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Certificate Styles */
.certificate-border {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.35) 0%, rgba(234, 179, 8, 0.35) 50%, rgba(34, 197, 94, 0.35) 100%);
  padding: 2px;
  border-radius: 2rem;
}

.certificate-inner {
  background: radial-gradient(circle at 50% 0%, rgba(14, 45, 28, 0.75), rgba(8, 14, 22, 0.98) 70%);
  border-radius: calc(2rem - 2px);
}

/* ==========================================================================
   MULTI-RESOLUTION OPTIMIZATIONS & BREAKPOINTS
   ========================================================================== */

/* 1. Small Mobile (< 380px) */
@media (max-width: 380px) {
  .text-fluid-lg {
    font-size: 1.85rem;
    line-height: 1.08;
  }
  
  .modal-content {
    border-radius: 1.25rem;
    padding: 0;
  }

  .premium-glass {
    border-radius: 1.25rem !important;
  }
}

/* 2. Tablets (Portrait & Landscape: 768px to 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  body {
    font-size: 0.95rem;
  }
  
  .premium-glass {
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
}

/* 3. Short Screen Height / Landscape Smartphones (< 540px height) */
@media (max-height: 540px) and (orientation: landscape) {
  #main-navbar {
    position: sticky;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  main {
    padding-top: 1rem !important;
    padding-bottom: 2rem !important;
  }

  .modal-content {
    max-height: 94dvh;
  }
}

/* 4. Ultra-wide & 4K Displays (> 1920px and > 2560px) */
@media (min-width: 1920px) {
  .text-fluid-lg {
    font-size: 5rem;
  }
}

/* 5. In-game / Iframe / FiveM NUI Tablet Mode */
body.is-iframe {
  background-color: #06090e;
  overflow-x: hidden;
}

body.is-iframe #main-navbar {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

body.is-iframe main {
  padding-top: 5rem !important;
  padding-bottom: 3rem !important;
}
