html {
  font-size: 16px;
}

body {
  font-family: Arial, sans-serif;
  background: linear-gradient(
    -45deg,
    rgb(137, 58, 150),
    rgba(0, 119, 255, 0.7),
    rgb(137, 58, 150)
  );
  background-size: 100% 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}

/* ================================================================== */
/* Main content */
/* ================================================================== */
main {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  flex: 1 0 auto;
  margin-top: 70px;  /* IMPORTANT for the fixed header */
}

/* Form container */
.form-container {
  width: 80%;
  max-width: 1000px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-container h2 {
  color: #2c3e50;
  font-size: 2rem;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 600;
}

.form-container p {
  color: #6c757d;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Form styling */
form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Form fields */
form p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

form label {
  font-weight: 500;
  color: #495057;
  font-size: 0.95rem;
}

form input[type="text"],
form input[type="number"],
form select,
form textarea {
  padding: 0.75rem;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

form input[type="text"]:focus,
form input[type="number"]:focus,
form select:focus,
form textarea:focus {
  outline: none;
  border-color: #4285f4;
  box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

/* Buttons */
.download-button,
.upload-button,
.control-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.download-button {
  background: linear-gradient(135deg, #4285f4 0%, #3367d6 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
}

.download-button:hover {
  background: linear-gradient(135deg, #3367d6 0%, #2c5aa0 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
}

.download-button[data-action="add"] {
  background: linear-gradient(135deg, #34a853 0%, #2d8a4a 100%);
  box-shadow: 0 4px 15px rgba(52, 168, 83, 0.3);
}

.download-button[data-action="add"]:hover {
  background: linear-gradient(135deg, #2d8a4a 0%, #237a3c 100%);
  box-shadow: 0 6px 20px rgba(52, 168, 83, 0.4);
}

#clear-output-btn {
  background: linear-gradient(135deg, #ea4335 0%, #d33b2c 100%);
  box-shadow: 0 4px 15px rgba(234, 67, 53, 0.3);
}

#clear-output-btn:hover {
  background: linear-gradient(135deg, #d33b2c 0%, #b52d20 100%);
  box-shadow: 0 6px 20px rgba(234, 67, 53, 0.4);
}

/* Button container */
.button-container {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Loading state */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Error text */
.error-text {
  color: #ea4335;
  margin-top: 1rem;
  padding: 1rem;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-weight: 500;
}

/* Result container */
#result-container {
  display: none;
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

#result-container h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
}

/* Result output */
#result-output {
  width: 100%;
  min-height: 300px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  border: 2px solid #e9ecef;
  padding: 1rem;
  border-radius: 8px;
  resize: vertical;
  font-size: 0.9rem;
  line-height: 1.4;
  background-color: #ffffff;
  transition: border-color 0.3s ease;
}

#result-output:focus {
  outline: none;
  border-color: #4285f4;
}

#result-output.editable {
  border-color: #4285f4;
  background-color: #fff;
}

/* Result info */
#result-info {
  background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid #e1bee7;
}

/* Error container */
#error-container {
  display: none;
  margin-top: 1rem;
}

#error-message {
  color: #ea4335;
  padding: 1rem;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-weight: 500;
}

/* Horizontal rule */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #e9ecef, transparent);
  margin: 2rem 0;
}

/* Output controls */
.output-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.control-button {
  padding: 0.5rem 1rem;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background-color: #f8f9fa;
  color: #495057;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.control-button:hover {
  background-color: #e9ecef;
  transform: translateY(-1px);
}

.control-button.active {
  background: linear-gradient(135deg, #4285f4 0%, #3367d6 100%);
  color: white;
  border-color: #4285f4;
}

.delete-btn {
  background: linear-gradient(135deg, #ea4335 0%, #d33b2c 100%);
  color: white;
  border-color: #ea4335;
}

.delete-btn:hover {
  background: linear-gradient(135deg, #d33b2c 0%, #b52d20 100%);
}