/* =============================================
   DESIGN TOKENS
============================================= */
:root {
  /* Colors - Dark Slate Theme */
  --primary: #000000;
  --primary-hover: #000000;
  --secondary: #000000;
  --secondary-hover: #000000;
  
  /* Backgrounds */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  
  /* Text */
  --text-dark: #000000;
  --text-mid: #000000;
  --text-light: #000000;
  --text-white: #ffffff;

  /* Borders */
  --border: #000000;
  --border-hover: #000000;

  /* Status */
  --success: #10b981;
  --success-bg: #d1fae5;
  --error: #ef4444;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  
  /* Spacing */
  --gap-sm: 0.5rem;
  --gap-md: 1rem;
  --gap-lg: 1.5rem;
  --gap-xl: 2rem;
  
  /* Shadows */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* =============================================
   BASE RESET
============================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'fp-head-pro', -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--bg-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

[x-cloak] {
  display: none !important;
}

/* =============================================
   MAIN CONTENT
============================================= */
.main-content {
  flex: 1;
  padding: 3rem 1rem;
  background: linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
  min-height: calc(100vh - 200px);
}

/* =============================================
   PAGE HEADER
============================================= */
.header {
  text-align: center;
  max-width: 1000px;
  margin: 0 auto 3rem auto;
  padding: 0 1rem;
}

.header h1 {
  font-family: 'fp-head-pro', sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 1000;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.header p {
  font-size: 1.125rem;
  color: var(--text-mid);
  line-height: 1.7;
  max-width: 800px;
  margin: 0 auto;
}

/* =============================================
   CARDS - HOME PAGE
============================================= */
.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1rem;
}

.card {
  background: var(--bg-card);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.card h2 {
  font-family: 'fp-head-pro', sans-serif;
  font-weight: 800;
  font-size: 2.25rem;
  color: var(--primary);
  text-align: center;
  margin-bottom: 1.5rem;
}

.card-description {
  flex-grow: 1;
  margin-bottom: 2rem;
}

.card-description p {
  font-size: 1rem;
  color: var(--text-mid);
  line-height: 1.7;
}

.card-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* =============================================
   PIPELINE CARDS - ANALYSIS PAGES
============================================= */
.pipeline-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 0 1rem;
}

.pipeline-card {
  background: var(--bg-card);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: all 0.3s ease;
}

.pipeline-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

.pipeline-card h2 {
  font-family: 'fp-head-pro', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--primary);
  text-align: center;
  margin: 0;
}

.pipeline-card p {
  font-size: 0.875rem;
  color: var(--text-mid);
  line-height: 1.6;
  margin: 0;
}

/* POOL page - single column */
#pool-page .pipeline-container {
  max-width: 600px;
  grid-template-columns: 1fr;
}

.centered-title {
  text-align: center;
}

/* =============================================
   BUTTONS
============================================= */
.fancy-btn {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
  min-width: 140px;
  position: relative;
  overflow: hidden;
  z-index: 1; /* ADD THIS */
}

.fancy-btn span {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--primary-hover);
  z-index: -1; /* CHANGE FROM 0 TO -1 */
  transition: left 0.3s ease;
}

.fancy-btn > *:not(span) {
  position: relative;
  z-index: 1;
}

.fancy-btn:hover {
  background: var(--primary-hover);
  color: var(--text-white);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.fancy-btn:hover span {
  left: 0;
}

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

.fancy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.dual-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.dual-buttons .fancy-btn {
  flex: 1;
  min-width: 120px;
}

/* =============================================
   FILE INPUTS
============================================= */
.input-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group label.input-label {
  font-family: 'fp-head-pro', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
}

input[type="file"] {
  display: none;
}

.custom-file-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--secondary);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-file-upload:hover {
  background: var(--secondary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.custom-file-upload::before {
  content: "📁";
  font-size: 1rem;
}

#selectedFileName,
#selectedProcessFileName,
#selectedVisualFileName,
#selectedPoolFileName {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-input);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-mid);
  font-style: italic;
  text-align: center;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#selectedFileName:empty,
#selectedProcessFileName:empty,
#selectedVisualFileName:empty,
#selectedPoolFileName:empty {
  display: none;
}

/* =============================================
   DROPDOWN
============================================= */
.dropdown-wrapper {
  position: relative;
  width: 100%;
}

.dropdown-button {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg-card);
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: inherit;
}

