/**
 * GroundTruth - Admin Backoffice Styles (Phase 2)
 * Marine Surveying & Operational Control Tower
 */

:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --accent: #f59e0b;
  --bg-dark: #090e17;
  --surface: #111827;
  --surface-card: #1e293b;
  --surface-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--surface);
  border-right: 1px solid var(--surface-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--surface-border);
}

.brand img {
  width: 38px;
  height: 38px;
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.brand span {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  display: block;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.nav-item button:hover,
.nav-item button.active {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
}

.sidebar-user {
  padding-top: 16px;
  border-top: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Header */
.topbar {
  height: 70px;
  padding: 0 32px;
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-live .pulse-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Content Container */
.container {
  padding: 32px;
  max-width: 1400px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  margin: 6px 0;
}

.stat-card .hint {
  font-size: 0.78rem;
  color: #38bdf8;
}

/* Filters & Table Card */
.panel-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn:hover,
.pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  position: relative;
  border-radius: var(--radius-md);
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

th {
  padding: 12px 14px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--surface-border);
  background: var(--surface);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  font-size: 0.84rem;
  background: var(--surface);
}

tr:hover td {
  background: #1e293b;
}

/* Coluna de ações fixa à direita para garantir visibilidade imediata no desktop */
th:last-child,
td:last-child {
  position: sticky;
  right: 0;
  background: #151f32;
  box-shadow: -5px 0 12px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

tr:hover td:last-child {
  background: #1e293b;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-revisao {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-finalizada {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-campo {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(2, 132, 199, 0.3);
}

/* Modal Human-in-the-Loop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-container {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 145px);
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .modal-body {
    grid-template-columns: 1fr;
  }
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.evidence-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.evidence-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.evidence-details {
  padding: 10px;
  font-size: 0.78rem;
}

.ai-pill {
  display: inline-block;
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.report-editor {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.88rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--surface-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
  background: var(--surface);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #059669;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: #fff;
  color: #fff;
}
