/* panel/theme.css — Fase 9: light mode, toasts, skeleton, mobile */
/* Carregado APÓS style.css. Dark é default em style.css. */

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #d1d5db;
  --text: #1f2937;
  --text-muted: #6b7280;
  --primary: #2563eb;
  --success: #16a34a;
  --warning: #d97706;
  --error: #dc2626;
  --purple: #7c3aed;
  --cyan: #0891b2;
  --gold: #d4a017;
}

:root[data-theme="dark"] { color-scheme: dark; }

/* ── Toast ── */
.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10000;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  min-width: 240px;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--error); }
.toast.toast-warn    { border-left-color: var(--warning); }
.toast .toast-close {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@media (max-width: 600px) {
  .toasts { left: 8px; right: 8px; top: 8px; }
  .toast   { min-width: 0; width: 100%; }
}

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius);
  color: transparent !important;
  min-height: 1em;
  display: inline-block;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Toggle de tema ── */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
}
.theme-toggle:hover { background: var(--surface-2); }

/* ── Mobile ── */
@media (max-width: 768px) {
  .header { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .header .status { order: 3; width: 100%; font-size: 0.75rem; }
  .header .brand small { display: none; }
  .header .brand h1 { font-size: 1.1rem; }
  .actions-bar { overflow-x: auto; flex-wrap: nowrap; padding: 8px; }
  .actions-bar .btn-secondary { flex-shrink: 0; font-size: 0.75rem; padding: 6px 8px; }
  .actions-bar .btn-secondary .roles-badge { display: none; }
  .panel-header { flex-wrap: wrap; gap: 6px; }
  .panel-header .panel-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .chat-msg { max-width: 92%; }
  .modal {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px) !important;
    margin: 8px !important;
  }
  .modal-overlay { padding: 0 !important; align-items: flex-start !important; }
  .memory-body { padding: 8px !important; }
  .roles-list { padding: 8px !important; }
  .log-ts { display: none; }
  .log-tag { min-width: 60px; font-size: 0.65rem; }
  .chat-form { flex-wrap: wrap; }
  .chat-form .role-select { width: 100%; order: 0; }
  .chat-form textarea { width: 100%; order: 1; }
  .chat-form button[type="submit"] { order: 2; margin-left: auto; }
}

/* ── Activity states (Fase 9.1) ── */
@keyframes turtle-walk {
  0%, 100% { transform: scaleX(-1) translateY(0) rotate(-5deg); }
  50%      { transform: scaleX(-1) translateY(-2px) rotate(5deg); }
}
@keyframes turtle-breathe {
  0%, 100% { transform: scaleX(-1) scale(1); }
  50%      { transform: scaleX(-1) scale(1.18); }
}
/* O Jabuti (🐢) fica de frente para a DIREITA. O glifo do emoji já olha para a
   esquerda, então o scaleX(-1) base espelha a orientação; as animações abaixo
   repetem esse scaleX(-1) para não desfazer o espelhamento ao animar. */
.chat-typing .turtle-anim { transform: scaleX(-1); }
.chat-typing.activity-thinking .turtle-anim { animation: turtle-walk 1.2s ease-in-out infinite; display: inline-block; }
.chat-typing.activity-working  .turtle-anim { animation: turtle-breathe 0.8s ease-in-out infinite; display: inline-block; }
.chat-typing.activity-approving {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--warning);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.approval-inline { display: inline-flex; gap: 4px; margin-left: auto; }
.btn-approve, .btn-deny {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  font-weight: 600;
}
.btn-approve { background: rgba(34, 197, 94, 0.15); color: var(--success); border-color: var(--success); }
.btn-approve:hover { background: rgba(34, 197, 94, 0.3); }
.btn-deny    { background: rgba(239, 68, 68, 0.15); color: var(--error); border-color: var(--error); }
.btn-deny:hover    { background: rgba(239, 68, 68, 0.3); }
.chat-form textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--surface-2);
}
