/* DataIntell Design System v1.0
 * Enterprise UI/UX for AI-enabled data platforms
 * Modern, futuristic, premium aesthetic
 */

:root {
  /* Colors - Base Palette */
  --ink: #ffffff;
  --panel: #f2f5fb;
  --panel2: #e5ecf7;
  --line: #c8d8ed;
  --txt: #0a1428;
  --dim: #3d5f8f;
  --faint: #6b8bb5;
  --steel: #4c9aff;
  --amber: #f0a202;
  --moss: #4caf7d;
  --rust: #e5644a;

  /* Extended Colors */
  --steel-dark: #3d7fd9;
  --steel-darker: #2e5fa8;
  --steel-light: #e5f0ff;
  --moss-dark: #3a8a62;
  --moss-light: #e5f5ed;
  --rust-light: #ffe5e0;
  --amber-light: #fff4e5;

  /* Typography */
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Fira Code", "Monaco", monospace;

  /* Spacing Scale */
  --space-0: 0;
  --space-1: 2px;
  --space-2: 4px;
  --space-3: 8px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 20px;
  --space-8: 24px;
  --space-10: 32px;
  --space-12: 40px;
  --space-16: 48px;
  --space-20: 64px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;

  /* Shadows - Enterprise depth */
  --shadow-xs: 0 1px 2px rgba(10, 20, 40, 0.05);
  --shadow-sm: 0 2px 4px rgba(10, 20, 40, 0.08);
  --shadow-md: 0 4px 8px rgba(10, 20, 40, 0.1);
  --shadow-lg: 0 8px 16px rgba(10, 20, 40, 0.12);
  --shadow-xl: 0 12px 24px rgba(10, 20, 40, 0.15);
  --shadow-2xl: 0 20px 40px rgba(10, 20, 40, 0.2);
  --shadow-inner: inset 0 2px 4px rgba(10, 20, 40, 0.08);

  /* Gradients - Futuristic accents */
  --gradient-steel: linear-gradient(135deg, #4c9aff 0%, #3d7fd9 100%);
  --gradient-moss: linear-gradient(135deg, #4caf7d 0%, #3a8a62 100%);
  --gradient-dark: linear-gradient(135deg, #0a1428 0%, #1a2d4d 100%);
  --gradient-subtle: linear-gradient(180deg, #f2f5fb 0%, #e5ecf7 100%);

  /* Motion */
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
  --easing: cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal: 400;
  --z-tooltip: 600;

  /* Layout */
  --container-max: 1440px;
  --sidebar-width: 280px;
  --header-height: 64px;
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--txt);
  background: var(--ink);
  overflow-x: hidden;
}

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

h1 {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -1px;
  color: var(--txt);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.7px;
  color: var(--txt);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.33;
  letter-spacing: -0.5px;
  color: var(--txt);
  margin-bottom: var(--space-4);
}

h4 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.3px;
  color: var(--txt);
  margin-bottom: var(--space-3);
}

h5 {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--txt);
  margin-bottom: var(--space-3);
}

h6 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.57;
  letter-spacing: 0.2px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-4);
  max-width: 75ch;
  line-height: 1.6;
}

small {
  font-size: 12px;
  line-height: 1.33;
  letter-spacing: 0.3px;
  color: var(--faint);
}

/* ============================================================================
   LINKS & INTERACTIVE
   ============================================================================ */

a {
  color: var(--steel);
  text-decoration: none;
  transition: color var(--duration-base) var(--easing);
  border-radius: var(--radius-sm);
  outline-offset: 2px;
}

a:hover {
  color: var(--steel-dark);
}

a:focus-visible {
  outline: 2px solid var(--steel);
}

a:active {
  color: var(--steel-darker);
}

/* ============================================================================
   BUTTONS - Premium enterprise style
   ============================================================================ */

button,
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: var(--space-4) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-base) var(--easing);
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  white-space: nowrap;
  text-decoration: none;
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--steel);
}

/* Primary Button */
.btn-primary,
button[type="submit"] {
  background: var(--steel);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover,
button[type="submit"]:hover {
  background: var(--steel-dark);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active,
button[type="submit"]:active {
  background: var(--steel-darker);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled,
button[type="submit"]:disabled {
  background: var(--line);
  color: var(--faint);
  cursor: not-allowed;
  box-shadow: none;
}

/* Secondary Button */
.btn-secondary {
  background: var(--panel);
  color: var(--txt);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: var(--panel2);
  border-color: var(--steel);
}

.btn-secondary:active {
  background: var(--line);
}

.btn-secondary:disabled {
  background: var(--panel);
  color: var(--faint);
  border-color: var(--line);
  cursor: not-allowed;
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--steel);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: var(--panel);
  border-color: var(--steel);
}

.btn-ghost:active {
  background: var(--panel2);
}

/* Icon Button */
.btn-icon {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

/* ============================================================================
   INPUTS & FORM CONTROLS
   ============================================================================ */

input,
textarea,
select {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--txt);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  transition: border-color var(--duration-base) var(--easing),
              box-shadow var(--duration-base) var(--easing);
  outline-offset: 2px;
}

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

input:hover,
textarea:hover,
select:hover {
  border-color: var(--dim);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--steel);
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(76, 154, 255, 0.1);
}

input:disabled,
textarea:disabled,
select:disabled {
  background: var(--panel);
  color: var(--faint);
  cursor: not-allowed;
  border-color: var(--line);
}

/* Form Groups */
.form-group {
  margin-bottom: var(--space-6);
}

label {
  display: block;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: var(--space-2);
  color: var(--txt);
}

.form-help {
  font-size: 12px;
  color: var(--faint);
  margin-top: var(--space-2);
}

.form-error {
  font-size: 12px;
  color: var(--rust);
  margin-top: var(--space-2);
}

/* ============================================================================
   CARDS - Modern, layered design
   ============================================================================ */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-base) var(--easing);
}

