/* Base styles */
:root {
  --primary-color: #10b981;
  --primary-hover: #059669;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red-500: #ef4444;
  --red-700: #b91c1c;
  --border-radius: 0.375rem;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --resizer-width: 10px;
  --min-panel-width: 300px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: var(--gray-800);
  background-color: #fff;
}

fieldset {
  display: initial; /* o inline */
  min-inline-size: auto;
  margin-inline: 0;
  border-width: 0;
  border-style: none;
  border-color: initial; /* o transparent */
  border-image: none;
  padding-block: 0;
  padding-inline: 0;
}
legend {
  display: initial; /* o inline */
  unicode-bidi: normal;
  padding-inline: 0;
}
.container {
  max-width: 1900px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
}

.title {
  font-size: 1.875rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

/* Split view styles */
.split-view {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.split-panel {
/*  flex: 1;*/
  overflow: auto;
  padding: 0;
  min-width: var(--min-panel-width);
  width: 100%;
}
.split-panel:first-child {
  width: 50%;
}

.resizer {
  width: var(--resizer-width);
  background-color: var(--gray-200);
  cursor: col-resize;
  flex-shrink: 0;
  position: relative;
}

.resizer:hover, .resizer.resizing {
  background-color: var(--primary-color);
}

.resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 2rem;
  background-color: var(--gray-400);
  border-radius: 1px;
}

.resizer:hover::after, .resizer.resizing::after {
  background-color: white;
}

/* Tabs for mobile */
.tabs-mobile {
  display: block;
}

.tab-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-button {
  padding: 0.5rem 1rem;
  background-color: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
}

.tab-button.active {
  background-color: white;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Card */
.card {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card-header {
  margin-bottom: 1rem;
  flex-shrink: 0;
}

/* Buttons */
.button-group {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.button {
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.2s;
  display: inline-flex;
  align-items: center;
  margin-right: 0.5rem;
}

.button:last-child {
  margin-right: 0;
}

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

.button-primary:hover {
  background-color: var(--primary-hover);
}

.button-outline {
  background-color: transparent;
  border-color: var(--gray-300);
}

.button-outline:hover {
  background-color: var(--gray-100);
}

.icon {
  margin-right: 0.5rem;
}

.button-icon {
  padding: 0.25rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Textarea and inputs */
textarea, input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 0.875rem;
}

#markdown-editor {
  flex: 1;
  min-height: 200px;
  font-family: monospace;
  resize: none;
}

.long-answer {
  min-height: 100px;
  resize: vertical;
}

/* File upload */
.file-upload-container {
  margin-top: 0.5rem;
}
.upload-label {
  display: inline-block;
  padding: 10px 15px;
  background-color: #007bff;
  color: white;
  border-radius: 5px;
  cursor: pointer;
}

.upload-label:hover {
  background-color: #0056b3;
}
.file-input {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

.file-label {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
}

.file-label:hover {
  background-color: var(--gray-200);
}

.file-icon {
  margin-right: 0.5rem;
}

.file-info {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-600);
}

/* Response type selector */
.response-type-selector {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

.response-type-selector label {
  margin-right: 0.5rem;
}

.response-type-dropdown {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  background-color: white;
}

/* Syntax guide */
.syntax-guide {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--gray-500);
  overflow-y: auto;
  max-height: 68vh;
  flex-shrink: 0;
}

.syntax-guide h3 {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.syntax-guide ul {
  list-style-type: disc;
  padding-left: 1.25rem;
}

.syntax-guide li {
  margin-bottom: 0.25rem;
}

.syntax-guide code {
  background-color: var(--gray-100);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
}

.syntax-guide pre {
  background-color: var(--gray-100);
  padding: 0.5rem;
  border-radius: var(--border-radius);
  margin: 0.5rem 0 0.5rem 0.5rem;
  white-space: pre-wrap;
}

/* Form preview */
.form-preview {
  flex: 1;
  overflow-y: auto;
  min-height: 200px;
}

.empty-message {
  text-align: center;
  padding: 2.5rem 0;
  color: var(--gray-500);
}

.form-element {
  margin-bottom: 1.5rem;
}

.heading1 {
  font-size: 1.875rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.heading2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.heading3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.paragraph {
  margin: 1rem 0;
}

.question-container {
  position: relative;
  border: none;
  border-bottom: 1px solid var(--gray-300);
  padding: 1rem;
  border-radius: 0;
  margin-bottom: 1rem;
}

.question-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
}

.question-text {
  margin-bottom: 0.5rem;
  font-weight: 500;
  padding-right: 4rem; /* Make room for the action buttons */
}

.question-description {
  margin-bottom: 0.75rem;
  font-size: 0.975rem;
  color: var(--gray-600);
  background-color: white;
  padding: 0.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; /* Evita que el texto genere saltos de línea */
  border: 0;
}

.answer-field {
  margin-top: 0.5rem;
}
.answer-field>label {
  display: block;
  font-size: 0.875rem;
}
.answer-toggle {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
}

.answer-toggle label {
  margin-left: 0.5rem;
  font-size: 0.875rem;
}

.checkbox-container, .radio-container {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.checkbox-container label, .radio-container label {
  margin-left: 0.5rem;
  font-size: 0.875rem;
}

.list {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.list li {
  margin-bottom: 0.25rem;
}

.ordered-list {
  list-style-type: decimal;
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.ordered-list li {
  margin-bottom: 0.25rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 2% auto;
  padding: 0rem 1rem 1rem;
  border-radius: var(--border-radius);
  max-width: 60rem;
  width: 90%;
  min-height: 80vh;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-modal {
  font-size: 1.5rem;
  padding: 0.5rem;
  cursor: pointer;
}


/* Custom checkbox and radio */
.custom-checkbox, .custom-radio {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--gray-400);
  border-radius: 0.25rem;
  cursor: pointer;
  position: relative;
}

.custom-radio {
  border-radius: 50%;
}

.custom-checkbox:checked, .custom-radio:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.custom-checkbox:checked::after {
  content: "✓";
  color: white;
  position: absolute;
  top: -0.125rem;
  left: 0.125rem;
  font-size: 0.75rem;
}

.custom-radio:checked::after {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: white;
}

/* Responsive styles */
@media (max-width: 768px) {
  .container {
    height: auto;
  }

  .split-view {
    display: block;
  }
  
  .split-panel {
    display: none;
    padding: 0;
  }
  
  .resizer {
    display: none;
  }
  
  .tabs-mobile {
    display: block;
  }
  
  /* Mostrar panel activo en móvil */
  .split-panel.active {
    display: block;
  }
  
  .button-group {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .button-group > div {
    display: flex;
  }
  
  .modal-content {
    width: 90%;
  }
}