/* Neuroenergia + Apple Modern UI Theme */

:root {
  /* Brand Colors - Neuroenergia Blue */
  --primary-color: #2563EB;
  /* Bright Royal Blue */
  --primary-dark: #1D4ED8;
  /* Deep Blue for Hover */
  --primary-light: #60A5FA;
  /* Light Blue Accent */
  --secondary-color: #273A4B;
  /* Pickled Bluewood (unchanged) */
  --secondary-dark: #1A2834;
  --accent-color: #2563EB;
  /* Using primary as accent */

  /* Apple-style Neutrals */
  --text-primary: #1D1D1F;
  --text-secondary: #86868B;
  --text-light: #9E9E9E;
  --bg-body: #F5F5F7;
  /* Apple Light Grey */
  --bg-surface: #FFFFFF;
  --bg-secondary: #F5F5F7;
  --border-color: #D2D2D7;

  /* Shadows - Soft & Diffused */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.12);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Transitions */
  --transition-base: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Base Styles */
body {
  background: var(--bg-body);
  /* Prioritize Inter, then System UI, then Apple System */
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Cards - Apple Style */
.card,
.apple-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.02);
  /* Very subtle border */
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition-base);
}

.card:hover,
.apple-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Buttons - Pills & Soft Rectangles */
.btn {
  border-radius: var(--radius-md);
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  letter-spacing: -0.01em;
  border: none;
  transition: var(--transition-base);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-primary {
  background-color: var(--primary-color) !important;
  color: white !important;
}

.btn-primary:hover {
  background-color: var(--primary-dark) !important;
  /* Updated shadow color to match blue (37, 99, 235) */
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
  background-color: var(--bg-body) !important;
  color: var(--text-primary) !important;
}

.btn-secondary:hover {
  background-color: #E8E8ED !important;
  /* Slightly darker grey */
}

/* Sidebar - Modern Glass/Clean */
#sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  width: 280px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  padding: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

/* Sidebar Navigation */
.sidebar-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: var(--transition-base);
}

.sidebar-link:hover {
  background-color: var(--bg-body);
  color: var(--text-primary) !important;
}

.sidebar-link.active,
.sidebar-link.active:hover {
  background-color: var(--primary-color) !important;
  color: #ffffff !important;
  font-weight: 600;
}

/* Explicitly target children to ensure white color */
.sidebar-link.active *,
.sidebar-link.active:hover * {
  color: #ffffff !important;
}

.sidebar-link.active i {
  color: #ffffff !important;
}

.sidebar-section-title {
  color: var(--text-light);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  padding-left: 1rem;
}

