/* Muspelheim Client Scripts UI Styles */

#mudscript-panel {
  position: fixed;
  right: -440px;
  top: 0;
  width: 440px;
  height: 100vh;
  background: #2b2b2b;
  color: #eee;
  border-left: 2px solid #4a3825;
  box-shadow: -4px 0 10px rgba(0,0,0,.4);
  transition: right .3s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
}

#mudscript-panel.open {
  right: 0;
}

.mudscript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(to bottom, #3a3a3a, #2a2a2a);
  border-bottom: 2px solid #4a3825;
}

.mudscript-header h2 {
  margin: 0;
  font-size: 18px;
  color: #fff;
  font-family: 'vikingregular', Georgia, serif;
  font-weight: normal;
}

.mudscript-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

#mudscript-status-text {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 600;
  transition: all .2s;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

.status-enabled {
  background: linear-gradient(to bottom, #4a7a2a, #3a5a1a);
  color: #fff;
  border: 2px solid #2d5016;
}

.status-enabled:hover {
  background: linear-gradient(to bottom, #5a8a3a, #4a6a2a);
  transform: translateY(-1px);
}

.status-disabled {
  background: linear-gradient(to bottom, #a04040, #803030);
  color: #fff;
  border: 2px solid #602020;
}

.status-disabled:hover {
  background: linear-gradient(to bottom, #b05050, #904040);
  transform: translateY(-1px);
}

.mudscript-tabs {
  display: flex;
  border-bottom: 2px solid #4a3825;
  background: #252525;
}

.mudscript-tab {
  flex: 1;
  background: transparent;
  color: #aaa;
  padding: 10px 8px;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all .2s;
}

.mudscript-tab:hover {
  background: #2f2f2f;
  color: #fff;
}

.mudscript-tab.active {
  background: #3a3a3a;
  color: #fff;
  border-bottom: 2px solid #8b7355;
}

.mudscript-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
}

/* Script items */
.script-item {
  background: #333;
  border: 1px solid #4a3825;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  transition: all .2s;
}

.script-item:hover {
  border-color: #8b7355;
  background: #383838;
}

.script-item.disabled {
  opacity: 0.5;
  background: #2a2a2a;
}

.script-item strong {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.script-detail {
  font-size: 12px;
  color: #aaa;
  margin-top: 6px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.script-detail code {
  background: #222;
  padding: 2px 6px;
  border-radius: 3px;
  color: #8bc34a;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.script-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
}

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  background: #4a3825;
  color: #d5c5a0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.var-type {
  font-size: 11px;
  color: #8b7355;
  font-style: italic;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.empty-state {
  text-align: center;
  color: #888;
  padding: 40px 20px;
  font-style: italic;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(to bottom, #8b7355, #6b5335);
  color: #fff;
  border: 2px solid #4a3825;
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all .2s;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
}

.btn-primary:hover {
  background: linear-gradient(to bottom, #9b8365, #7b6345);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #444;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all .2s;
}

.btn-secondary:hover {
  background: #555;
  border-color: #666;
}

.btn-small {
  background: #444;
  color: #eee;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all .2s;
}

.btn-small:hover {
  background: #555;
}

/* Danger button - red gradient style matching other buttons */
.btn-danger {
  background: linear-gradient(to bottom, #a04040, #803030);
  color: #fff;
  border: 2px solid #602020;
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all .2s;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

.btn-danger:hover {
  background: linear-gradient(to bottom, #b05050, #904040);
  transform: translateY(-1px);
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  margin-bottom: 6px;
  color: #8b7355;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  background: #1a1a1a;
  color: #eee;
  border: 1px solid #4a3825;
  border-radius: 4px;
  padding: 10px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  box-sizing: border-box;
}

.form-group select,
.action-type {
  width: 100%;
  background: #1a1a1a;
  color: #eee;
  border: 1px solid #4a3825;
  border-radius: 4px;
  padding: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  box-sizing: border-box;
  cursor: pointer;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus,
.action-type:focus {
  outline: none;
  border-color: #8b7355;
  background: #222;
}

.form-group input[type="checkbox"] {
  margin-right: 6px;
  accent-color: #8b7355;
}

.form-group textarea {
  resize: vertical;
  line-height: 1.4;
}

/* Modal */
.mudscript-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  backdrop-filter: blur(2px);
}

.mudscript-modal-content {
  background: #2b2b2b;
  color: #eee;
  border: 2px solid #4a3825;
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

.mudscript-modal-content h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #fff;
  font-size: 18px;
  font-family: 'vikingregular', Georgia, serif;
  font-weight: normal;
  border-bottom: 2px solid #4a3825;
  padding-bottom: 12px;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 2px solid #4a3825;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  #mudscript-panel {
    width: 100%;
    right: -100%;
  }

  .mudscript-modal-content {
    width: 95%;
    max-height: 90vh;
    padding: 16px;
  }

  .mudscript-tabs {
    font-size: 11px;
  }

  .mudscript-tab {
    padding: 8px 4px;
  }
}

/* Editor Layout (2-column: form + help) */
.editor-layout {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.editor-main {
  flex: 2;
  min-width: 0;
}

.editor-help {
  flex: 1;
  background: #1f1f1f;
  border: 1px solid #4a3825;
  border-radius: 6px;
  padding: 14px;
  font-size: 11px;
  max-height: 500px;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.editor-help h4 {
  margin: 0 0 10px 0;
  font-size: 11px;
  color: #8b7355;
  border-bottom: 1px solid #4a3825;
  padding-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.editor-help h4:not(:first-child) {
  margin-top: 16px;
}

.help-item {
  margin-bottom: 12px;
  line-height: 1.4;
}

.help-item strong {
  color: #8bc34a;
  font-size: 11px;
}

.help-item code {
  display: block;
  background: #0a0a0a;
  color: #8bc34a;
  padding: 3px 6px;
  margin-top: 3px;
  border-radius: 3px;
  font-size: 10px;
}

/* Mobile: stack layout vertically */
@media (max-width: 768px) {
  .editor-layout {
    flex-direction: column;
  }

  .editor-help {
    max-height: 250px;
  }
}

/* Scrollbar styling */
.mudscript-content::-webkit-scrollbar,
.mudscript-modal-content::-webkit-scrollbar,
.editor-help::-webkit-scrollbar {
  width: 6px;
}

.mudscript-content::-webkit-scrollbar-track,
.mudscript-modal-content::-webkit-scrollbar-track,
.editor-help::-webkit-scrollbar-track {
  background: #1a1a1a;
}

.mudscript-content::-webkit-scrollbar-thumb,
.mudscript-modal-content::-webkit-scrollbar-thumb,
.editor-help::-webkit-scrollbar-thumb {
  background: #4a3825;
  border-radius: 3px;
}

.mudscript-content::-webkit-scrollbar-thumb:hover,
.mudscript-modal-content::-webkit-scrollbar-thumb:hover,
.editor-help::-webkit-scrollbar-thumb:hover {
  background: #6b5335;
}
