/* Reset and Base Styles */
* {
  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, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

/* Screen Management */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: block;
}

/* Login Screen */
.login-form {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin-top: 10vh;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.login-form h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

/* Buttons */
.primary-btn,
.secondary-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  width: 100%;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn {
  background: transparent;
  color: #667eea;
  border: 2px solid #667eea;
}

.secondary-btn:hover {
  background: #667eea;
  color: white;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
  color: #333;
  font-weight: 600;
}

/* Upload Section */
.upload-section {
  margin-bottom: 30px;
}

.upload-area {
  border: 3px dashed #ccc;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  background: white;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area.dragover {
  border-color: #667eea;
  background: #f8f9ff;
}

.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.upload-icon {
  font-size: 48px;
  opacity: 0.6;
}

.upload-content h3 {
  color: #333;
  font-weight: 600;
}

.upload-content p {
  color: #666;
  margin-bottom: 10px;
}

/* File Info */
.file-info {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}

.file-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Processing Section */
.processing-section {
  margin-bottom: 30px;
}

.processing-card,
.summary-card,
.error-card {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.processing-card h3,
.summary-card h3,
.error-card h3 {
  margin-bottom: 20px;
  color: #333;
  font-weight: 600;
}

/* Progress Bar */
.progress-container {
  margin-bottom: 15px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e1e5e9;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  width: 0%;
  transition: width 0.3s ease;
}

.status-text {
  color: #666;
  font-size: 14px;
}

/* Reconnect Status */
.reconnect-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 6px;
  color: #856404;
}

/* Summary Section */
.summary-content {
  margin-bottom: 20px;
}

/* Structured Summary Styles */
.summary-structured {
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e1e5e9;
}

.summary-section-item {
  border-bottom: 1px solid #e1e5e9;
}

.summary-section-item:last-child {
  border-bottom: none;
}

.summary-section-header {
  background: #667eea;
  color: white;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 16px;
  margin: 0;
}

.summary-section-content {
  padding: 16px;
  background: white;
}

.summary-section-content ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.summary-section-content li {
  margin-bottom: 8px;
  line-height: 1.5;
  color: #333;
}

.summary-section-content p {
  margin: 0 0 8px 0;
  line-height: 1.5;
  color: #333;
}

.summary-raw {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e1e5e9;
}

.summary-raw h4 {
  margin: 0 0 10px 0;
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.summary-content textarea {
  width: 100%;
  min-height: 200px;
  padding: 15px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.summary-actions {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.summary-actions .primary-btn,
.summary-actions .secondary-btn {
  flex: 1;
  min-width: 150px;
}

/* Error Section */
.error-card {
  border-left: 4px solid #dc3545;
}

.error-content {
  color: #721c24;
  background: #f8d7da;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  border: 1px solid #f5c6cb;
}

/* Messages */
.error-message,
.success-message {
  padding: 10px;
  border-radius: 6px;
  margin-top: 10px;
  text-align: center;
}

.error-message {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.success-message {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

/* Loader */
.loader {
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader.small {
  width: 16px;
  height: 16px;
}

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

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

.text-center {
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .login-form {
    margin-top: 5vh;
    padding: 30px 20px;
  }

  .app-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .file-info {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .summary-actions {
    flex-direction: column;
  }

  .summary-actions .primary-btn,
  .summary-actions .secondary-btn {
    flex: none;
    width: 100%;
  }
}

/* Drag and Drop States */
.upload-area.dragover {
  border-color: #667eea;
  background: #f8f9ff;
  transform: scale(1.02);
}

/* Animation for smooth transitions */
.processing-card,
.summary-card,
.error-card {
  animation: slideIn 0.3s ease-out;
}

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

/* Button loading state */
.primary-btn .btn-text {
  transition: opacity 0.3s ease;
}

.primary-btn.loading .btn-text {
  opacity: 0;
}

.primary-btn.loading .loader {
  display: block;
}

.primary-btn:not(.loading) .loader {
  display: none;
}
