:root {
  --bg-dark: #0a0514;
  --bg-dark-card: rgba(18, 10, 32, 0.65);
  --color-primary: #7c3aed;
  --color-secondary: #c084fc;
  --color-accent: #22d3ee;
  --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #ec4899 100%);
  --accent-gradient: linear-gradient(135deg, #22d3ee 0%, #3b82f6 100%);
  --white-5: rgba(255, 255, 255, 0.05);
  --white-10: rgba(255, 255, 255, 0.1);
  --white-15: rgba(255, 255, 255, 0.15);
  --white-20: rgba(255, 255, 255, 0.2);
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
}

/* Base Reset & Global Classes */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Custom Sleek Dark/Purple Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(10, 5, 20, 0.6);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: rgba(147, 51, 234, 0.4);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.7);
}

body {
  background-color: var(--bg-dark);
  font-family: var(--font-body);
  color: #e2e8f0;
  min-height: 100vh;
}

.bg-dark { background-color: var(--bg-dark); }
.bg-dark-80 { background-color: rgba(18, 10, 32, 0.8); }
.bg-dark-50 { background-color: rgba(18, 10, 32, 0.5); }
.text-light { color: #e2e8f0; }

.border-white-5 { border-color: var(--white-5); }
.border-white-10 { border-color: var(--white-10); }
.border-white-15 { border-color: var(--white-15); }
.border-white-20 { border-color: var(--white-20); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  letter-spacing: -0.02em;
}

/* Background Glow Effects */
.glow-bg {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.25;
}

.glow-1 {
  width: 400px;
  height: 400px;
  background: var(--color-primary);
  top: -100px;
  right: -50px;
}

.glow-2 {
  width: 500px;
  height: 500px;
  background: #3b82f6;
  bottom: -200px;
  left: -100px;
}

.glow-3 {
  width: 300px;
  height: 300px;
  background: #ec4899;
  top: 40%;
  left: 30%;
  opacity: 0.1;
}

/* Text & Gradient Utilities */
.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bg-primary-gradient {
  background: var(--primary-gradient);
}

/* Glassmorphism Panels */
.glass {
  background: var(--bg-dark-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-hover:hover {
  transform: translateY(-4px);
  border-color: var(--white-20);
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.1);
}

/* Inputs & Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 2px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  color: #64748b;
  font-size: 1rem;
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--white-10);
  border-radius: 12px;
  padding: 12px 16px 12px 48px;
  color: white;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.15);
}

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

select.form-control {
  appearance: none;
  cursor: pointer;
}

select.form-control option {
  background-color: #120a20;
  color: white;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-title);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.4);
  filter: brightness(1.1);
}

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

.btn-secondary {
  background: var(--white-5);
  border: 1px solid var(--white-10);
  color: white;
}

.btn-secondary:hover {
  background: var(--white-10);
  border-color: var(--white-20);
}

/* Grid & Layout */
.app-container {
  min-height: calc(100vh - 180px);
}

/* Custom Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 5, 20, 0.8);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  width: 90%;
  max-width: 500px;
  border-radius: 24px;
  padding: 24px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.25rem;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: white;
}

/* Tabs */
.tab-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-weight: 600;
  font-family: var(--font-title);
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 10px;
  font-size: 0.9rem;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn.active {
  background: var(--white-10);
  color: white;
  border: 1px solid var(--white-10);
}

.tab-btn:hover:not(.active) {
  color: #f1f5f9;
  background: var(--white-5);
}

.subtab-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.subtab-btn.active {
  background: rgba(192, 132, 252, 0.15);
  color: var(--color-secondary);
  border: 1px solid rgba(192, 132, 252, 0.2);
}

/* Viewport Controls */
.viewport-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.viewport-btn.active {
  color: var(--color-accent);
  background: rgba(34, 211, 238, 0.1);
}

.viewport-btn:hover:not(.active) {
  color: white;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 5, 20, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.premium-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--white-10);
  border-top-color: var(--color-primary);
  border-right-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* History Items */
.history-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--white-5);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--white-15);
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 70%;
}

.history-name {
  font-weight: 600;
  color: white;
  font-size: 0.95rem;
}

.history-sector {
  font-size: 0.75rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-actions {
  display: flex;
  gap: 6px;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #94a3b8;
}

.action-btn-view {
  background: rgba(34, 211, 238, 0.1);
  color: var(--color-accent);
}

.action-btn-view:hover {
  background: rgba(34, 211, 238, 0.25);
  color: white;
}

.action-btn-external {
  background: rgba(124, 58, 237, 0.1);
  color: var(--color-secondary);
}

.action-btn-external:hover {
  background: rgba(124, 58, 237, 0.25);
  color: white;
}

.action-btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
}

.action-btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: white;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(18, 10, 32, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--white-15);
  padding: 12px 20px;
  border-radius: 14px;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Scorecard Table Styles */
.score-badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.8rem;
}
.score-high { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.score-mid { background: rgba(234, 179, 8, 0.15); color: #facc15; }
.score-low { background: rgba(239, 68, 68, 0.15); color: #f87171; }
