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

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

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

header {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

header h1 {
  text-align: center;
  margin-bottom: 15px;
  color: #2d3748;
  font-size: 1.8rem;
  font-weight: 700;
}

nav {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.nav-link {
  padding: 8px 16px;
  text-decoration: none;
  color: #4a5568;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.nav-link:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.nav-link.active {
  background: #667eea;
  color: white;
}

main {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
}

.message.success {
  background: #f0fff4;
  color: #22543d;
  border: 1px solid #9ae6b4;
}

.message.error {
  background: #fed7d7;
  color: #742a2a;
  border: 1px solid #fc8181;
}

.message.info {
  background: #ebf8ff;
  color: #2a4365;
  border: 1px solid #90cdf4;
}

.setup-warning {
  background: #fefcbf;
  border: 1px solid #f6e05e;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.setup-warning h3 {
  color: #744210;
  margin-bottom: 10px;
}

.setup-warning ul {
  margin: 15px 0;
  padding-left: 20px;
}

.setup-warning li {
  margin-bottom: 5px;
  color: #744210;
}

.main-form {
  margin-bottom: 30px;
}

.main-form h2 {
  margin-bottom: 20px;
  color: #2d3748;
}

.current-config {
  background: #f7fafc;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
}

.config-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.config-item:last-child {
  margin-bottom: 0;
}

.config-label {
  font-weight: 600;
  color: #4a5568;
  min-width: 120px;
}

.config-value {
  color: #2d3748;
  font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
  background: #edf2f7;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.webhook-url {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #4a5568;
}

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: #718096;
  font-size: 14px;
}

.form-group small a {
  color: #667eea;
  text-decoration: none;
}

.form-group small a:hover {
  text-decoration: underline;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 15px;
  margin-bottom: 20px;
}

.form-actions-preview,
.form-actions-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

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

.btn-primary:hover {
  background: #5a67d8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #e2e8f0;
  color: #4a5568;
}

.btn-secondary:hover {
  background: #cbd5e0;
}

.btn-success {
  background: #38a169;
  color: white;
}

.btn-success:hover {
  background: #2f855a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 161, 105, 0.4);
}

.btn-danger {
  background: #e53e3e;
  color: white;
}

.btn-danger:hover {
  background: #c53030;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.loader {
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.status-area {
  margin-top: 20px;
  min-height: 50px;
}

/* Countdown Display Styles */
.countdown-display {
  background: #fef5e7;
  border: 1px solid #f6ad55;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.countdown-text {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #744210;
  margin-bottom: 10px;
}

.countdown-bar {
  width: 100%;
  height: 12px;
  background: #fed7a1;
  border-radius: 6px;
  overflow: hidden;
}

.countdown-fill {
  height: 100%;
  background: linear-gradient(90deg, #f6ad55, #ed8936);
  border-radius: 6px;
  transition: width 1s linear;
  width: 100%;
}

/* Timing Info Styles */
.timing-info {
  background: #ebf8ff;
  border: 1px solid #90cdf4;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
}

.timing-info h4 {
  color: #2a4365;
  margin-bottom: 10px;
}

.timing-info ul {
  margin: 0;
  padding-left: 20px;
}

.timing-info li {
  color: #2a4365;
  margin-bottom: 5px;
}

/* Webhook Configuration Styles */
.webhook-info {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-top: 15px;
}

.webhook-url-display {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.webhook-url-display code {
  flex: 1;
  background: #edf2f7;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #2d3748;
  font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
}

.bearer-token-section {
  margin-top: 10px;
}

.bearer-token-display {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bearer-token-display code {
  flex: 1;
  background: #f0fff4;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #22543d;
  font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
  border: 1px solid #9ae6b4;
}

.token-status {
  margin-bottom: 15px;
}

.status-indicator {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
}

.status-indicator.success {
  background: #f0fff4;
  color: #22543d;
  border: 1px solid #9ae6b4;
}

.no-token {
  color: #718096;
  font-style: italic;
  margin-bottom: 10px;
}

.webhook-details {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.webhook-details h4 {
  color: #2d3748;
  margin-bottom: 15px;
}

.request-example {
  margin-top: 15px;
}

.request-section {
  margin-bottom: 15px;
}

.request-section h5 {
  color: #4a5568;
  margin-bottom: 5px;
  font-size: 1rem;
}

.request-section code {
  background: #edf2f7;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #2d3748;
  display: inline-block;
  font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
}

.request-section pre {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 15px;
  overflow-x: auto;
  margin: 5px 0;
}

.request-section pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  display: block;
}

.webhook-test {
  background: #f0fff4;
  border: 1px solid #9ae6b4;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
}

.webhook-test h4 {
  color: #22543d;
  margin-bottom: 10px;
}

.webhook-test p {
  color: #22543d;
  margin-bottom: 10px;
}

.test-command pre {
  background: #22543d;
  color: #f0fff4;
  border: none;
  border-radius: 6px;
  padding: 15px;
  overflow-x: auto;
  margin: 10px 0;
}

.test-command code {
  color: #f0fff4;
  background: none;
}

/* Progress Container Styles */
.progress-container {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.progress-header h3 {
  color: #2d3748;
  margin: 0;
}

.progress-bar-container {
  margin-bottom: 20px;
}

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

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38a169, #48bb78);
  border-radius: 10px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  font-weight: 600;
  color: #4a5568;
}

.progress-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.progress-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.progress-label {
  font-weight: 600;
  color: #4a5568;
  font-size: 14px;
}

.progress-value {
  font-weight: 700;
  color: #2d3748;
}

.current-team {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  font-weight: 600;
  color: #2d3748;
  text-align: center;
}

.progress-log {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 15px;
}

.progress-log h4 {
  color: #2d3748;
  margin-bottom: 10px;
}

.log-container {
  max-height: 200px;
  overflow-y: auto;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px;
}

.log-entry {
  padding: 2px 0;
  font-size: 14px;
  font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
  color: #4a5568;
}

.log-entry.log-success {
  color: #22543d;
}

.log-entry.log-error {
  color: #742a2a;
}

.log-entry.log-warning {
  color: #744210;
}

.log-entry.log-info {
  color: #2a4365;
}

/* Webhook Progress Styles */
.webhook-progress {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
}

.webhook-progress h3 {
  color: #2d3748;
  margin-bottom: 15px;
}

.webhook-log {
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 15px;
}

/* Table Selection Styles */
.table-select {
  font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
}

.selected-table-info {
  margin-top: 10px;
}

.table-badge {
  display: inline-block;
  background: #e6fffa;
  color: #234e52;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  border: 1px solid #38b2ac;
}

/* Table Preview Styles */
.table-preview {
  background: #f7fafc;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid #e2e8f0;
}

.table-preview h3 {
  color: #2d3748;
  margin-bottom: 15px;
}

.structure-overview {
  margin-bottom: 25px;
}

.structure-overview h4 {
  color: #4a5568;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.column-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 12px;
  font-size: 0.9rem;
}

.column-item.team-name-column {
  border-left: 4px solid #38a169;
  background: #f0fff4;
}

.column-item.color-column {
  border-left: 4px solid #e53e3e;
  background: #fff5f5;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.column-name {
  font-weight: 600;
  color: #2d3748;
}

.column-type {
  font-size: 0.8rem;
  color: #718096;
  font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
  background: #edf2f7;
  padding: 2px 6px;
  border-radius: 3px;
}

.column-required,
.column-default,
.column-role {
  display: block;
  font-size: 0.8rem;
  color: #718096;
  margin-top: 2px;
}

.column-required {
  color: #e53e3e;
  font-weight: 500;
}

.column-role {
  color: #667eea;
  font-weight: 600;
}

.data-preview h4 {
  color: #4a5568;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.table-container {
  overflow-x: auto;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #edf2f7;
  font-weight: 600;
  color: #2d3748;
}

.data-table th.team-name-col {
  background: #c6f6d5;
  color: #22543d;
}

.data-table th.color-col {
  background: #fed7d7;
  color: #742a2a;
}

.color-cell {
  background: #fef5e7;
}

.text-cell {
  background: #f0fff4;
}

.empty-cell {
  color: #a0aec0;
  font-style: italic;
}

.color-preview {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid #cbd5e0;
  display: inline-block;
}

/* Structure Analysis */
.structure-analysis {
  background: white;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.structure-analysis h4 {
  color: #2d3748;
  margin-bottom: 15px;
}

.analysis-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.analysis-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f7fafc;
  border-radius: 6px;
  border-left: 4px solid #e2e8f0;
}

.analysis-item.success {
  background: #f0fff4;
  border-left-color: #38a169;
}

.analysis-item.warning {
  background: #fefcbf;
  border-left-color: #d69e2e;
}

.analysis-label {
  font-weight: 600;
  color: #4a5568;
}

.analysis-value {
  color: #2d3748;
  font-weight: 500;
}

.ready-indicator,
.warning-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
}

.ready-indicator {
  background: #f0fff4;
  color: #22543d;
  border: 1px solid #9ae6b4;
}

.warning-indicator {
  background: #fefcbf;
  color: #744210;
  border: 1px solid #f6e05e;
}

.status-icon {
  font-size: 1.2rem;
}

.info-section {
  background: #f7fafc;
  border-radius: 8px;
  padding: 20px;
  margin-top: 30px;
}

.info-section h3 {
  color: #2d3748;
  margin-bottom: 15px;
}

.info-section ol,
.info-section ul {
  padding-left: 20px;
}

.info-section li {
  margin-bottom: 8px;
  color: #4a5568;
}

.activepieces-info {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.activepieces-info h4 {
  color: #2d3748;
  margin-bottom: 15px;
}

.architecture-diagram {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin: 15px 0;
}

.arch-step {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px;
  background: white;
  border-radius: 6px;
  margin: 10px 0;
  border-left: 3px solid #667eea;
}

.arch-number {
  background: #667eea;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.arch-text {
  color: #2d3748;
  font-weight: 500;
}

.arch-arrow {
  text-align: center;
  font-size: 20px;
  color: #667eea;
  margin: 5px 0;
}

.config-warning {
  background: #fef5e7;
  border: 1px solid #f6ad55;
  border-radius: 8px;
  padding: 15px;
  margin: 15px 0;
}

.config-warning h4 {
  color: #744210;
  margin-bottom: 10px;
}

.config-warning ul {
  margin: 0;
  padding-left: 20px;
}

.config-warning li {
  color: #744210;
  margin-bottom: 5px;
}

.activepieces-info pre {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 15px;
  overflow-x: auto;
  font-size: 0.9rem;
  margin: 10px 0;
}

.activepieces-info code {
  color: #2d3748;
  font-family: 'SF Mono', 'Monaco', 'Roboto Mono', monospace;
}

/* Configuration page styles */
.config-form {
  max-width: 100%;
}

.config-section {
  margin-bottom: 30px;
  padding: 20px;
  background: #f7fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.config-section h2 {
  color: #2d3748;
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.provider-selection {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
}

.radio-card {
  display: block;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.radio-card input[type="radio"] {
  display: none;
}

.radio-content {
  padding: 15px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  transition: all 0.2s ease;
}

.radio-card input[type="radio"]:checked + .radio-content {
  border-color: #667eea;
  background: #ebf8ff;
}

.radio-content h3 {
  margin-bottom: 5px;
  color: #2d3748;
  font-size: 1.1rem;
}

.radio-content p {
  color: #718096;
  margin: 0;
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.help-section {
  margin-top: 20px;
}

.help-section summary {
  cursor: pointer;
  font-weight: 600;
  color: #667eea;
  padding: 10px 0;
}

.help-section ol {
  margin-top: 10px;
  padding-left: 20px;
}

.help-section li {
  margin-bottom: 8px;
  color: #4a5568;
}

.help-section code {
  background: #edf2f7;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #2d3748;
}

.step-guide {
  margin-top: 15px;
}

.step-guide h4 {
  color: #2d3748;
  margin: 15px 0 8px 0;
  font-size: 1rem;
}

.step-guide ul {
  margin: 8px 0;
  padding-left: 20px;
}

.step-guide li {
  margin-bottom: 5px;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  header, main {
    padding: 20px;
  }
  
  .form-actions,
  .form-actions-preview,
  .form-actions-inline {
    flex-direction: column;
  }
  
  .nav {
    flex-direction: column;
    align-items: center;
  }
  
  .config-section {
    padding: 15px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .columns-grid {
    grid-template-columns: 1fr;
  }
  
  .table-container {
    font-size: 12px;
  }
  
  .data-table th,
  .data-table td {
    padding: 6px 8px;
  }
  
  .analysis-grid {
    gap: 8px;
  }
  
  .analysis-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .progress-details {
    grid-template-columns: 1fr;
  }
  
  .progress-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .webhook-url {
    max-width: 200px;
  }
  
  .arch-step {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
  
  .webhook-url-display,
  .bearer-token-display {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }
}
