/* Modern CSS Variables for Consistent Theming */
:root {
  /* Light Enterprise Theme Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f0f1f3;
  --bg-dark: #e9ecef;

  /* Text Colors */
  --text-primary: #1a1a2e;
  --text-secondary: #4a5568;
  --text-light: #718096;
  --text-inverse: #ffffff;

  /* Accent Colors */
  --accent-blue: #dc2626;
  --accent-purple: #b91c1c;
  --accent-green: #ef4444;
  --accent-orange: #ea580c;

  /* UI Colors */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --shadow-light: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-medium: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-large: 0 10px 15px rgba(0,0,0,0.1);
}

/* Global Styles */
* {
  box-sizing: border-box;
  transition: all 0.2s ease;
}

body {
  margin: 0;
  font-family: 'Inter', 'Arial', sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-medium);
}

header nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}

header nav a {
  color: #4a5568;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

header nav a:hover {
  color: #dc2626;
}

/* Hero Section */
#hero {
  position: relative;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #0a0000 0%, #1a0505 30%, #0d0000 60%, #0a0a0a 100%);
  color: var(--text-inverse);
  overflow: hidden;
}

#hero .container {
  position: relative;
  z-index: 2;
}

#hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--text-inverse);
}

#hero p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-inverse);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translate(-50%, 0);
  }
  40% {
    transform: translate(-50%, -10px);
  }
  60% {
    transform: translate(-50%, -5px);
  }
}

/* Sections */
section {
  padding: 5rem 1rem;
  position: relative;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Features Section */
#features {
  background: var(--bg-primary);
}

#features h2 {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

#features > .container > p {
  text-align: center;
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.feature-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  height: 100%;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-large);
  border-color: var(--accent-blue);
}

.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.feature-card p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Calculators Section */
#calculators {
  background: var(--bg-secondary);
  padding: 5rem 1rem;
}

#calculators h2 {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-primary);
}

.calculator-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  height: 100%;
  min-height: 600px;
}

.calculator-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-large);
}

.calculator-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.chart-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  height: 300px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container canvas {
  max-width: 100% !important;
  max-height: 100% !important;
  width: 100% !important;
  height: 100% !important;
}

/* Ensure charts are visible */
.calculator-card canvas {
  display: block !important;
  visibility: visible !important;
}

/* Calculator Inputs */
.calculator-card label {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.calculator-card input,
.calculator-card select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-medium);
  border-radius: 0.5rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.calculator-card input:focus,
.calculator-card select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.calculator-card ::placeholder {
  color: var(--text-light);
}

/* Explanation text */
#efficiencyExplanation,
#costExplanation,
#exponentialExplanation {
  background: var(--bg-tertiary);
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-left: 4px solid var(--accent-blue);
}

/* Workflow Demo Section */
#workflow-demo {
  background: var(--bg-primary);
}

#workflow-demo h2 {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

#workflow-demo > .container > p {
  text-align: center;
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

/* Blog Section */
#blog {
  background: var(--bg-secondary);
}

#blog h2 {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-primary);
}

.blog-post {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-light);
  margin-bottom: 2rem;
  border-left: 4px solid transparent;
  transition: all 0.3s ease;
}

.blog-post:hover {
  border-left-color: var(--accent-blue);
  transform: translateX(4px);
  box-shadow: var(--shadow-medium);
}

.blog-post h3 {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.blog-post p {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Resources Section */
#resources {
  background: var(--bg-primary);
}

#resources h2 {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-primary);
}

.resource-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  height: 100%;
}

.resource-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-large);
}

.resource-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.resource-card p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.resource-card a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
}

.resource-card a:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn-primary {
  background: var(--accent-blue);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-blue);
  border: 2px solid var(--accent-blue);
}

.btn-secondary:hover {
  background: var(--accent-blue);
  color: var(--text-inverse);
}

/* Invoice and HR Automation Sections */
#invoice-automation,
#hr-onboarding {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

#invoice-automation h2,
#hr-onboarding h2,
#invoice-automation h3,
#hr-onboarding h3,
#invoice-automation h4,
#hr-onboarding h4 {
  color: var(--text-primary);
}

#invoice-automation p,
#hr-onboarding p {
  color: var(--text-secondary);
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-medium);
  border-radius: 0.5rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

::placeholder {
  color: var(--text-light);
}

/* Light section form inputs */
#invoice-automation input,
#hr-onboarding input,
#invoice-automation select,
#hr-onboarding select {
  background: var(--bg-primary);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

