/* Automation/Scripting System Styles */

.automation-content {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.automation-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Tabs */
.automation-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

.automation-tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.automation-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.automation-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

/* Scripting Header */
.scripting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  margin-bottom: 20px;
}

.scripting-toggle label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
}

.scripting-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.scripting-actions {
  display: flex;
  gap: 10px;
}

.create-script-btn {
  padding: 8px 16px;
  background: var(--accent-green);
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.create-script-btn:hover {
  background: #00ff88;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.import-scripts-btn,
.export-scripts-btn {
  padding: 8px 16px;
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.import-scripts-btn:hover,
.export-scripts-btn:hover {
  background: rgba(0, 191, 255, 0.1);
  border-color: var(--accent-blue);
}

/* Scripts List */
.scripts-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 500px;
  overflow-y: auto;
}

.no-scripts {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.no-scripts p {
  margin: 5px 0;
}

/* Script Item */
.script-item {
  background: var(--bg-panel-hover);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  transition: all 0.2s ease;
}

.script-item.enabled {
  border-color: var(--accent-green);
  background: rgba(0, 255, 136, 0.05);
}

.script-item.disabled {
  opacity: 0.6;
}

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

.script-enable {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.script-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-cyan);
}

.script-actions button {
  padding: 4px 10px;
  margin-left: 5px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.script-actions button:hover {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.script-delete-btn:hover {
  border-color: var(--accent-red) !important;
  color: var(--accent-red) !important;
}

/* Script Details */
.script-details {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  font-size: 13px;
}

.script-details .label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  margin-right: 5px;
}

.script-conditions,
.script-actions-display,
.script-cooldown {
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

/* Presets */
.presets-info {
  text-align: center;
  padding: 15px;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.presets-info .warning {
  color: var(--accent-yellow);
  font-weight: 600;
  margin-top: 10px;
}

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

.preset-card {
  background: var(--bg-panel-hover);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s ease;
}

.preset-card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
}

.preset-card.active {
  border-color: var(--accent-green);
  background: rgba(0, 255, 136, 0.05);
}

.preset-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.preset-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-cyan);
  margin-bottom: 5px;
}

.preset-description {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.preset-script-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.apply-preset-btn {
  padding: 8px 20px;
  background: var(--accent-blue);
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.apply-preset-btn:hover {
  background: #00d4ff;
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

.preset-actions {
  text-align: center;
  margin-top: 20px;
}

.clear-scripts-btn {
  padding: 10px 20px;
  background: var(--accent-red);
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-scripts-btn:hover {
  background: #ff4444;
}

/* Stats */
.automation-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-panel-hover);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.stat-card.full-width {
  grid-column: 1 / -1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 5px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Conditions/Actions Reference */
.available-conditions,
.available-actions {
  margin-bottom: 20px;
}

.available-conditions h4,
.available-actions h4 {
  color: var(--accent-blue);
  margin-bottom: 15px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}

.conditions-grid,
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}

.condition-category,
.action-category {
  background: var(--bg-panel-hover);
  border-radius: 8px;
  padding: 10px;
}

.category-header {
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-color);
}

.category-items {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.condition-tag,
.action-tag {
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Script Editor Modal */
.script-editor-content {
  max-width: 600px;
}

.script-form {
  margin: 20px 0;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
  width: 100%;
  padding: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 14px;
}

.form-group input:focus {
  border-color: var(--accent-blue);
  outline: none;
}

/* Condition/Action Editors */
.conditions-list,
.actions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.condition-editor,
.action-editor {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.condition-type,
.action-type {
  flex: 1;
  padding: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
}

.condition-params,
.action-params {
  display: flex;
  gap: 5px;
}

.condition-param,
.action-param {
  width: 100px;
  padding: 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 13px;
}

.remove-condition-btn,
.remove-action-btn {
  padding: 5px 10px;
  background: var(--accent-red);
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-weight: bold;
}

.add-condition-btn,
.add-action-btn {
  padding: 8px 16px;
  background: var(--bg-panel);
  border: 1px dashed var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-condition-btn:hover,
.add-action-btn:hover {
  background: rgba(0, 191, 255, 0.1);
  border-color: var(--accent-blue);
  color: var(--text-primary);
}

.editor-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.save-script-btn {
  flex: 1;
  padding: 12px;
  background: var(--accent-green);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.save-script-btn:hover {
  background: #00ff88;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.cancel-btn {
  padding: 12px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cancel-btn:hover {
  background: var(--bg-panel-hover);
  color: var(--text-primary);
}

/* Import Dialog */
.import-dialog .modal-content {
  max-width: 500px;
}

.import-dialog textarea {
  width: 100%;
  height: 200px;
  padding: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: monospace;
  resize: vertical;
  margin-bottom: 15px;
}

.import-options {
  margin-bottom: 15px;
}

.import-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.import-actions {
  display: flex;
  gap: 10px;
}

.import-btn {
  flex: 1;
  padding: 12px;
  background: var(--accent-blue);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.import-btn:hover {
  background: #00d4ff;
}

/* Responsive */
@media (max-width: 768px) {
  .scripting-header {
    flex-direction: column;
    gap: 15px;
  }

  .script-details {
    grid-template-columns: 1fr;
  }

  .automation-stats {
    grid-template-columns: 1fr;
  }

  .presets-grid {
    grid-template-columns: 1fr;
  }

  .condition-editor,
  .action-editor {
    flex-wrap: wrap;
  }
}
