/* Stuck Order Emailer — Custom styles on top of Pico CSS */

/* Flash messages */
.flash-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.flash-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

/* Status dots */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.status-dot.enabled {
  background-color: #28a745;
}

.status-dot.disabled {
  background-color: #adb5bd;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #adb5bd;
  border-radius: 26px;
  transition: 0.3s;
}

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

.toggle-switch input:checked + .toggle-slider {
  background-color: #28a745;
}

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

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--pico-card-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color, #dee2e6);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--pico-muted-color, #6c757d);
  margin: 0.25rem 0 0;
}

/* Template editor layout */
.editor-layout {
  display: flex;
  gap: 1rem;
  min-height: 600px;
}

.editor-sidebar {
  width: 220px;
  flex-shrink: 0;
  border: 1px solid var(--pico-muted-border-color, #dee2e6);
  border-radius: 8px;
  padding: 1rem;
  overflow-y: auto;
  max-height: 700px;
}

.editor-sidebar .file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.editor-sidebar .file-list li {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.9rem;
  word-break: break-all;
}

.editor-sidebar .file-list li:hover {
  background-color: var(--pico-muted-border-color, #dee2e6);
}

.editor-sidebar .file-list li.active {
  background-color: var(--pico-primary-background, #1095c1);
  color: #fff;
}

.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.editor-main .cm-editor {
  height: 450px;
  border: 1px solid var(--pico-muted-border-color, #dee2e6);
  border-radius: 4px;
}

.editor-main .cm-editor .cm-scroller {
  overflow: auto;
}

.editor-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.preview-frame {
  width: 100%;
  height: 400px;
  border: 1px solid var(--pico-muted-border-color, #dee2e6);
  border-radius: 4px;
  margin-top: 1rem;
  background: #fff;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.filter-bar label {
  margin-bottom: 0;
}

.filter-bar input,
.filter-bar select {
  margin-bottom: 0;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Nav active state */
nav a[aria-current="page"] {
  font-weight: 700;
}

/* Compact table */
table.compact td,
table.compact th {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.show {
  opacity: 1;
}

.toast.success {
  background-color: #28a745;
}

.toast.error {
  background-color: #dc3545;
}

/* Save status indicator */
.save-status {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

.save-status.saved {
  color: #28a745;
}

.save-status.unsaved {
  color: #ffc107;
}

.save-status.saving {
  color: #17a2b8;
}

.save-status.error {
  color: #dc3545;
}