.dropdown-button:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.dropdown-button::after {
  content: "▾";
  color: var(--text-light);
  transition: transform 0.2s ease;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: 0.5rem;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 0.25rem 0;
}

.dropdown-menu label {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.15s ease;
}

.dropdown-menu label:hover {
  background: var(--bg-input);
}

.dropdown-menu input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.dropdown-menu::-webkit-scrollbar {
  width: 8px;
}

.dropdown-menu::-webkit-scrollbar-thumb {
  background: var(--text-light);
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

/* =============================================
   MODALS
============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1050;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: 1rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  position: relative;
  transform: scale(0.9) translateY(-20px);
  opacity: 0;
  transition: all 0.3s ease;
}

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

.modal-content h2 {
  font-family: 'fp-head-pro', sans-serif;
  font-weight: 800;
  font-size: 1.875rem;
  color: var(--primary);
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-content p {
  font-size: 1rem;
  color: var(--text-mid);
  line-height: 1.7;
  text-align: center;
  margin-bottom: 1rem;
}

.modal-content ul {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.modal-content ul li {
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-input);
  border-radius: 0.5rem;
  border-left: 3px solid var(--primary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.modal-content ul li b,
.modal-content ul li strong {
  color: var(--text-dark);
  font-weight: 600;
}

.modal-content ul li code {
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--primary);
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  color: var(--text-light);
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #fee2e2;
  color: var(--error);
  border-color: var(--error);
  transform: rotate(90deg);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.modal-actions button {
  padding: 0.875rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 9999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 140px;
  transition: all 0.2s ease;
}

.modal-actions button:hover:enabled {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.modal-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================
   LOADING STATES
============================================= */
.processing-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--info-bg);
  border-radius: 0.5rem;
  color: var(--info);
  font-weight: 500;
  margin: 1.5rem 0;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-top-color: var(--info);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.success-status {
  background: var(--success-bg);
  color: var(--success);
}

.success-status .loading-spinner {
  display: none;
}

.error-status {
  background: #fee2e2;
  color: #dc2626;
}

.error-status .loading-spinner {
  display: none;
}

/* =============================================
   TOAST NOTIFICATIONS
============================================= */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-dark);
  color: white;
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 1060;
  opacity: 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast::before {
  content: "✓";
  width: 20px;
  height: 20px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.hidden {
  display: none;
}

/* =============================================
   RESPONSIVE
============================================= */
@media (max-width: 1024px) {
  .pipeline-container,
  .card-container {
    grid-template-columns: 1fr;
    max-width: 600px;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 2rem 0.5rem;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .header p {
    font-size: 1rem;
  }
  
  .card,
  .pipeline-card {
    padding: 1.5rem;
  }
  
  .modal-content {
    padding: 1.5rem;
    width: 95%;
  }
  
  .dual-buttons,
  .card-buttons {
    flex-direction: column;
  }
  
  .dual-buttons .fancy-btn,
  .card-buttons .fancy-btn {
    width: 100%;
  }
}

/* =============================================
   ACCESSIBILITY
============================================= */
.fancy-btn:focus-visible,
.custom-file-upload:focus-visible,
.dropdown-button:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============================================
   NAVIGATION RESPONSIVE
============================================= */
@media (min-width: 1024px) {
  nav [x-ref="desktopNav"] {
    display: block !important;
  }
  
  nav button[aria-label="Toggle navigation"] {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  nav [x-ref="desktopNav"] {
    display: none !important;
  }
  
  nav button[aria-label="Toggle navigation"] {
    display: block !important;
  }
}