/* =========================================================
   AKUSENTO TELEMETRY & DIALOGS
   ========================================================= */

/* --- Telemetry Dashboard Widget --- */
.aku-telemetry-widget {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999998;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  border-radius: 8px;
  overflow: hidden; /* Ensures child buttons respect the border radius */
}

.aku-btn-stats {
  padding: 10px 15px;
  background: #34495e;
  color: #ecf0f1;
  border: none;
  font-family: monospace;
  font-size: 14px;
  text-align: left;
  min-width: 180px;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

.aku-btn-stats.is-exported {
  background-color: #4caf50;
}

.aku-btn-stats.is-paused {
  opacity: 0.7;
}

.aku-stats-container { line-height: 1.4; padding: 2px 0; }
.aku-stats-title { font-size: 13px; font-weight: bold; }
.aku-stats-mtbf { font-size: 11px; opacity: 0.8; }
.aku-stats-row { font-size: 12px; }
.aku-stats-row.has-errors { color: #f1c40f; }
.aku-stats-row.has-errors-core { color: #e67e22; }
.aku-stats-row.no-errors { color: #2ecc71; }
.aku-stats-avg { opacity: 0.6; font-size: 10px; }
.aku-stats-bottom { font-size: 11px; opacity: 0.7; margin-top: 2px; display: block; }

.aku-btn-pause, .aku-btn-edit, .aku-btn-reset {
  padding: 10px;
  font-size: 16px;
  color: #ffffff;
  border: none;
  border-top: 1px solid grey;
  cursor: pointer;
  transition: background-color 0.2s;
}

.aku-btn-pause { background-color: #2c3e50; }
.aku-btn-pause.is-paused { background-color: #f39c12; }
.aku-btn-edit { background-color: #2980b9; }
.aku-btn-edit:hover { background-color: #3498db; }
.aku-btn-reset { background-color: #c0392b; }
.aku-btn-reset:hover { background-color: #e74c3c; }


/* --- JSON Editor Overlay --- */
.aku-editor-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: rgba(0,0,0,0.8); z-index: 999999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.aku-editor-box {
  width: 80%; max-width: 800px; height: 80vh; background-color: #2c3e50;
  border-radius: 8px; display: flex; flex-direction: column; padding: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5); font-family: sans-serif; color: #ecf0f1;
}

.aku-editor-title {
  margin-top: 0; font-size: 18px; display: flex; justify-content: space-between;
}
.aku-editor-subtitle { font-size: 12px; color: #bdc3c7; font-weight: normal; }

.aku-editor-textarea {
  flex: 1; width: 100%; background-color: #1a252f; color: #2ecc71;
  border: 1px solid #34495e; border-radius: 4px; padding: 10px;
  font-family: monospace; font-size: 14px; resize: none; outline: none; box-sizing: border-box;
}

.aku-editor-actions { display: flex; gap: 10px; margin-top: 15px; justify-content: flex-end; }
.aku-btn-save { padding: 10px 20px; background-color: #27ae60; color: white; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }
.aku-btn-cancel { padding: 10px 20px; background-color: #7f8c8d; color: white; border: none; border-radius: 4px; cursor: pointer; }


/* --- Right-Click / Left-Click Dialog --- */
.akusento-dialog {
  background: var(--surface);
  color: var(--paper);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--widget-radius);
  padding: 16px;
  font-family: var(--en-font, sans-serif);
  width: 260px;
  box-sizing: border-box;
  position: absolute;
}

.aku-dialog-header {
  font-size: 1.1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-family: var(--ja-font, sans-serif);
}

.aku-dialog-header span {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85rem;
  margin-left: 6px;
}

.aku-dialog-select, .aku-dialog-input {
  background: var(--surface-2);
  color: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--widget-radius);
  padding: 8px 10px;
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  font-family: var(--en-font, sans-serif);
  margin-bottom: 8px;
}

.aku-dialog-select:focus, .aku-dialog-input:focus {
  border-color: var(--accent);
}

.aku-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.aku-btn-primary, .aku-btn-secondary {
  border: none;
  border-radius: var(--widget-radius);
  padding: 8px 4px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: filter 0.2s ease;
}

.aku-btn-primary:hover, .aku-btn-secondary:hover { filter: brightness(1.15); }
.aku-btn-primary { background: var(--accent); flex: 1; }
.aku-btn-primary.is-sending { background: #95a5a6; pointer-events: none; }
.aku-btn-primary.is-success { background: #2ecc71; }
.aku-btn-primary.is-error { background: #e74c3c; }
.aku-btn-secondary { background: var(--surface-3); color: var(--paper); flex: 0 0 auto; padding: 8px 14px; }


/* --- Rule Toast --- */
#rule-toast {
  background: var(--surface);
  color: var(--paper);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--widget-radius);
  padding: 12px 18px;
  font-family: var(--en-font, sans-serif);
  font-size: 15px;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 10000;
  max-width: 350px;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  position: fixed;
}

#rule-toast.is-visible {
  opacity: 1;
  visibility: visible;
}

.aku-toast-label { color: var(--accent); font-weight: bold; }
.aku-toast-rule-single { margin-right: 5px; }
.aku-toast-rule-multi { display: block; margin-bottom: 6px; }
.aku-toast-item { margin-bottom: 4px; padding-left: 10px; text-indent: -10px; }

.aku-toast-divider {
  border-top: 1px dashed var(--border);
  margin-top: 12px;
  padding-top: 8px;
  text-align: center;
}

.aku-toast-btn {
  width: 40%;
  padding: 6px;
  background: var(--surface-3);
  color: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--widget-radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: color 0.2s, border-color 0.2s;
  float: right;
}

.aku-toast-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Visual Marks on Logged Words --- */
.aku-error-marked-local {
  border-bottom: 2px dashed #e67e22 !important;
  background-color: rgba(230, 126, 34, 0.1) !important;
}

.aku-error-marked-cloud {
  border-bottom: 2px dashed #3498db !important;
  background-color: rgba(52, 152, 219, 0.1) !important;
}