:root {
  --primary-color: #6366f1;
  --secondary-color: #8b5cf6;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: #333;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: white;
  text-decoration: none;
  display: inline-block;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-wrapper {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  margin: 30px 0;
}

@media (max-width: 1024px) {
  .main-wrapper {
    grid-template-columns: 1fr;
  }
}

.content-area {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card h1 {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 32px;
}

.card h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 24px;
}

.subtitle {
  color: #666;
  font-size: 16px;
  margin-bottom: 24px;
}

.data-input-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .data-input-section {
    grid-template-columns: 1fr;
  }
}

.input-column {
  position: relative;
}

.input-column h4 {
  color: var(--primary-color);
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-message {
  background: linear-gradient(135deg, #fee 0%, #ffeaea 100%);
  color: #dc2626;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #fecaca;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sheet-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.sheet-table thead th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  padding: 14px 12px;
  text-align: left;
  position: sticky;
  top: 0;
}

.sheet-table tbody tr {
  transition: all 0.2s ease;
}

.sheet-table tbody tr:hover {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
}

.sheet-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.row-number {
  color: #6b7280;
  font-weight: 500;
  width: 40px;
}

.cell {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.cell:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.cell.invalid {
  border-color: var(--danger-color);
  background: linear-gradient(135deg, #fef2f2 0%, #fee 100%);
}

.delete-btn {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.delete-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.tip-box {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
  color: #065f46;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  color: #374151;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
  transform: translateY(-1px);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.result-item {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.result-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.result-item h4 {
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.result-item p {
  color: #1e293b;
  font-size: 24px;
  font-weight: 700;
}

.stats-info {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 20px;
  margin-top: 24px;
  font-size: 14px;
  line-height: 1.6;
}

.loading-spinner {
  display: none;
  width: 24px;
  height: 24px;
  border: 3px solid #e5e7eb;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.chart-container {
  margin: 30px 0;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.data-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.summary-item {
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
}

.export-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.confidence-interval {
  background: #f0f9ff;
  border-radius: 8px;
  padding: 16px;
  margin: 20px 0;
}

.sidebar {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-section h3 {
  color: var(--primary-color);
  font-size: 16px;
  margin-bottom: 15px;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(99, 102, 241, 0.1);
  transform: translateX(4px);
}

footer {
  background: #1f2937;
  color: white;
  text-align: center;
  padding: 30px 20px;
  margin-top: 50px;
}

footer p {
  margin: 10px 0;
  font-size: 14px;
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}