/* Configuration Builder CSS */

:root {
  --primary-color: #3273dc;
  --success-color: #23d160;
  --warning-color: #ffdd57;
  --danger-color: #ff3860;
  --input-bg: #fff3cd;
  --output-bg: #e2e3e5;
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
  --border-radius: 8px;
}

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
}

.hero {
  margin-bottom: 2rem;
  box-shadow: var(--shadow-medium);
}

.card {
  box-shadow: var(--shadow-light);
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  border: none;
}

.card-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  border-bottom: 1px solid #dee2e6;
}

.card-header-title {
  font-weight: 600;
  color: #495057;
}

/* Screen Container */
.screen-container {
  border: 2px solid #e9ecef;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: white;
  position: relative;
}

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #f8f9fa;
}

.screen-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #495057;
  margin: 0;
}

.screen-description {
  color: #6c757d;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* Fields Grid */
.fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1rem;
}

.field-section {
  background: #f8f9fa;
  border-radius: var(--border-radius);
  padding: 1rem;
}

.field-section-title {
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-section-title.inputs {
  color: #856404;
}

.field-section-title.outputs {
  color: #495057;
}

/* Field Items */
.field-item {
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  overflow: hidden;
}

.field-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(50, 115, 220, 0.2);
  transform: translateY(-1px);
}

.field-item.input {
  background: var(--input-bg);
  border-left: 4px solid #ffc107;
}

.field-item.output {
  background: var(--output-bg);
  border-left: 4px solid #6c757d;
}

.field-item.dropdown {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border-left: 4px solid #28a745;
  border: 2px solid #28a745;
}

.field-item.dropdown:hover {
  border-color: #1e7e34;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.dropdown-options {
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: rgba(40, 167, 69, 0.1);
  border-radius: 4px;
  border-left: 3px solid #28a745;
}

.field-content {
  flex: 1;
  padding: 0.75rem;
}

.field-label {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: #495057;
}

.field-config {
  font-size: 0.8rem;
  color: #6c757d;
  font-family: "Courier New", monospace;
}

.field-config.not-configured {
  color: #dc3545;
  font-style: italic;
}

.field-actions {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.5);
}

.api-data-btn {
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #28a745;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  border-right: 1px solid #dee2e6;
  min-width: 45px;
}

.api-data-btn:hover {
  background: #218838;
  transform: scale(1.1);
}

.api-data-btn i {
  font-size: 1rem;
}

.field-status {
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #dee2e6;
  min-width: 45px;
}

.field-status i {
  font-size: 1.1rem;
}

.field-status .fa-check-circle {
  color: var(--success-color);
}

.field-status .fa-circle {
  color: #dee2e6;
}

/* Field section improvements */
.field-section-title {
  font-weight: 600;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-section-title.inputs {
  background: rgba(255, 243, 205, 0.3);
  border-left: 4px solid #ffc107;
}

.field-section-title.outputs {
  background: rgba(226, 227, 229, 0.3);
  border-left: 4px solid #6c757d;
}

/* Sheets */
.sheet-item {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.sheet-title {
  font-weight: 600;
  color: #495057;
  margin: 0;
}

.sheet-description {
  color: #6c757d;
  font-size: 0.9rem;
}

/* Configuration Output */
.config-json {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1rem;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: #495057;
}

.config-json:empty:before {
  content: "Configuration will appear here after generation...";
  color: #6c757d;
  font-style: italic;
}

/* Modal Styling */
.modal-card {
  border-radius: var(--border-radius);
  max-width: 600px;
  margin: 2rem;
}

.modal-card-head {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-card-title {
  font-weight: 600;
  color: #495057;
}

/* Form Elements */
.field-group {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.field-group .label {
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.5rem;
}

.checkbox-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: white;
  border-radius: 4px;
  border: 1px solid #dee2e6;
}

/* Screen tabs styling */
.tabs.is-boxed ul {
  border-bottom-color: #dbdbdb;
}

.tabs.is-boxed li.is-active a {
  background-color: white;
  border-color: #dbdbdb;
  border-bottom-color: transparent !important;
}

.tabs.is-boxed li a:hover {
  background-color: #f5f5f5;
  border-bottom-color: #dbdbdb;
}

.tabs.is-boxed a {
  border: 1px solid transparent;
  border-radius: 4px 4px 0 0;
}

/* Screen dropdown styling */
#screen-dropdown .dropdown-content {
  max-height: 300px;
  overflow-y: auto;
}

#screen-dropdown .dropdown-item:hover {
  background-color: #f5f5f5;
}

#screen-dropdown .dropdown-item.is-active {
  background-color: #3273dc;
  color: white;
}

/* Hide individual screen cards when using tabs */
.screen-card.hidden {
  display: none;
}

/* Responsive design */
@media (max-width: 768px) {
  .field-grid {
    grid-template-columns: 1fr;
  }

  .columns {
    flex-wrap: wrap;
  }

  .column {
    flex: 1 0 100%;
  }

  .tabs.is-boxed {
    overflow-x: auto;
  }

  .tabs.is-boxed ul {
    flex-wrap: nowrap;
  }
}

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

.screen-container,
.sheet-item {
  animation: slideIn 0.3s ease-out;
}

/* API Data Modal */
.api-data-modal {
  padding: 1rem;
}

.api-data-modal .field-info {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  border-left: 4px solid #28a745;
}

.api-data-modal .field-info p {
  margin: 0;
  line-height: 1.6;
}

.api-data-modal #api-data-select {
  background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
  border: 2px solid #28a745;
}

.api-data-modal #preview-value {
  background: #f8f9fa;
  border: 2px dashed #28a745;
  font-family: "Courier New", monospace;
  font-weight: 600;
}

/* Pulse animation for API button */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

.api-data-btn:hover {
  animation: pulse 1.5s infinite;
}

/* Dropdown Options in Modal */
#dropdown-options-section {
  background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
  padding: 1rem;
  border-radius: 8px;
  border: 2px solid #28a745;
  margin-top: 1rem;
}

#dropdown-options-section .label {
  color: #155724;
  font-weight: 600;
}

#dropdown-options {
  border: 2px solid #28a745;
  background: white;
  font-family: "Segoe UI", sans-serif;
  line-height: 1.6;
}

#dropdown-options:focus {
  border-color: #1e7e34;
  box-shadow: 0 0 0 0.125em rgba(40, 167, 69, 0.25);
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 300px;
  border-radius: var(--border-radius);
}

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

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Collapsible Sheets Section */
.card-header[onclick] {
  transition: background-color 0.2s ease;
}

.card-header[onclick]:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

#sheets-content {
  transition: all 0.3s ease;
  overflow: hidden;
}

#sheets-toggle-btn {
  border: none;
  background: transparent;
}

#sheets-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

#sheets-toggle-btn i {
  transition: transform 0.3s ease;
}

#sheets-count {
  font-size: 0.75rem;
  background: rgba(50, 115, 220, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(50, 115, 220, 0.2);
}
