/* rec-rules.css — Recommendation Rules Page */

.page-content {
  max-width: 900px;
  margin: 80px auto 48px;
  padding: 0 20px;
}

/* ── Glass card ──────────────────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-glass);
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-sec);
  margin-top: 4px;
  width: 100%;
}

.panel-content {
  padding: 20px 24px 24px;
}

/* ── Rules table ─────────────────────────────────────────────── */
.rules-table {
  width: 100%;
  border-collapse: collapse;
}

.rules-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-glass);
}

.rules-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
}

.rules-table tr:last-child td {
  border-bottom: none;
}

.rule-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: block;
  margin-bottom: 3px;
}

.rule-desc {
  font-size: 12px;
  color: var(--text-sec);
  line-height: 1.4;
}

.rule-formula {
  display: inline-block;
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: 11px;
  color: var(--text-sec);
  background: var(--bg-surface, rgba(255,255,255,0.05));
  border: 1px solid var(--border-glass);
  border-radius: 4px;
  padding: 2px 7px;
  margin-top: 6px;
}

.rule-formula-label {
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.6;
  margin-right: 3px;
}

.rule-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.rule-value-input {
  width: 110px;
}

select.input-dark {
  width: 130px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.save-btn {
  flex-shrink: 0;
}

.save-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(52, 199, 89, 0.15);
  color: var(--success, #34c759);
  border: 1px solid rgba(52, 199, 89, 0.3);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
}

.save-badge.visible {
  opacity: 1;
}

/* ── Note card ──────────────────────────────────────────────── */
.note-card {
  margin-top: 20px;
  background: rgba(255, 159, 10, 0.07);
  border: 1px solid rgba(255, 159, 10, 0.2);
  border-radius: var(--radius-card, 12px);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.note-card i {
  color: #ff9f0a;
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.note-card p {
  font-size: 13px;
  color: var(--text-sec);
  line-height: 1.6;
  margin: 0;
}

.note-card a {
  color: var(--accent, #0a84ff);
  text-decoration: none;
  font-weight: 500;
}

.note-card a:hover {
  text-decoration: underline;
}

/* ── Empty / loading state ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-sec);
  font-size: 14px;
}

.empty-state i {
  display: block;
  font-size: 28px;
  margin-bottom: 10px;
  opacity: 0.5;
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent, #0a84ff);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Updated-at chip ─────────────────────────────────────────── */
.updated-chip {
  font-size: 11px;
  color: var(--text-sec);
  white-space: nowrap;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .rules-table thead { display: none; }
  .rules-table tr { display: block; padding: 12px 0; }
  .rules-table td {
    display: block;
    padding: 4px 0;
    border: none;
  }
  .rule-input-wrap { flex-wrap: wrap; }
}
