/* ck_alerts.css - Lallink Alerts dashboard */

/* ── Page layout ──────────────────────────────────────────── */
.cka-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ── Push permission banner ──────────────────────────────── */
.cka-push-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,200,150,.1);
  border: 1px solid rgba(0,200,150,.3);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text, #e8e8e8);
  margin-bottom: 20px;
}
.cka-push-banner span { flex: 1; }
.cka-push-banner button {
  background: #00C896;
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.cka-push-banner button:last-child {
  background: transparent;
  color: #888;
  padding: 5px 8px;
}
.cka-push-banner button:last-child:hover { color: #e8e8e8; }

/* ── Header ──────────────────────────────────────────────── */
.cka-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.cka-header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text, #e8e8e8);
}
.cka-header p { margin: 0; font-size: 13px; color: #888; }

/* ── Stats bar ───────────────────────────────────────────── */
.cka-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.cka-stat {
  background: var(--card-bg, #141414);
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 10px;
  padding: 14px 20px;
  min-width: 110px;
  flex: 1;
}
.cka-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: #00C896;
  line-height: 1;
  margin-bottom: 4px;
}
.cka-stat-lbl { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: .04em; }

/* ── Alert cards ─────────────────────────────────────────── */
.cka-list { display: flex; flex-direction: column; gap: 10px; }

.cka-card {
  background: var(--card-bg, #141414);
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 12px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  transition: border-color .15s;
}
.cka-card:hover { border-color: #2a2a2a; }
.cka-card.is-paused { opacity: .6; }

/* toggle */
.cka-toggle {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.cka-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.cka-toggle-track {
  position: absolute;
  inset: 0;
  background: #2a2a2a;
  border-radius: 11px;
  cursor: pointer;
  transition: background .2s;
}
.cka-toggle input:checked + .cka-toggle-track { background: #00C896; }
.cka-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.cka-toggle input:checked + .cka-toggle-track::after { transform: translateX(16px); }

/* info */
.cka-card-info { min-width: 0; }
.cka-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #e8e8e8);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cka-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cka-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.06);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
}
.cka-chip.green { color: #00C896; background: rgba(0,200,150,.1); }
.cka-chip.blue  { color: #6ea9ff; background: rgba(110,169,255,.1); }
.cka-chip.amber { color: #f0b843; background: rgba(240,184,67,.1); }

.cka-last-trigger { font-size: 11px; color: #555; margin-top: 4px; }

/* actions */
.cka-card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.cka-act-btn {
  background: transparent;
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 7px;
  color: #888;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.cka-act-btn:hover { border-color: #3a3a3a; color: #e8e8e8; }
.cka-act-btn.danger:hover { border-color: #FF4444; color: #FF4444; }
.cka-act-btn.history { color: #00C896; border-color: rgba(0,200,150,.3); }
.cka-act-btn.history:hover { border-color: #00C896; background: rgba(0,200,150,.08); }

/* ── Empty state ──────────────────────────────────────────── */
.cka-empty {
  text-align: center;
  padding: 64px 20px;
  color: #888;
}
.cka-empty-icon { font-size: 48px; margin-bottom: 16px; }
.cka-empty h3 { margin: 0 0 8px; font-size: 18px; color: var(--text, #e8e8e8); }
.cka-empty p  { margin: 0 0 20px; font-size: 14px; }

/* ── Alert Modal ─────────────────────────────────────────── */
.cka-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cka-modal {
  background: var(--card-bg, #141414);
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cka-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border, #1e1e1e);
  flex-shrink: 0;
}
.cka-modal-header h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text, #e8e8e8); }
.cka-modal-close {
  background: transparent;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.cka-modal-close:hover { color: #e8e8e8; background: rgba(255,255,255,.06); }

.cka-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}
.cka-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border, #1e1e1e);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Form fields ──────────────────────────────────────────── */
.cka-field { margin-bottom: 16px; }
.cka-field > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 7px;
}
.cka-field input[type="text"],
.cka-field input[type="url"],
.cka-field input[type="number"],
.cka-field select {
  width: 100%;
  background: var(--input-bg, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  color: var(--text, #e8e8e8);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.cka-field input:focus,
.cka-field select:focus { border-color: #00C896; }
.cka-field select option { background: #1a1a1a; }

.cka-radio-group,
.cka-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cka-radio-group label,
.cka-checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text, #e8e8e8);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.cka-radio-group input,
.cka-checkbox-group input { accent-color: #00C896; cursor: pointer; }

.cka-optional { color: #555; font-weight: 400; font-size: 11px; text-transform: none; letter-spacing: 0; }
.cka-credit-badge {
  background: rgba(240,184,67,.15);
  color: #f0b843;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}
.cka-credits-info { margin-top: 8px; font-size: 12px; color: #888; }

/* ── History page ────────────────────────────────────────── */
.cka-hist-page { max-width: 860px; margin: 0 auto; padding: 28px 20px 60px; }

.cka-hist-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #888;
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 20px;
}
.cka-hist-back:hover { color: #e8e8e8; }

.cka-hist-header { margin-bottom: 24px; }
.cka-hist-header h1 { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: var(--text, #e8e8e8); }
.cka-hist-header p  { margin: 0; font-size: 13px; color: #888; }

.cka-hist-chart-wrap {
  background: var(--card-bg, #141414);
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.cka-hist-chart-title {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 12px;
}
#ckaHistChart { display: block; width: 100%; }

.cka-trig-table {
  background: var(--card-bg, #141414);
  border: 1px solid var(--border, #1e1e1e);
  border-radius: 12px;
  overflow: hidden;
}
.cka-trig-head {
  display: grid;
  grid-template-columns: 1fr 80px 40px;
  padding: 10px 16px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid var(--border, #1e1e1e);
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cka-trig-row {
  border-bottom: 1px solid var(--border, #1e1e1e);
  cursor: pointer;
}
.cka-trig-row:last-child { border-bottom: none; }
.cka-trig-row-header {
  display: grid;
  grid-template-columns: 1fr 80px 40px;
  padding: 12px 16px;
  align-items: center;
  transition: background .12s;
}
.cka-trig-row-header:hover { background: rgba(255,255,255,.03); }
.cka-trig-time { font-size: 13px; color: var(--text, #e8e8e8); }
.cka-trig-count {
  font-size: 13px;
  color: #00C896;
  font-weight: 700;
  text-align: center;
}
.cka-trig-expand {
  font-size: 16px;
  color: #555;
  text-align: right;
  transition: transform .15s;
}
.cka-trig-row.open .cka-trig-expand { transform: rotate(90deg); }
.cka-trig-stocks {
  display: none;
  padding: 0 16px 14px;
  flex-wrap: wrap;
  gap: 6px;
}
.cka-trig-row.open .cka-trig-stocks { display: flex; }
.cka-stock-pill {
  background: rgba(255,255,255,.06);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #e8e8e8;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.cka-stock-pill:hover { background: rgba(0,200,150,.15); color: #00C896; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .cka-card { grid-template-columns: auto 1fr; }
  .cka-card-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .cka-header { flex-direction: column; }
  .cka-stat { min-width: 90px; }
}
