/* CSS Variables */

/* Light Theme */
[data-theme="light"] {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --error-color: #ef4444;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

/* Dark Theme (Default) */
[data-theme="dark"] {
  --primary-color: #60a5fa;
  --primary-hover: #3b82f6;
  --secondary-color: #94a3b8;
  --success-color: #34d399;
  --error-color: #f87171;
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

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

/* Smooth transitions for theme changes */
*,
*::before,
*::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  padding: 20px;
}

/* Container */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 2.5rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  min-height: 1.2em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  min-height: 2.5em;
  line-height: 1.3;
}

/* Sections */
section {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

section h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--text-primary);
  min-height: 1.8em;
  line-height: 1.2;
}

/* Upload Section */
.upload-section {
  background: var(--card-bg);
}

.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 40px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary-color);
  background-color: rgba(59, 130, 246, 0.05);
}

.upload-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.upload-text {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 1.1rem;
  min-height: 2em;
  line-height: 1.3;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin: 5px;
  min-width: 140px;
  white-space: nowrap;
}

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

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
  background-color: var(--secondary-color);
  cursor: not-allowed;
  opacity: 0.5;
}

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

.btn-secondary:hover {
  background-color: var(--bg-color);
  border-color: var(--secondary-color);
}

/* PDF Info Panel */
.pdf-info {
  border-left: 4px solid var(--primary-color);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
  min-width: 90px;
  display: inline-block;
}

.info-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Mode Selection */
.mode-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.mode-option {
  cursor: pointer;
}

.mode-option input[type="radio"] {
  display: none;
}

.mode-card {
  padding: 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: var(--transition);
  min-height: 120px;
  display: flex;
  flex-direction: column;
}

.mode-card h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--text-primary);
  min-height: 2.5em;
  line-height: 1.3;
}

.mode-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
}

.mode-option input[type="radio"]:checked + .mode-card {
  border-color: var(--primary-color);
  background-color: rgba(59, 130, 246, 0.05);
}

.mode-option:hover .mode-card {
  border-color: var(--primary-color);
}

/* Configuration Panel */
.config-panel {
  margin-bottom: 20px;
}

.config-panel label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  min-height: 1.5em;
}

.config-panel input[type="number"],
.config-panel textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
}

.config-panel input[type="number"]:focus,
.config-panel textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.help-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 8px;
  min-height: 2.5em;
  line-height: 1.4;
}

/* Error Message */
.error-message {
  background-color: rgba(239, 68, 68, 0.1);
  border-left: 4px solid var(--error-color);
  color: var(--error-color);
  padding: 12px;
  border-radius: var(--border-radius);
  margin-top: 15px;
  font-size: 0.9rem;
}

/* Preview Section */
.preview-content {
  background-color: var(--bg-color);
  padding: 20px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.preview-content ul {
  list-style: none;
  padding-left: 0;
}

.preview-content li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.preview-content li:last-child {
  border-bottom: none;
}

/* Actions Section */
.actions-section {
  text-align: center;
  padding: 20px;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  color: var(--text-secondary);
}

/* Results Section */
.results-section {
  border-left: 4px solid var(--success-color);
}

.results-content {
  background-color: var(--bg-color);
  padding: 20px;
  border-radius: var(--border-radius);
}

.result-item {
  padding: 10px;
  background-color: white;
  margin-bottom: 10px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-item span {
  color: var(--text-primary);
}

.result-item .success-icon {
  color: var(--success-color);
  font-size: 1.2rem;
}

/* Header Controls */
.header-controls {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  margin-bottom: 20px;
}

.language-selector {
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  min-width: 65px;
  width: 65px;
}

.language-selector:hover {
  border-color: var(--primary-color);
}

.language-selector:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.theme-toggle {
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  width: 44px;
  height: 44px;
}

.theme-toggle:hover {
  border-color: var(--primary-color);
  background-color: var(--bg-color);
}

.theme-toggle:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer p {
  min-height: 2em;
  line-height: 1.4;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    min-width: 300px;
  }

  .header h1 {
    font-size: 2rem;
  }

  section {
    padding: 20px;
  }

  .mode-options {
    grid-template-columns: 1fr;
  }

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

  .btn-primary,
  .btn-secondary {
    min-width: 120px;
  }

  .mode-card {
    min-height: 100px;
  }

  .mode-card h3 {
    min-height: 2em;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section:not(.hidden) {
  animation: fadeIn 0.3s ease;
}