.card:hover {
  border-color: var(--steel);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--txt);
}

.card-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--dim);
}

.card-footer {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}

/* ============================================================================
   BADGES & TAGS
   ============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: 1px solid;
}

.badge-primary {
  background: var(--steel-light);
  color: var(--steel-darker);
  border-color: #b3d9ff;
}

.badge-success {
  background: var(--moss-light);
  color: var(--moss-dark);
  border-color: #a8e6c9;
}

.badge-warning {
  background: var(--amber-light);
  color: #b87d1a;
  border-color: #ffd699;
}

.badge-error {
  background: var(--rust-light);
  color: #8a2e1f;
  border-color: #ffb3a0;
}

/* ============================================================================
   ALERTS & NOTIFICATIONS
   ============================================================================ */

.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.alert-info {
  background: #e5f0ff;
  border-left-color: var(--steel);
  color: var(--steel-darker);
}

.alert-success {
  background: var(--moss-light);
  border-left-color: var(--moss);
  color: var(--moss-dark);
}

.alert-warning {
  background: var(--amber-light);
  border-left-color: var(--amber);
  color: #b87d1a;
}

.alert-error {
  background: var(--rust-light);
  border-left-color: var(--rust);
  color: #8a2e1f;
}

/* ============================================================================
   TABLES - Data-centric design
   ============================================================================ */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--panel);
  border-bottom: 2px solid var(--line);
}

th {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.2px;
}

td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
  color: var(--txt);
}

tbody tr:hover {
  background: var(--panel);
}

/* ============================================================================
   CONTAINERS & LAYOUT
   ============================================================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.grid {
  display: grid;
  gap: var(--space-5);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ============================================================================
   HEADER & NAVIGATION
   ============================================================================ */

header,
nav {
  background: var(--ink);
  border-bottom: 1px solid var(--line);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  box-shadow: var(--shadow-sm);
}

nav a {
  padding: var(--space-4) var(--space-5);
  color: var(--dim);
  font-weight: 500;
  transition: color var(--duration-base) var(--easing),
              background var(--duration-base) var(--easing);
  border-radius: var(--radius-md);
}

nav a:hover {
  color: var(--steel);
  background: var(--panel);
}

nav a.active {
  color: var(--steel);
  background: var(--panel2);
  font-weight: 600;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

.sidebar {
  width: var(--sidebar-width);
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: var(--space-6);
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  color: var(--dim);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--duration-base) var(--easing);
  font-size: 14px;
}

.sidebar-item:hover {
  background: var(--panel2);
  color: var(--steel);
}

.sidebar-item.active {
  background: var(--steel);
  color: var(--ink);
  font-weight: 600;
}

/* ============================================================================
   DATA VISUALIZATION & STATS
   ============================================================================ */

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--steel);
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-bar {
  height: 8px;
  background: var(--line);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: var(--space-3) 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-steel);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--easing);
}

/* ============================================================================
   MODALS & OVERLAYS
   ============================================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 20, 40, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn var(--duration-base) var(--easing);
}

.modal {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--duration-base) var(--easing);
}

.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--line);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

/* ============================================================================
   ANIMATIONS & TRANSITIONS
   ============================================================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.fade-in {
  animation: fadeIn var(--duration-base) var(--easing);
}

.slide-up {
  animation: slideUp var(--duration-base) var(--easing);
}

.slide-in {
  animation: slideIn var(--duration-base) var(--easing);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.text-primary { color: var(--txt); }
.text-secondary { color: var(--dim); }
.text-tertiary { color: var(--faint); }
.text-steel { color: var(--steel); }
.text-success { color: var(--moss); }
.text-warning { color: var(--amber); }
.text-error { color: var(--rust); }

.bg-panel { background: var(--panel); }
.bg-panel2 { background: var(--panel2); }
.bg-steel { background: var(--steel); }
.bg-success { background: var(--moss); }
.bg-warning { background: var(--amber); }
.bg-error { background: var(--rust); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-5 { margin: var(--space-5); }
.m-6 { margin: var(--space-6); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  h1 { font-size: 28px; }
  h2 { font-size: 24px; }
  h3 { font-size: 20px; }

  .card { padding: var(--space-4); }
  .modal { max-width: 95%; }

  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    transition: left var(--duration-base) var(--easing);
    z-index: var(--z-fixed);
  }

  .sidebar.active {
    left: 0;
  }
}

@media (max-width: 480px) {
  body { font-size: 13px; }
  
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  h3 { font-size: 18px; }

  .card { padding: var(--space-3); }
  
  button, .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
