/* Modern CSS Masterclass-Inspired Global Styles for Sumatman AI */

/* Font imports */
@import url('https://fonts.googleapis.com/css2?family=Advent+Pro:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* CSS Variables following modern design system patterns */
:root {
  /* HSL-based Color System inspired by CSS Masterclass */
  --brand-h: 90;
  --brand-s: 15%;
  --brand-l: 55%;
  --brand: hsl(var(--brand-h) var(--brand-s) var(--brand-l));
  --brand-bg: hsl(var(--brand-h) var(--brand-s) 10%);
  
  /* Semantic Color Variations */
  --first-h: 120;
  --first-s: 30%;
  --first-l: 50%;
  --first: hsl(var(--first-h) var(--first-s) var(--first-l));
  --first-bg: hsl(var(--first-h) var(--first-s) 8%);
  
  --second-h: 200;
  --second-s: 40%;
  --second-l: 60%;
  --second: hsl(var(--second-h) var(--second-s) var(--second-l));
  --second-bg: hsl(var(--second-h) var(--second-s) 12%);
  
  --third-h: 280;
  --third-s: 35%;
  --third-l: 55%;
  --third: hsl(var(--third-h) var(--third-s) var(--third-l));
  --third-bg: hsl(var(--third-h) var(--third-s) 10%);
  
  --fourth-h: 30;
  --fourth-s: 45%;
  --fourth-l: 65%;
  --fourth: hsl(var(--fourth-h) var(--fourth-s) var(--fourth-l));
  --fourth-bg: hsl(var(--fourth-h) var(--fourth-s) 12%);
  
  --fifth-h: 350;
  --fifth-s: 40%;
  --fifth-l: 60%;
  --fifth: hsl(var(--fifth-h) var(--fifth-s) var(--fifth-l));
  --fifth-bg: hsl(var(--fifth-h) var(--fifth-s) 10%);
  
  --sixth-h: 180;
  --sixth-s: 35%;
  --sixth-l: 58%;
  --sixth: hsl(var(--sixth-h) var(--sixth-s) var(--sixth-l));
  --sixth-bg: hsl(var(--sixth-h) var(--sixth-s) 11%);
  
  --seventh-h: 60;
  --seventh-s: 38%;
  --seventh-l: 62%;
  --seventh: hsl(var(--seventh-h) var(--seventh-s) var(--seventh-l));
  --seventh-bg: hsl(var(--seventh-h) var(--seventh-s) 13%);
  
  /* Dark theme foundation */
  --dark: hsl(210deg 20% 10%);
  --light: hsl(210deg 20% 98%);
  
  /* Force Dark Mode Colors - Light mode removed */
  --color-canvas-default: var(--dark);
  --color-canvas-subtle: hsl(210deg 20% 12%);
  --color-canvas-inset: hsl(210deg 20% 8%);
  --color-border-default: hsl(210deg 20% 20%);
  --color-border-muted: hsl(210deg 20% 15%);
  --color-fg-default: var(--light);
  --color-fg-muted: hsl(210deg 20% 70%);
  --color-fg-subtle: hsl(210deg 20% 60%);
  --color-accent-fg: var(--brand);
  --color-accent-emphasis: hsl(var(--brand-h) var(--brand-s) 65%);
  --color-success-fg: var(--first);
  --color-danger-fg: var(--fifth);
  --color-warning-fg: var(--fourth);


  /* Typography - Modern font system */
  --font-family-title: 'Advent Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-family-content: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-family-other: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', monospace;
  
  /* Fluid Typography Scale */
  --font-size-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8rem);
  --font-size-sm: clamp(0.875rem, 0.8rem + 0.3vw, 0.95rem);
  --font-size-base: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
  --font-size-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  --font-size-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --font-size-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --font-size-3xl: clamp(1.875rem, 1.5rem + 1.5vw, 2.5rem);
  --font-size-4xl: clamp(2.25rem, 1.8rem + 2vw, 3rem);

  /* Spacing - Modern 4px grid system */
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem;  /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem;    /* 16px */
  --space-5: 1.25rem; /* 20px */
  --space-6: 1.5rem;  /* 24px */
  --space-8: 2rem;    /* 32px */
  --space-10: 2.5rem; /* 40px */
  --space-12: 3rem;   /* 48px */
  --space-16: 4rem;   /* 64px */

  /* Border radius - Modern rounded corners */
  --border-radius: 0.5rem;
  --border-radius-sm: 0.25rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;
  --border-radius-full: 9999px;

  /* Shadows - Layered depth system */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
  
  /* Animation & Transitions */
  --duration: 250ms;
  --duration-fast: 150ms;
  --duration-slow: 350ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Force Dark Mode - System theme detection removed */
/* All styles are now consistently dark mode */

/* Modern Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.5;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family-content);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-fg-default);
  background-color: var(--color-canvas-default);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--duration) var(--ease);
}

/* Modern scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-canvas-subtle);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-default);
  border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-fg-muted);
}

/* Modern Typography System */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-title);
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--color-fg-default);
  letter-spacing: -0.025em;
  transition: color var(--duration) var(--ease);
}

