/* CSS Custom Properties for Theme Management */
:root {
  /* Light Theme Colors - Professional Palette */
  --bg-primary: linear-gradient(135deg, #fafbfc 0%, #f5f7fa 100%);
  --bg-secondary: rgba(255, 255, 255, 0.95);
  --bg-card: rgba(255, 255, 255, 0.98);
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --accent-primary: linear-gradient(135deg, #2b6cb8 0%, #1e4a6b 100%);
  --accent-secondary: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  --accent-success: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
  --accent-danger: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
  --border-color: rgba(226, 232, 240, 0.6);
  --hover-bg: rgba(237, 242, 247, 0.8);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.08);
}

/* Dark Theme Colors - Professional Palette */
[class*="dark-theme"] {
  --bg-primary: linear-gradient(135deg, #0f1419 0%, #1a202c 100%);
  --bg-secondary: rgba(26, 32, 44, 0.95);
  --bg-card: rgba(45, 55, 72, 0.98);
  --text-primary: #f7fafc;
  --text-secondary: #cbd5e0;
  --text-muted: #a0aec0;
  --accent-primary: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
  --accent-secondary: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  --accent-success: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
  --accent-danger: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
  --border-color: rgba(74, 85, 104, 0.4);
  --hover-bg: rgba(74, 85, 104, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: all 0.3s ease;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
.header {
  backdrop-filter: blur(20px);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo h1 {
  background: var(--accent-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.8rem;
  font-weight: 700;
}

.header-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.language-toggle,
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-primary);
  font-weight: 500;
}

.language-toggle:hover,
.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.theme-toggle {
  padding: 0.5rem;
  width: 44px;
  height: 44px;
  justify-content: center;
}

/* Main Content */
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 4rem;
  padding: 2rem 0;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  background: var(--accent-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-features {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.feature-tag {
  background: var(--accent-success);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.feature-tag:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Privacy Notice Section */
.privacy-highlight {
  background: linear-gradient(135deg, rgba(56, 161, 105, 0.12), rgba(47, 133, 90, 0.08));
  border: 3px solid rgba(56, 161, 105, 0.4);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  margin-bottom: 3rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.privacy-highlight-content {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.privacy-highlight-icon {
  font-size: 4rem;
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

.privacy-highlight-text h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.privacy-highlight-text p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

.privacy-highlight-text strong {
  color: #38a169;
  font-weight: 600;
}

.privacy-notice {
  background: linear-gradient(135deg, rgba(56, 161, 105, 0.1), rgba(47, 133, 90, 0.05));
  border: 2px solid rgba(56, 161, 105, 0.3);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 3rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.privacy-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.privacy-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.privacy-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.privacy-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 2rem;
}

.privacy-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.privacy-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.privacy-feature:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.privacy-feature-icon {
  font-size: 1.5rem;
}

.privacy-feature-text {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* Upload Section */
.upload-section {
  margin-bottom: 4rem;
}

.upload-area {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: 20px;
  padding: 4rem 2rem;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
  backdrop-filter: blur(20px);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: #3182ce;
  background: linear-gradient(135deg, rgba(49, 130, 206, 0.05), rgba(44, 82, 130, 0.05));
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.upload-area.success-upload {
  border-color: #38a169 !important;
  background: linear-gradient(135deg, rgba(56, 161, 105, 0.15), rgba(47, 133, 90, 0.1)) !important;
  animation: successPulse 2s ease-out;
}

.upload-area.success-upload .upload-title {
  color: #38a169 !important;
  font-weight: 700;
  transition: color 0.3s ease;
}

.upload-area.success-upload .upload-icon {
  animation: successBounce 0.6s ease-out;
}

@keyframes successPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(56, 161, 105, 0.3);
  }
}

@keyframes successBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.upload-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.upload-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.upload-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.upload-button {
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upload-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.supported-formats {
  margin-top: 1rem;
  opacity: 0.6;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.supported-formats small {
  letter-spacing: 0.5px;
}

/* File List */
.file-list {
  margin-top: 2rem;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
}

.file-list-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.files-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.file-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.file-icon {
  font-size: 1.5rem;
}

.file-details h5 {
  font-weight: 600;
  color: var(--text-primary);
}

.file-details p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.remove-file {
  background: var(--accent-secondary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-file:hover {
  transform: scale(1.1);
}

.clear-files {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.clear-files:hover {
  background: var(--accent-danger);
  color: white;
  border-color: transparent;
}

.preview-toggle {
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.preview-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  opacity: 0.9;
}

.preview-toggle:active {
  transform: translateY(0);
}

/* Merge Modes */
.merge-modes {
  margin-bottom: 4rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--text-primary);
}

.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.mode-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
}

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

.mode-card.selected {
  border-color: #3182ce;
  background: linear-gradient(135deg, rgba(49, 130, 206, 0.08), rgba(44, 82, 130, 0.08));
}

.mode-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

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

.mode-description {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* Visual Demonstrations */
.mode-visual {
  margin-top: 1.5rem;
}

.visual-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.file-representation,
.data-block,
.column-block {
  background: var(--accent-primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
}

.result-representation,
.result-block,
.result-columns {
  background: var(--accent-success);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-weight: 600;
}

.sheet {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin: 0.25rem 0;
  font-size: 0.75rem;
}

.arrow {
  font-size: 1.5rem;
  color: var(--text-secondary);
  font-weight: bold;
}

/* Merge Actions */
.merge-actions {
  text-align: center;
}

.merge-button {
  background: var(--accent-success);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 1.25rem 3rem;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: var(--shadow-md);
}

.merge-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

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

/* Processing Section */
.processing {
  text-align: center;
  padding: 4rem 2rem;
}

.processing-content {
  max-width: 500px;
  margin: 0 auto;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-color);
  border-top: 4px solid #3182ce;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 2rem;
}

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

.processing-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.processing-subtitle {
  color: var(--text-secondary);
}

/* Success Section */
.success {
  text-align: center;
  padding: 4rem 2rem;
}

.success-content {
  max-width: 500px;
  margin: 0 auto;
}

.success-icon {
  font-size: 4rem;
  margin-bottom: 2rem;
}

.success-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: var(--accent-success);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.success-subtitle {
  color: var(--text-secondary);
  margin-bottom: 3rem;
  font-size: 1.125rem;
}

.download-button,
.start-over-button {
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.download-button {
  background: var(--accent-success);
  color: white;
}

.start-over-button {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}

.download-button:hover,
.start-over-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.start-over-button:hover {
  background: var(--accent-primary);
  color: white;
  border-color: transparent;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  backdrop-filter: blur(20px);
}

.footer-content p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .main {
    padding: 1rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .privacy-highlight {
    padding: 1.5rem 1rem;
  }
  
  .privacy-highlight-content {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .privacy-highlight-icon {
    font-size: 3rem;
  }
  
  .privacy-highlight-text h3 {
    font-size: 1.25rem;
  }
  
  .privacy-highlight-text p {
    font-size: 0.95rem;
  }
  
  .privacy-notice {
    padding: 1.5rem 1rem;
  }
  
  .privacy-title {
    font-size: 1.5rem;
  }
  
  .privacy-text {
    font-size: 1rem;
  }
  
  .privacy-features {
    grid-template-columns: 1fr;
  }
  
  .hero-features {
    gap: 0.5rem;
  }
  
  .feature-tag {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }
  
  .upload-area {
    padding: 2rem 1rem;
  }
  
  .modes-grid {
    grid-template-columns: 1fr;
  }
  
  .header-content {
    padding: 1rem;
  }
  
  .logo h1 {
    font-size: 1.5rem;
  }
}

/* Smooth Transitions for Theme Changes */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Enhanced Animation Classes */
.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-up {
  animation: slideUp 0.6s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Dark theme class toggle for smooth transitions */
.dark-theme {
  transition: all 0.3s ease;
}

/* Notification Styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  min-width: 300px;
  max-width: 500px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  transform: translateX(100%);
  animation: slideInRight 0.3s ease-out forwards;
}

.notification-error {
  background: linear-gradient(135deg, rgba(229, 62, 62, 0.95), rgba(197, 48, 48, 0.95));
  border-left: 4px solid #e53e3e;
  color: white;
}

.notification-warning {
  background: linear-gradient(135deg, rgba(237, 137, 54, 0.95), rgba(221, 107, 32, 0.95));
  border-left: 4px solid #ed8936;
  color: white;
}

.notification-success {
  background: var(--accent-success);
  border-left: 4px solid #38a169;
  color: white;
}

.notification-info {
  background: var(--accent-primary);
  border-left: 4px solid #3182ce;
  color: white;
}

.notification-content {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  gap: 1rem;
}

.notification-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notification-message {
  flex: 1;
  font-weight: 500;
  line-height: 1.4;
}

.notification-close {
  background: transparent;
  border: none;
  color: currentColor;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.notification-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.fade-out {
  animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Mobile notification adjustments */
@media (max-width: 768px) {
  .notification {
    left: 20px;
    right: 20px;
    min-width: auto;
    transform: translateY(-100%);
    animation: slideInDown 0.3s ease-out forwards;
  }
  
  .fade-out {
    animation: slideOutUp 0.3s ease-in forwards;
  }
  
  @keyframes slideInDown {
    from {
      transform: translateY(-100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  @keyframes slideOutUp {
    from {
      transform: translateY(0);
      opacity: 1;
    }
    to {
      transform: translateY(-100%);
      opacity: 0;
    }
  }
}

/* Real-time Preview Styles */
.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.realtime-preview {
  margin: 2rem 0;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.preview-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--accent-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sheet-selector {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.sheet-selector:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.preview-info-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Source Preview */
.source-preview {
  margin-bottom: 2rem;
}

.source-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.source-title:before {
  content: "📁";
  font-size: 1rem;
}

.source-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.source-file-container {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.source-file-container:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.source-file-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.source-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.source-preview-table th {
  background: var(--hover-bg);
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.5rem 0.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.7rem;
}

.source-preview-table td {
  padding: 0.4rem 0.25rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60px;
}

.empty-file-msg {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem;
}

/* Result Preview */
.result-preview {
  border-top: 2px solid var(--border-color);
  padding-top: 2rem;
}

.result-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-title:before {
  content: "📊";
  font-size: 1rem;
}

.preview-table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
  background: var(--bg-secondary);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.preview-table th {
  background: linear-gradient(135deg, var(--accent-primary), rgba(49, 130, 206, 0.8));
  color: white;
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.preview-table td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}

.preview-table tbody tr:hover {
  background: var(--hover-bg);
}

.preview-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

[class*="dark-theme"] .preview-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.preview-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-style: italic;
  padding: 1rem;
  background: var(--hover-bg);
  border-radius: 8px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .realtime-preview {
    padding: 1rem;
    margin: 1rem 0;
  }
  
  .preview-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .preview-controls {
    justify-content: space-between;
  }
  
  .source-files-grid {
    grid-template-columns: 1fr;
  }
  
  .source-preview-table,
  .preview-table {
    font-size: 0.75rem;
  }
  
  .source-preview_table th,
  .source-preview-table td,
  .preview-table th,
  .preview-table td {
    padding: 0.25rem;
    max-width: 80px;
  }
  
  .preview-title {
    font-size: 1.25rem;
    text-align: center;
  }
}

/* Advanced Configuration Styles */
.config-toggle-btn {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 1rem;
}

.config-toggle-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
}

.merge-config {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
}

.config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.config-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.config-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.config-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.config-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.config-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.config-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.config-option:hover {
  color: var(--text-primary);
}

.config-option input[type="checkbox"],
.config-option input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #3182ce;
}

.config-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.config-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.config-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  width: 120px;
  transition: all 0.3s ease;
}

.config-input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.merge-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Mobile adjustments for config */
@media (max-width: 768px) {
  .merge-config {
    padding: 1rem;
  }
  
  .config-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .merge-actions {
    flex-direction: column;
  }
  
  .config-toggle-btn {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  .config-options {
    gap: 0.75rem;
  }
  
  .config-input {
    width: 100%;
    max-width: 200px;
  }
}

/* PWA Install Banner Styles */
.install-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: var(--accent-primary);
  color: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  animation: slideUp 0.3s ease-out;
}

.install-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.install-btn {
  background: white;
  color: var(--accent-primary);
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.install-btn:hover {
  transform: scale(1.05);
}

.install-close {
  background: transparent;
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.install-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
  .install-banner {
    left: 10px;
    right: 10px;
  }
  
  .install-content {
    flex-direction: column;
    text-align: center;
  }
}

/* Source Preview Section */
.source-preview-section {
  margin-bottom: 3rem;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.source-preview-section .section-title {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* Real-time Preview Section */
.realtime-preview {
  margin-bottom: 4rem;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.preview-sections {
  display: grid;
  gap: 2rem;
  margin-top: 2rem;
}

.source-preview, .result-preview {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.source-title, .result-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.source-files {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.source-file-preview {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.source-file-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-icon {
  width: 16px;
  height: 16px;
  background: var(--accent-primary);
  border-radius: 4px;
  display: inline-block;
}

.result-table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  max-height: 400px;
  overflow-y: auto;
}

/* Sheet Tabs (Excel-style) */
.sheet-tabs-container {
  background: var(--bg-secondary);
  border-radius: 12px 12px 0 0;
  padding: 0.5rem 1rem 0 1rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1rem;
  display: flex;
  overflow: hidden;
}

.sheet-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.sheet-tabs::-webkit-scrollbar {
  height: 4px;
}

.sheet-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.sheet-tabs::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.sheet-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--hover-bg);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 120px;
  position: relative;
}

.sheet-tab:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.sheet-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: #3182ce;
  border-bottom: 2px solid var(--bg-card);
  box-shadow: var(--shadow-md);
  z-index: 1;
  margin-bottom: -2px;
}

.sheet-tab-checkbox {
  margin: 0;
  cursor: pointer;
  accent-color: #3182ce;
}

.sheet-tab-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sheet-tab-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-tab-file {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.sheet-tab.disabled {
  opacity: 0.5;
  background: var(--hover-bg);
  color: var(--text-muted);
}

.sheet-tab.disabled:hover {
  transform: none;
  box-shadow: none;
}

.sheet-tab.disabled .sheet-tab-name {
  text-decoration: line-through;
}

/* Dark theme adjustments */
[class*="dark-theme"] .sheet-tab {
  background: rgba(45, 55, 72, 0.8);
  border-color: rgba(74, 85, 104, 0.4);
}

[class*="dark-theme"] .sheet-tab:hover {
  background: rgba(45, 55, 72, 0.98);
}

[class*="dark-theme"] .sheet-tab.active {
  background: rgba(45, 55, 72, 0.98);
  border-bottom: 2px solid rgba(45, 55, 72, 0.98);
}

[class*="dark-theme"] .sheet-tabs-container {
  background: rgba(26, 32, 44, 0.95);
  border-bottom-color: rgba(74, 85, 104, 0.4);
}

/* Preview Controls */