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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 2rem 1rem;
  color: #333;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Header */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 2rem;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

header p {
  opacity: 0.9;
  font-size: 1.1rem;
}

/* Main */
main {
  padding: 2rem;
}

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

.upload-area {
  border: 3px dashed #667eea;
  border-radius: 15px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f8f9ff;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #764ba2;
  background: #f0f2ff;
  transform: scale(1.02);
}

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

.upload-area h3 {
  color: #667eea;
  margin-bottom: 0.5rem;
}

.upload-area p {
  color: #666;
  font-size: 0.9rem;
}

/* Preview Section */
.preview-section {
  margin-bottom: 2rem;
}

.preview-section h3 {
  margin-bottom: 1rem;
  color: #333;
}

.preview-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.preview-container img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 59, 48, 0.9);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.btn-remove:hover {
  background: #ff3b30;
  transform: scale(1.1);
}

/* Action Section */
.action-section {
  margin-bottom: 2rem;
  text-align: center;
}

.method-selector {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.method-selector label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  color: #555;
}

.method-selector input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

.btn-extract {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  padding: 1rem 3rem;
  font-size: 1.1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-extract:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-extract:active {
  transform: translateY(0);
}

/* Loading Section */
.loading-section {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.loading-section p {
  color: #667eea;
  font-size: 1.1rem;
}

/* Result Section */
.result-section {
  margin-bottom: 2rem;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.result-header h3 {
  color: #333;
}

.result-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-copy,
.btn-clear {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-copy {
  background: #28a745;
  color: #fff;
}

.btn-copy:hover {
  background: #218838;
}

.btn-clear {
  background: #6c757d;
  color: #fff;
}

.btn-clear:hover {
  background: #5a6268;
}

.result-content {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid #e9ecef;
}

.result-content textarea {
  width: 100%;
  min-height: 200px;
  border: none;
  background: transparent;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  color: #333;
}

.result-content textarea:focus {
  outline: none;
}

/* Error Section */
.error-section {
  margin-bottom: 2rem;
}

.error-message {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 10px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.error-message span:last-child {
  color: #856404;
}

/* Footer */
footer {
  background: #f8f9fa;
  padding: 1.5rem;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  border-top: 1px solid #e9ecef;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 1rem 0.5rem;
  }

  header h1 {
    font-size: 2rem;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .upload-area {
    padding: 2rem 1rem;
  }

  .upload-icon {
    font-size: 3rem;
  }

  .method-selector {
    flex-direction: column;
    gap: 1rem;
  }

  .btn-extract {
    width: 100%;
    padding: 1rem;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-actions {
    width: 100%;
  }

  .btn-copy,
  .btn-clear {
    flex: 1;
  }
}