h1 {
  font-size: var(--font-size-4xl);
  font-weight: 700;
  line-height: 1.1;
}

h2 {
  font-size: var(--font-size-3xl);
  font-weight: 600;
  line-height: 1.15;
}

h3 {
  font-size: var(--font-size-2xl);
  font-weight: 600;
}

h4 {
  font-size: var(--font-size-xl);
  font-weight: 600;
}

h5 {
  font-size: var(--font-size-lg);
  font-weight: 500;
}

h6 {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

p {
  font-family: var(--font-family-content);
  font-size: var(--font-size-base);
  line-height: 1.7;
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--color-fg-default);
}

/* Text utilities */
.text-gradient {
  background: linear-gradient(135deg, var(--brand), var(--second), var(--third));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
  animation: gradient-shift 6s ease-in-out infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Links */
a {
  color: var(--color-accent-fg);
  text-decoration: none;
  font-family: var(--font-family-content);
}

a:hover {
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--color-accent-emphasis);
  outline-offset: -2px;
}

/* GitHub profile links */
.github-profile-link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-family-other);
  font-size: 12px;
  color: var(--color-fg-muted);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: var(--border-radius-small);
  transition: background-color 0.2s ease;
}

.github-profile-link:hover {
  background-color: var(--color-canvas-subtle);
  text-decoration: none;
  color: var(--color-accent-fg);
}

.github-profile-link::before {
  content: "@";
  margin-right: 2px;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* Header */
.header {
  background-color: transparent;
  border-bottom: 1px solid var(--color-border-default);
  padding: var(--space-3) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  display: flex;
  align-items: center;
  font-family: var(--font-family-title);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-fg-default);
  text-decoration: none;
}

.logo span {
  font-family: var(--font-family-title) !important;
  font-weight: 600 !important;
}

.logo-icon {
  width: 32px;
  height: 32px;
  margin-right: var(--space-2);
  border-radius: var(--border-radius-small);
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-link {
  font-family: var(--font-family-other);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-fg-default);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius-medium);
  transition: background-color 0.2s ease;
}

.nav-link:hover {
  background-color: var(--color-canvas-subtle);
  text-decoration: none;
}

/* Main content */
.main-content {
  padding: var(--space-5) 0;
}

/* Modern Card System */
.card {
  background: var(--color-canvas-default);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-default);
  border-radius: var(--border-radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow);
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-border-muted);
}

.card:hover::before {
  opacity: 1;
}

.card-interactive {
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
}

.card-interactive:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-2xl);
}

.card-interactive:active {
  transform: translateY(-1px) scale(1.01);
}

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

.card-title {
  font-family: var(--font-family-title);
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  color: var(--color-fg-default);
}

.card-meta {
  font-family: var(--font-family-content);
  font-size: var(--font-size-xs);
  color: var(--color-fg-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.badge {
    display: inline-block;
    padding: .25em .4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25rem;
    color: #fff;
    background-color: var(--color-accent-fg);
}

.card-content {
  font-family: var(--font-family-content);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-fg-default);
}

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-muted);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Card variants */
.card-glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-gradient {
  background: linear-gradient(135deg, 
    var(--color-canvas-default), 
    var(--color-canvas-subtle)
  );
}

