/**
 * HospiEdge Premium Design System
 * Drop-in CSS enhancement layer
 * Version: 1.0.0
 */

/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {
  /* Typography Scale */
  --font-display: 3.5rem;
  --font-display-weight: 800;
  --font-display-line: 1.1;
  --font-display-letter: -0.03em;

  --font-h1: 2.25rem;
  --font-h2: 1.875rem;
  --font-h3: 1.5rem;
  --font-h4: 1.25rem;
  --font-h5: 1.125rem;
  --font-h6: 1rem;

  --font-body-lg: 1.125rem;
  --font-body: 1rem;
  --font-body-sm: 0.875rem;
  --font-label: 0.75rem;
  --font-micro: 0.6875rem;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  --line-tight: 1.25;
  --line-normal: 1.5;
  --line-relaxed: 1.75;

  /* Spacing System (8px grid) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3rem;
  --space-9: 4rem;
  --space-10: 5rem;
  --space-12: 6rem;

  /* Colors - Enhanced */
  --bg-primary: #020617;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --bg-elevated: #1e2a3b;

  --surface-card: #0f172a;
  --surface-card-hover: #162031;
  --surface-input: #0a1120;

  --border-subtle: rgba(148, 163, 184, 0.08);
  --border-default: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.18);

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-muted: #64748b;
  --text-disabled: #475569;

  --brand-primary: #22d3ee;
  --brand-primary-hover: #06b6d4;
  --brand-primary-subtle: rgba(34, 211, 238, 0.1);

  --success: #10b981;
  --success-subtle: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-subtle: rgba(239, 68, 68, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 
               0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 
               0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 
               0 10px 10px -5px rgba(0, 0, 0, 0.3);

  --glow-brand: 0 0 20px rgba(34, 211, 238, 0.2);
  --glow-success: 0 0 20px rgba(16, 185, 129, 0.2);
  --glow-danger: 0 0 20px rgba(239, 68, 68, 0.2);

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
}

/* ============================================
   GLOBAL ENHANCEMENTS
   ============================================ */

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  scroll-behavior: smooth;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-tight);
  margin-top: 0;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--font-h1); }
h2 { font-size: var(--font-h2); }
h3 { font-size: var(--font-h3); }
h4 { font-size: var(--font-h4); }
h5 { font-size: var(--font-h5); }
h6 { font-size: var(--font-h6); }

p {
  line-height: var(--line-normal);
  color: var(--text-secondary);
  margin-top: 0;
}

/* ============================================
   CARD SYSTEM
   ============================================ */

.card,
.intel-card,
.kpi,
.guide-card,
.legal-section,
.mgmt-card,
.price-box,
.homescreen-box {
  background: var(--surface-card) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-2xl) !important;
  padding: var(--space-6) !important;
  box-shadow: var(--shadow-md) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative;
  overflow: hidden;
}

.card::before,
.intel-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-default) 50%,
    transparent
  );
  opacity: 0.5;
}

.card:hover,
.intel-card:hover {
  border-color: var(--border-default) !important;
  box-shadow: var(--shadow-lg) !important;
  transform: translateY(-2px);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn,
.btn-primary,
.btn-save,
.btn-login,
.action-btn,
.quick-btn,
[class*="btn-"] {
  font-family: inherit;
  font-size: var(--font-body);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:hover,
.btn-primary:hover,
.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn:active,
.btn-primary:active {
  transform: translateY(0);
}

.btn-primary,
.btn-save,
.btn-login {
  background: var(--brand-primary) !important;
  color: #0a1120 !important;
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3) !important;
}

.btn-primary:hover,
.btn-save:hover,
.btn-login:hover {
  background: var(--brand-primary-hover) !important;
  box-shadow: 0 6px 20px rgba(34, 211, 238, 0.4) !important;
}

/* ============================================
   FORMS & INPUTS
   ============================================ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  font-family: inherit;
  font-size: var(--font-body);
  padding: var(--space-4);
  background: var(--surface-input) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--text-primary) !important;
  transition: all 0.2s ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-default) !important;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 3px var(--brand-primary-subtle) !important;
  background: var(--bg-secondary) !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

label {
  font-size: var(--font-label);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: var(--space-2);
}

/* ============================================
   NAVIGATION
   ============================================ */

.site-header-container {
  background: rgba(2, 6, 23, 0.8) !important;
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.main-footer {
  background: rgba(2, 6, 23, 0.95) !important;
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border-subtle) !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.nav-link {
  border-radius: var(--radius-xl) !important;
  background: var(--bg-tertiary) !important;
  border: 1px solid var(--border-subtle) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    transparent,
    rgba(34, 211, 238, 0.05)
  );
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-link:hover::before {
  opacity: 1;
}

.nav-link.active {
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.15),
    rgba(14, 165, 233, 0.1)
  ) !important;
  border-color: rgba(34, 211, 238, 0.3) !important;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.15);
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.card,
.intel-card,
.audit-row,
.incident-card {
  animation: fadeIn 0.4s ease-out;
}

.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 50ms; }
.card:nth-child(3) { animation-delay: 100ms; }
.card:nth-child(4) { animation-delay: 150ms; }
.card:nth-child(5) { animation-delay: 200ms; }

/* ============================================
   BADGES & STATUS
   ============================================ */

.status-badge,
.active-badge,
.type-tag,
.step-tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-micro);
  font-weight: var(--font-weight-black);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.severity-high,
[style*="border-left: 4px solid #ef4444"],
[style*="border-left: 4px solid var(--danger)"] {
  border-left: 4px solid var(--danger) !important;
  background: linear-gradient(
    90deg,
    var(--danger-subtle) 0%,
    transparent 20%
  ) !important;
}

.severity-medium {
  border-left: 4px solid var(--warning) !important;
  background: linear-gradient(
    90deg,
    var(--warning-subtle) 0%,
    transparent 20%
  ) !important;
}

.severity-low {
  border-left: 4px solid var(--brand-primary) !important;
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 640px) {
  :root {
    --font-display: 2.5rem;
    --font-h1: 1.875rem;
    --font-h2: 1.5rem;
  }
}

@media (max-width: 480px) {
  .card,
  .intel-card {
    padding: var(--space-4) !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .main-footer,
  .site-header-container,
  .btn,
  button {
    display: none !important;
  }

  .card {
    page-break-inside: avoid;
  }
}