#invoice-automation input::placeholder,
#hr-onboarding input::placeholder {
  color: var(--text-light);
}

/* Chatbot */
#chat-container {
  position: fixed;
  right: 1rem;
  bottom: 5rem;
  width: 420px;
  max-width: calc(100vw - 2rem);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  transition: transform 0.3s ease;
}

#chat-container.hidden {
  transform: translateY(calc(100% + 1rem));
}

#chat-header {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  padding: 1rem;
  border-radius: 1rem 1rem 0 0;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.3);
}

#chat-messages {
  height: 550px;
  overflow-y: auto;
  padding: 1rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

#chat-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #cbd5e1;
  border-radius: 0.75rem;
  background: #ffffff;
  color: #1a1a2e;
  margin-bottom: 0.5rem;
  transition: border-color 0.2s ease;
}

#chat-input:focus {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

#chat-send {
  width: 100%;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

#chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

#chat-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1002;
}

#chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(220, 38, 38, 0.5);
}

/* Chat message styling */
.chat-message {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  max-width: 85%;
  font-size: 0.875rem;
  line-height: 1.5;
  animation: chatFadeIn 0.3s ease;
}

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

.chat-message.user {
  background: var(--accent-blue);
  color: var(--text-inverse);
  margin-left: auto;
  text-align: right;
  border-bottom-right-radius: 0.25rem;
}

.chat-message.bot {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  margin-right: auto;
  border-bottom-left-radius: 0.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.chat-bot-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: var(--accent-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-top: 2px;
}

.chat-bot-text {
  flex: 1;
  min-width: 0;
}

.chat-bot-text p {
  margin: 0 0 0.5rem 0;
}

.chat-bot-text p:last-child {
  margin-bottom: 0;
}

.chat-bot-text strong {
  font-weight: 600;
  color: #1e293b;
}

@media (max-width: 480px) {
  #chat-container {
    width: calc(100vw - 1rem);
    right: 0.5rem;
    bottom: 4.5rem;
  }
  #chat-messages {
    height: 350px;
  }
}

.chat-message.typing {
  display: flex;
  gap: 4px;
  padding: 1rem;
}

.chat-message.typing .dot {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.chat-message.typing .dot:nth-child(1) { animation-delay: -0.32s; }
.chat-message.typing .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  animation: chatFadeIn 0.4s ease;
}

.chat-suggestion-btn {
  background: transparent;
  border: 1px solid var(--accent-blue);
  color: var(--accent-blue);
  padding: 0.375rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.chat-suggestion-btn:hover {
  background: var(--accent-blue);
  color: white;
  transform: translateY(-1px);
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 2rem;
}

.grid-cols-1 {
  grid-template-columns: 1fr;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  #hero h1 {
    font-size: 2.5rem;
  }

  #hero p {
    font-size: 1rem;
  }

  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  section {
    padding: 3rem 1rem;
  }

  .container {
    padding: 0 1rem;
  }

  header nav ul {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  #hero h1 {
    font-size: 2rem;
  }

  .feature-card,
  .calculator-card,
  .resource-card {
    padding: 1.5rem;
  }

  #chat-container {
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: none;
  }
}

/* Loading States */
.skeleton-loader {
  background: linear-gradient(90deg, #e2e8f0 25%, #f0f1f3 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 0.5rem;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.calculator-loading {
  position: relative;
  opacity: 0.6;
  pointer-events: none;
}

.calculator-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--accent-blue);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Error Messages */
.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin: 0.5rem 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
  text-align: center;
}

.stat-item {
  padding: 1.5rem;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none; }
.visible { display: block; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

/* Sheet2App Demo Styles */
#sheet2app {
  position: relative;
}

.sheet-upload-area {
  transition: all 0.3s ease;
}

.sheet-upload-area.drag-over {
  border-color: #dc2626;
  background-color: rgba(220, 38, 38, 0.05);
  transform: scale(1.01);
}

.sheet-upload-area:hover {
  border-color: #dc2626;
}

#sheet-preview,
#sheet-dashboard {
  animation: fadeInUp 0.5s ease-out;
}

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

.stat-card {
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#sheet-table-container table {
  width: 100%;
  border-collapse: collapse;
}

#sheet-table-container th {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

#sheet-table-container tr:hover {
  background-color: rgba(220, 38, 38, 0.05);
}

.sheet-error {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