/* Modern Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-family-content);
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1;
  color: var(--color-fg-default);
  background-color: var(--color-canvas-subtle);
  border: 1px solid var(--color-border-default);
  border-radius: var(--border-radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation;
}

.btn:hover {
  background-color: var(--color-canvas-inset);
  border-color: var(--color-fg-muted);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent-emphasis);
  outline-offset: 2px;
}

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--brand), hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 10%)));
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) + 5%)), var(--brand));
  border-color: hsl(var(--brand-h) var(--brand-s) calc(var(--brand-l) - 5%));
  box-shadow: var(--shadow-xl);
}

.btn-ghost {
  background-color: transparent;
  border-color: transparent;
  color: var(--color-fg-muted);
}

.btn-ghost:hover {
  background-color: var(--color-canvas-subtle);
  color: var(--color-fg-default);
}

/* Button sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

/* Forms */
.form-group {
  margin-bottom: var(--space-3);
}

.form-label {
  display: block;
  font-family: var(--font-family-other);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-fg-default);
  margin-bottom: var(--space-1);
}

.form-control {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-family-content);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-fg-default);
  background-color: var(--color-canvas-default);
  border: 1px solid var(--color-border-default);
  border-radius: var(--border-radius-medium);
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--color-accent-emphasis);
  outline: 2px solid var(--color-accent-emphasis);
  outline-offset: -2px;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Alerts */
.alert {
  padding: var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--border-radius-medium);
  margin-bottom: var(--space-3);
  font-family: var(--font-family-content);
}

.alert-success {
  color: var(--color-success-fg);
  background-color: rgba(26, 127, 55, 0.1);
  border-color: rgba(26, 127, 55, 0.2);
}

.alert-warning {
  color: var(--color-warning-fg);
  background-color: rgba(154, 103, 0, 0.1);
  border-color: rgba(154, 103, 0, 0.2);
}

.alert-danger {
  color: var(--color-danger-fg);
  background-color: rgba(209, 36, 47, 0.1);
  border-color: rgba(209, 36, 47, 0.2);
}

/* Utility classes */
.text-muted {
  color: var(--color-fg-muted) !important;
}

.text-small {
  font-size: 12px !important;
}

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

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-1) !important; }
.mt-2 { margin-top: var(--space-2) !important; }
.mt-3 { margin-top: var(--space-3) !important; }
.mt-4 { margin-top: var(--space-4) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-1) !important; }
.mb-2 { margin-bottom: var(--space-2) !important; }
.mb-3 { margin-bottom: var(--space-3) !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }

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

/* Modern Loading States & Animations */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.skeleton {
  background: linear-gradient(
    110deg, 
    var(--color-canvas-subtle) 8%, 
    var(--color-canvas-inset) 18%, 
    var(--color-canvas-subtle) 33%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--border-radius);
}

@keyframes skeleton-pulse {
  0% { 
    background-position: 200% 0; 
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
  100% { 
    background-position: -200% 0; 
    opacity: 1;
  }
}

/* Modern Animation Utilities */
.animate-fade-in {
  animation: fade-in var(--duration) var(--ease);
}

.animate-slide-up {
  animation: slide-up var(--duration) var(--ease);
}

.animate-scale-in {
  animation: scale-in var(--duration) var(--ease-back);
}

.animate-bounce {
  animation: bounce 1s ease-in-out infinite;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Hover animations */
.hover-lift {
  transition: transform var(--duration) var(--ease);
}

.hover-lift:hover {
  transform: translateY(-4px);
}

.hover-glow {
  position: relative;
  transition: all var(--duration) var(--ease);
}

.hover-glow::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, var(--brand), var(--second), var(--third), var(--fourth));
  border-radius: inherit;
  opacity: 0;
  z-index: -1;
  transition: opacity var(--duration) var(--ease);
}

.hover-glow:hover::before {
  opacity: 0.7;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes scale-in {
  from { 
    opacity: 0; 
    transform: scale(0.9); 
  }
  to { 
    opacity: 1; 
    transform: scale(1); 
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(-5%); }
  50% { transform: translateY(0); }
}

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

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

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-2);
  }
  
  .header-content {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .nav {
    gap: var(--space-2);
  }
  
  .card {
    padding: var(--space-3);
  }
  
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  h3 { font-size: 18px; }
}

@media (max-width: 480px) {
  html { font-size: 13px; }
  
  .card {
    padding: var(--space-2);
  }
  
  .btn {
    padding: 6px 12px;
    font-size: 13px;
  }
}