/* ============================================================
 * ADMIN DASHBOARD - estilos
 * Mesma paleta da Desec, mas mais "operacional"
 * ============================================================ */

:root {
  --color-black: #000000;
  --color-bg-elevated: #0a0a0a;
  --color-bg-card: #0f0f0f;
  --color-bg-hover: #141414;
  --color-border: #1a1a1a;
  --color-border-strong: #2a2a2a;
  --color-white: #f4f5f1;
  --color-gray: #a7adad;
  --color-muted: #727878;
  --color-yellow: #ebee00;
  --color-red: #e53935;
  --color-green: #4ade80;
  --color-blue: #60a5fa;
  --color-orange: #fb923c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-black);
  color: var(--color-gray);
  line-height: 1.5;
  min-height: 100vh;
}

.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
 * HEADER
 * ============================================================ */
.admin-header {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-black);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-header__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-white);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.admin-header__dot {
  width: 8px;
  height: 8px;
  background: var(--color-yellow);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(235, 238, 0, 0.5);
}

.admin-header__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.admin-header__logout {
  color: var(--color-muted);
  text-decoration: none;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-header__logout:hover {
  color: var(--color-yellow);
  border-color: var(--color-yellow);
}

/* ============================================================
 * SECTION
 * ============================================================ */
.admin-section {
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
}

.admin-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-section__title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.25rem;
}

.admin-section__actions {
  display: flex;
  gap: 0.5rem;
}

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

.stat-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.stat-card:hover {
  background: var(--color-bg-card);
  border-color: var(--color-border-strong);
}

.stat-card__label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-white);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-card__value small {
  font-size: 1rem;
  color: var(--color-gray);
  font-weight: 500;
}

/* ============================================================
 * BREAKDOWN (por perfil / canal)
 * ============================================================ */
.breakdown-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .breakdown-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.breakdown-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1.25rem;
}

.breakdown-card__title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.breakdown-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.breakdown-list__item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
}

.breakdown-list__label {
  font-size: 0.8125rem;
  color: var(--color-gray);
}

.breakdown-list__value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-white);
  font-variant-numeric: tabular-nums;
}

.breakdown-list__bar {
  width: 60px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.breakdown-list__bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--color-yellow);
  border-radius: 2px;
}

.breakdown-list__empty {
  color: var(--color-muted);
  font-size: 0.8125rem;
  padding: 0.5rem 0;
}

/* ============================================================
 * FILTERS
 * ============================================================ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1 1 160px;
}

.filter__label {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
}

.filter__input,
.filter__select {
  background: var(--color-black);
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  color: var(--color-white);
  font-size: 0.8125rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.2s ease;
}

.filter__input:focus,
.filter__select:focus {
  outline: none;
  border-color: var(--color-yellow);
}

.filter__select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3e%3cpath d='M1 1L5 5L9 1' stroke='%23727878' stroke-width='1.5'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* ============================================================
 * BUTTONS
 * ============================================================ */
.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--color-yellow);
  color: var(--color-black);
  border: 1px solid var(--color-yellow);
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-decoration: none;
}

.admin-btn:hover:not(:disabled) {
  background: #f5f700;
  border-color: #f5f700;
}

.admin-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.admin-btn--ghost {
  background: transparent;
  color: var(--color-gray);
  border-color: var(--color-border-strong);
}

.admin-btn--ghost:hover:not(:disabled) {
  background: var(--color-bg-card);
  color: var(--color-white);
  border-color: var(--color-yellow);
}

/* ============================================================
 * TABLE
 * ============================================================ */
.table-wrapper {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow-x: auto;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.leads-table thead th {
  background: var(--color-bg-card);
  padding: 0.75rem 1rem;
  text-align: left;
  color: var(--color-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}

.leads-table tbody td {
  padding: 0.875rem 1rem;
  color: var(--color-gray);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leads-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.leads-table tbody tr:hover {
  background: var(--color-bg-hover);
}

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

.table-empty {
  text-align: center;
  padding: 2rem !important;
  color: var(--color-muted);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: monospace;
}

.badge--zero { background: rgba(96, 165, 250, 0.15); color: var(--color-blue); }
.badge--ti { background: rgba(74, 222, 128, 0.15); color: var(--color-green); }
.badge--estuda { background: rgba(251, 146, 60, 0.15); color: var(--color-orange); }
.badge--atua { background: rgba(235, 238, 0, 0.15); color: var(--color-yellow); }

.badge--social { background: rgba(96, 165, 250, 0.15); color: var(--color-blue); }
.badge--ads { background: rgba(251, 146, 60, 0.15); color: var(--color-orange); }
.badge--organico { background: rgba(74, 222, 128, 0.15); color: var(--color-green); }
.badge--direto { background: rgba(167, 173, 173, 0.15); color: var(--color-gray); }
.badge--email { background: rgba(235, 238, 0, 0.15); color: var(--color-yellow); }
.badge--default { background: rgba(167, 173, 173, 0.15); color: var(--color-gray); }

.badge--info { background: rgba(96, 165, 250, 0.15); color: var(--color-blue); }
.badge--warning { background: rgba(251, 146, 60, 0.15); color: var(--color-orange); }
.badge--critical { background: rgba(229, 57, 53, 0.15); color: #ff7d7a; }

/* Download icon */
.download-yes {
  color: var(--color-green);
  font-size: 1rem;
}

.download-no {
  color: var(--color-muted);
}

/* ============================================================
 * PAGINATION
 * ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.5rem;
}

.pagination__info {
  font-size: 0.8125rem;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
 * MODAL (detalhe do lead)
 * ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal__content {
  position: relative;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
}

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
  color: var(--color-gray);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal__close:hover {
  background: var(--color-bg-card);
  color: var(--color-yellow);
  border-color: var(--color-yellow);
}

.modal__title {
  font-size: 1.25rem;
  color: var(--color-white);
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.modal__subtitle {
  color: var(--color-muted);
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
}

.modal__divider {
  margin: 1.5rem 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

.modal__group {
  margin-bottom: 1.25rem;
}

.modal__group-title {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.modal__field {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--color-border);
}

.modal__field-label {
  color: var(--color-muted);
}

.modal__field-value {
  color: var(--color-white);
  word-break: break-word;
}

.modal__field-value--mono {
  font-family: monospace;
  font-size: 0.75rem;
}

/* ============================================================
 * FOOTER
 * ============================================================ */
.admin-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.admin-footer p {
  font-size: 0.75rem;
  color: var(--color-muted);
}
