/* Admin Interface Components */

/* Login form */
.login-form {
  max-width: 400px;
  margin: 20vh auto;
}

.login-form header {
  margin-bottom: var(--space-lg);
}

.login-form h2 {
  margin-bottom: var(--space-xs);
}

.login-form p {
  color: var(--theme-text-muted);
}

/* Form elements */
.form-field {
  margin-bottom: var(--space-md);
}

.form-field label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--theme-text-muted);
  font-size: 0.875rem;
}

.form-field input,
.form-field select {
  width: 100%;
  padding: var(--space-sm);
  background: var(--theme-bg);
  border: 1px solid var(--theme-border);
  color: var(--theme-text);
  font-family: var(--font-mono);
}

.form-field input:not([type="checkbox"]):focus,
.form-field select:focus {
  outline: 2px solid var(--theme-primary, #3b82f6);
  outline-offset: -1px;
}

/* Toggle switch (replaces checkbox) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--theme-border);
  transition: 0.2s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--color-bull);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 2px var(--theme-surface), 0 0 0 4px var(--theme-border);
}

/* Modified state indicator */
.form-field input.modified {
  border-left: 3px solid var(--color-accent);
}

/* Parameter status summary */
.param-status {
  font-size: 0.75rem;
  color: var(--theme-text-muted);
  margin-bottom: var(--space-sm);
  font-family: var(--font-mono);
}

.param-status-item {
  display: inline;
  margin-right: var(--space-md);
}

.param-status-item strong {
  color: var(--color-bull);
}

/* Alert */
.alert {
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
  color: #ef4444;
}

/* Button */
.btn {
  padding: var(--space-md);
  background: var(--theme-primary, #3b82f6);
  border: none;
  color: white;
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
}

.btn:hover {
  opacity: 0.9;
}

.btn--inline {
  width: auto;
  min-width: 120px;
}

/* Admin market view - stack cards vertically */
.admin-market-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Spacing between major sections */
.site-main > section {
  margin-bottom: var(--space-xl);
}

.site-main > footer {
  margin-top: var(--space-xl);
}

/* Admin controls */
.admin-controls {
  display: grid;
  gap: var(--space-md);
}

.control-group {
  margin-bottom: var(--space-lg);
}

.control-group header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--theme-border);
}

.control-group h3 {
  font-size: 1rem;
}

/* Details/Summary (collapsible sections) */
.admin-details {
  margin-top: var(--space-md);
  border: 1px solid var(--theme-border);
  padding: var(--space-md);
}

.admin-details summary {
  cursor: pointer;
  font-weight: 500;
  user-select: none;
  margin: calc(-1 * var(--space-md));
  padding: var(--space-md);
}

.admin-details summary:hover {
  background: rgba(255, 255, 255, 0.05);
}

.admin-details[open] summary {
  border-bottom: 1px solid var(--theme-border);
  margin-bottom: var(--space-md);
}

.admin-details .grid {
  margin-top: var(--space-md);
}

.param-description {
  color: var(--theme-text-muted);
  font-size: 0.875rem;
  margin-top: var(--space-sm);
}

/* Parameter form buttons */
.params-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.params-actions .btn {
  max-width: 200px;
}

#shock-form .btn {
  margin-top: var(--space-md);
  max-width: 200px;
}

#price-adjust-form .btn {
  max-width: 200px;
  align-self: end;
  margin-top: var(--space-md);
}

/* Logout button */
.site-main > footer form {
  max-width: 200px;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  right: var(--space-md);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 400px;
}

.toast {
  padding: var(--space-md);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.toast--success {
  border-left: 3px solid var(--color-bull);
}

.toast--error {
  border-left: 3px solid var(--color-bear);
}

.toast--info {
  border-left: 3px solid var(--color-accent);
}

.toast.toast--removing {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(calc(100% + var(--space-md)));
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(calc(100% + var(--space-md)));
    opacity: 0;
  }
}
