﻿@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #07090f;
  --bg-soft: #0f1420;
  --bg-card: #121a29;
  --line: #24304a;
  --line-strong: #2d3e62;
  --text: #ffffff;
  --muted: #aab6ce;
  --accent: #66d9ff;
  --accent-2: #8df7c6;
  --danger: #ff6f79;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Space Grotesk', 'Segoe UI', Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(102, 217, 255, 0.12), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(141, 247, 198, 0.1), transparent 38%),
    linear-gradient(140deg, #06080d 0%, #0b1018 35%, #090f17 100%);
}

a {
  color: inherit;
}

.center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.card {
  width: 400px;
  max-width: 100%;
  background: linear-gradient(165deg, rgba(19, 29, 45, 0.94), rgba(14, 21, 34, 0.94));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

h1 {
  margin: 0 0 10px;
  font-size: 27px;
  letter-spacing: 0.01em;
}

label {
  display: block;
  margin: 13px 0 7px;
  color: #dce4f5;
  font-size: 14px;
  font-weight: 500;
}

input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #0a101b;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 217, 255, 0.15);
}

button {
  margin-top: 15px;
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid #5fd7ff;
  background: linear-gradient(120deg, #11314a, #174d67);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button.secondary {
  border-color: var(--line);
  background: linear-gradient(120deg, #101928, #0e1624);
}

.error {
  background: rgba(162, 43, 52, 0.22);
  border: 1px solid rgba(255, 111, 121, 0.55);
  padding: 10px;
  border-radius: 10px;
  margin: 12px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(165deg, rgba(14, 21, 34, 0.9), rgba(10, 15, 24, 0.92));
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
}

.title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.is-hidden {
  display: none !important;
}

.actions button {
  width: auto;
  margin: 0;
  padding: 10px 14px;
}

.container {
  padding: 18px 20px;
}

.top-image-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  width: 100%;
}

.top-image {
  width: min(100%, 760px);
  height: auto;
  max-height: 140px;
  display: block;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: transparent;
  cursor: pointer;
  object-fit: contain;
}

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

.small {
  font-size: 12px;
}

.footnote {
  margin-top: 12px;
}

.smallbtn {
  width: auto;
  padding: 7px 11px;
  margin: 0;
}

.danger {
  border-color: rgba(255, 111, 121, 0.7);
  background: linear-gradient(120deg, rgba(92, 26, 33, 0.95), rgba(126, 34, 44, 0.95));
}

#grid {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tabulator {
  border: none !important;
  background-color: rgba(11, 16, 26, 0.95) !important;
  color: #f7f9ff !important;
}

.tabulator .tabulator-header {
  background: linear-gradient(120deg, #121c2e, #0f1829) !important;
  border-bottom: 1px solid var(--line) !important;
}

.tabulator .tabulator-header .tabulator-col {
  background: transparent !important;
  border-right: 1px solid rgba(43, 58, 88, 0.45) !important;
  color: #e8efff !important;
}

.tabulator .tabulator-row {
  background: rgba(10, 16, 27, 0.95) !important;
  border-bottom: 1px solid rgba(35, 47, 73, 0.6) !important;
}

.tabulator .tabulator-row:nth-child(even) {
  background: rgba(14, 22, 36, 0.95) !important;
}

.tabulator .tabulator-row:hover {
  background: rgba(34, 49, 78, 0.7) !important;
}

.tabulator .tabulator-cell {
  border-right: 1px solid rgba(33, 44, 68, 0.55) !important;
}

.foto-thumb {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
  margin: 4px auto;
}

.foto-placeholder {
  display: inline-block;
  font-size: 12px;
  color: #aab6ce;
}

.tabulator .tabulator-footer {
  background: #0f1726 !important;
  color: #dbe6fc !important;
  border-top: 1px solid var(--line) !important;
}

.tabulator .tabulator-row.tabulator-selected {
  background: rgba(37, 89, 122, 0.45) !important;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .actions form,
  .actions button {
    width: 100%;
  }

  .actions button {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .card {
    padding: 18px;
    border-radius: 14px;
  }

  h1 {
    font-size: 23px;
  }

  .container {
    padding: 12px;
  }

  .top-image {
    max-height: 90px;
  }
}


/* Grid text contrast overrides */
.page-grid .muted {
  color: #f2f6ff !important;
}

.page-grid .tabulator,
.page-grid .tabulator * {
  color: #ffffff !important;
}

/* Feedback visual de salvamento */
.cell-saving {
  background-color: #fff9e6 !important;
  outline: 2px solid #f59e0b !important;
}
.cell-saved {
  background-color: #f0fdf4 !important;
  outline: 2px solid #22c55e !important;
  transition: background-color 0.3s, outline 0.3s;
}
.cell-error {
  background-color: #fef2f2 !important;
  outline: 2px solid #ef4444 !important;
}

/* Célula editada aguardando salvar */
.cell-pending {
  background-color: #fffbeb !important;
  border-left: 3px solid #f59e0b !important;
}

/* Botão salvar com alterações pendentes */
button#btnSave.has-changes {
  background-color: #16a34a;
  color: white;
  font-weight: bold;
  animation: pulse 1.5s infinite;
}

button#btnSave:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
}

/* Status cell styles */
.tabulator .tabulator-cell.status-empty {
  background: transparent !important;
}

.tabulator .tabulator-cell.status-andamento {
  background: #facc15 !important;
  color: #111111 !important;
  font-weight: 700;
}

.tabulator .tabulator-cell.status-atrasado {
  background: #dc2626 !important;
  color: #ffffff !important;
  font-weight: 700;
}

.tabulator .tabulator-cell.status-concluido {
  background: #22c55e !important;
  color: #111111 !important;
  font-weight: 700;
}