/* Header/Navbar */
.app-header {
  background: transparent;
  /* Clean look */
  padding: 1rem 0;
  /* Removing side padding as it's inside wrapper */
  /* margin-left: 280px;  REMOVED: Wrapper handles offset */
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.app-logo {
  height: 48px;
  /* Restrict height */
  width: auto;
  /* Maintain aspect ratio */
  display: block;
}

.app-title {
  font-size: 1.5rem;
  /* Slight reduction for elegance */
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Main Content Area */
.main-content-wrapper {
  margin-left: 280px;
  padding: 2rem 3rem;
  /* Increased side padding for better aesthetic */
  min-height: 100vh;
}

/* Form Controls */
.form-control,
.form-select {
  background-color: var(--bg-body);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  transition: var(--transition-base);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary-color);
  /* Updated shadow color */
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Metrics Cards (Admin Dashboard Style) */
.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.metric-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Tables */
.table {
  width: 100%;
  margin-bottom: 1rem;
  vertical-align: top;
  border-color: var(--border-color);
}

.table th {
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom-width: 1px;
  padding: 1rem;
}

.table td {
  padding: 1rem;
  color: var(--text-primary);
  vertical-align: middle;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #D2D2D7;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #86868B;
}

/* Graphs */
.js-plotly-plot .plotly .main-svg {
  background: transparent !important;
}

/* --- Admin Specific Overrides --- */

/* Glassmorphism Sidebar */
.admin-sidebar {
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* Dash DataTable Styling to match Apple Table */
.dash-spreadsheet-container .dash-spreadsheet-inner th {
  font-weight: 600 !important;
  text-transform: uppercase !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.05em !important;
  color: var(--text-secondary) !important;
  background-color: var(--bg-body) !important;
  border-bottom: 1px solid var(--border-color) !important;
  border-top: none !important;
  padding: 12px 16px !important;
  font-family: inherit !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner td {
  color: var(--text-primary) !important;
  font-size: 0.9rem !important;
  padding: 12px 16px !important;
  font-family: inherit !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td {
  background-color: rgba(0, 0, 0, 0.02) !important;
}

.dash-table-container {
  border-radius: var(--radius-md) !important;
  overflow: hidden !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-sm);
}

/* Nav Link Styling for Admin Sidebar */
.admin-nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  transition: all 0.2s ease;
  border: none !important;
}

.admin-nav-link:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

.admin-nav-link.active {
  background-color: var(--primary-color) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Page Headers */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-weight: 400;
}

/* Electricity Sparks Animation */
.sparks-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
  /* Just above background, below content (zIndex 2) */
  pointer-events: none;
}

.spark {
  position: absolute;
  bottom: -20px;
  width: 4px;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 8px 2px rgba(130, 200, 255, 0.8), 0 0 16px 4px rgba(37, 99, 235, 0.4);
  border-radius: 50%;
  opacity: 0;
  animation-name: flySpark;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes flySpark {
  0% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0;
  }

  15% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }

  100% {
    transform: translateY(-90vh) translateX(40px) scale(0.2);
    opacity: 0;
  }
}

/* Shared Auth Page Animation */
.auth-background {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.auth-particle {
  position: absolute;
  color: rgba(255, 255, 255, 0.4);
  /* Lighten glow effect as requested */
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(130, 200, 255, 0.6);
  animation-name: floatSymbol, blinkEffect;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite;
  z-index: 1;
}

@keyframes blinkEffect {

  0%,
  100% {
    color: rgba(255, 255, 255, 0.3);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  }

  50% {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 20px rgba(255, 255, 255, 1), 0 0 35px rgba(130, 200, 255, 0.9);
  }
}

@keyframes floatSymbol {
  0% {
    transform: translateY(110vh) rotate(0deg) scale(0.8);
    opacity: 0;
  }

  10% {
    opacity: 0.6;
  }

  90% {
    opacity: 0.6;
  }

  100% {
    transform: translateY(-10vh) rotate(360deg) scale(1.2);
    opacity: 0;
  }
}

/* --- Hybrid Apple/Google Cloud Theme Overrides --- */

/* Clean Navbar */
.clean-navbar {
  background-color: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  /* Subtle border */
  transition: background-color 0.4s ease;
}

.clean-nav-link {
  color: #1d1d1f !important;
  /* Apple Text Color */
  font-size: 13px !important;
  /* Apple text size is usually small (~12-14px) and clear */
  font-weight: 500 !important;
  letter-spacing: -0.01em;
  padding: 8px 16px !important;
  transition: color 0.2s ease, opacity 0.2s ease;
  opacity: 0.8;
}

.clean-nav-link:hover {
  color: #06c !important;
  /* Apple Link Blue */
  opacity: 1;
}

/* Hero Section */
.hero-section-clean {
  background-color: #ffffff;
  color: #1d1d1f;
  text-align: center;
  padding: 120px 20px 80px 20px;
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: 56px;
  /* Large Mac-style header */
  line-height: 1.07143;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: #1d1d1f;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 24px;
  line-height: 1.16667;
  font-weight: 400;
  letter-spacing: 0.009em;
  color: #1d1d1f;
  /* Keep dark */
  margin-bottom: 40px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* Apple/Google Style Buttons */
.btn-apple-primary {
  background-color: #0071e3 !important;
  /* Apple Blue */
  color: #ffffff !important;
  border-radius: 980px !important;
  /* Full pill */
  padding: 12px 24px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  letter-spacing: -0.022em;
  border: 1px solid transparent !important;
  transition: all 0.3s cubic-bezier(0, 0, 0.5, 1) !important;
  box-shadow: none !important;
  /* Flat by default */
}

.btn-apple-primary:hover {
  background-color: #0077ed !important;
  transform: scale(1.02);
  /* Subtle growth */
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.3) !important;
}

.btn-apple-secondary {
  background-color: transparent !important;
  color: #06c !important;
  /* Apple Link Blue */
  border-radius: 980px !important;
  padding: 12px 24px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border: 1px solid transparent !important;
}

.btn-apple-secondary:hover {
  text-decoration: underline !important;
  background-color: rgba(0, 113, 227, 0.05) !important;
}

/* Feature Cards - Super Clean */
.clean-card {
  background-color: #f5f5f7;
  /* Apple light gray for contrast against white bg */
  border-radius: 20px;
  padding: 40px;
  height: 100%;
  text-align: left;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: none;
}

.clean-card:hover {
  transform: scale(1.015);
}

.clean-card-icon {
  font-size: 48px;
  margin-bottom: 20px;
  background: -webkit-linear-gradient(45deg, #0071e3, #42a5f5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.clean-card-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1d1d1f;
}

.clean-card-text {
  font-size: 17px;
  line-height: 1.47059;
  font-weight: 400;
  letter-spacing: -0.022em;
  color: #86868b;
}

/* Pricing Section Overrides */
.pricing-card-clean {
  background: white;
  border-radius: 18px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.pricing-card-clean:hover {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  /* Stronger hover shadow */
  transform: translateY(-5px);
}

.pricing-highlight {
  border: 2px solid #0071e3;
  position: relative;
  overflow: hidden;
}

.pricing-badge {
  background-color: #0071e3;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 12px;
  position: absolute;
  top: 20px;
  right: 20px;
}


/* --- Navbar Tweaks --- */

.clean-nav-link {
  font-size: 17px !important;
  /* Increased from 13px */
  font-weight: 500 !important;
  color: #1d1d1f !important;
  padding: 8px 24px !important;
  /* Wider tap target */
  transition: all 0.2s ease;
}

.clean-nav-link.active {
  color: #0071e3 !important;
  /* Apple Blue for active state */
  font-weight: 600 !important;
}

.clean-nav-link:hover {
  color: #0071e3 !important;
  background-color: transparent !important;
  /* Keep background clean */
}


/* --- Clean Auth Overrides --- */
.clean-auth-wrapper {
  background-color: #ffffff !important;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.clean-auth-card {
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  /* Subtle border */
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  max-width: 480px;
  /* Slightly wider for larger text */
  width: 100%;
}

/* Large, Simple Typography Overrides for Auth Pages */
.clean-auth-card h2 {
  font-size: 40px !important;
  /* Large, bold title */
  font-weight: 700 !important;
  color: #1d1d1f !important;
  letter-spacing: -0.01em;
  margin-bottom: 12px !important;
}

.clean-auth-card p {
  font-size: 19px !important;
  /* Larger body text */
  color: #86868b !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
}

/* Override existing label classes inside clean-auth-card */
.clean-auth-card .form-label {
  font-size: 19px !important;
  /* Large readable label */
  font-weight: 600 !important;
  color: #1d1d1f !important;
  text-transform: none !important;
  /* Remove uppercase */
  letter-spacing: 0 !important;
  margin-top: 10px !important;
  margin-bottom: 8px !important;
}

/* Inputs */
.clean-auth-card .form-control {
  font-size: 19px !important;
  /* Large text input */
  padding: 16px 18px !important;
  /* Taller inputs */
  border-radius: 14px !important;
  /* Smooth corners */
  height: auto !important;
  background-color: rgba(0, 0, 0, 0.03) !important;
  /* Very subtle background */
  border: 1px solid transparent !important;
  color: #1d1d1f !important;
}

.clean-auth-card .form-control:focus {
  background-color: #fff !important;
  border-color: #0071e3 !important;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15) !important;
}

/* Buttons */
.clean-auth-card .btn-apple-primary {
  font-size: 19px !important;
  /* Larger button text */
  padding: 16px 32px !important;
  /* Larger button area */
  font-weight: 600 !important;
  margin-top: 20px !important;
  border-radius: 14px !important;
  /* Less pill-like, more squircle-ish for forms, or keep consistent? Apple uses pills. */
}

/* Link adjustments */
.clean-auth-card a {
  font-size: 17px !important;
}

/* Hide small text or make it normal size if strictly simple */
.clean-auth-card small,
.clean-auth-card .small {
  font-size: 15px !important;
  color: #86868b !important;
}

/* --- Password Field Specifics (Input Group) --- */
/* User requested: right border of password field to be default box (square) */
.clean-auth-card .input-group .form-control {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: none !important;
  /* Remove right border to merge with button */
}

/* Stylize the toggle button to match the large input */
.clean-auth-card .input-group .password-toggle-btn {
  background-color: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid transparent !important;
  border-left: none !important;
  color: #86868b !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-top-right-radius: 14px !important;
  border-bottom-right-radius: 14px !important;
  padding: 0 18px !important;
  /* Match horizontal padding */
  margin-top: 0 !important;
  /* Prevent button margin override */
  display: flex;
  align-items: center;
  font-size: 19px !important;
}

.clean-auth-card .input-group .password-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
  color: #1d1d1f !important;
}

/* Create a unified focus look for the group */
.clean-auth-card .input-group:focus-within .form-control,
.clean-auth-card .input-group:focus-within .password-toggle-btn {
  background-color: #fff !important;
  border-color: #0071e3 !important;
  box-shadow: none !important;
}

.clean-auth-card .input-group:focus-within .password-toggle-btn {
  border-left: 1px solid #0071e3 !important;
  /* Add divider on focus */
}

.clean-auth-card .input-group:focus-within {
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15) !important;
  border-radius: 14px !important;
}