/* src/index.css
   Palette (inspired by the GIO System reference prints)
     --navy-deep    #0e2c4f  primary brand, dark side, buttons
     --navy-darker  #0a223f  hover state
     --accent-blue  #1a4a8a  links, focus accents
     --input-bg     #eef2fa  input fields (soft lavender-blue)
     --bg-app       #f5f7fa  page background
     --surface      #ffffff  cards, navbar
     --border-soft  #e6ebf2  subtle dividers
     --text-ink     #1a2332  body text
     --text-muted   #8b94a3  secondary text
     --text-label   #9ba4b3  uppercase form labels
*/

:root {
  --navy-deep:   #0e2c4f;
  --navy-darker: #0a223f;
  --accent-blue: #1a4a8a;

  --input-bg:    #eef2fa;
  --bg-app:      #f5f7fa;
  --surface:     #ffffff;
  --border-soft: #e6ebf2;

  --text-ink:    #1a2332;
  --text-muted:  #8b94a3;
  --text-label:  #9ba4b3;

  --pill-blue-bg:  #e7eef8;
  --pill-blue-fg:  #1a4a8a;
  --pill-green-bg: #dcf2e0;
  --pill-green-fg: #1e6b35;
  --pill-amber-bg: #fdf3c8;
  --pill-amber-fg: #7a5a00;
  --pill-orange-bg: #fce7d3;
  --pill-orange-fg: #9c4a12;
  --pill-purple-bg: #ebe4fa;
  --pill-purple-fg: #5b3a9e;
  --pill-red-bg:   #fbe0e0;
  --pill-red-fg:   #8a1f1f;
  --pill-gray-bg:  #eef0f4;
  --pill-gray-fg:  #4a5468;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Google Sans', Georgia, 'Times New Roman', serif;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-pop:  0 18px 50px rgba(15, 23, 42, 0.22);
}

* { box-sizing: border-box; }

html, body, #root { height: 100%; }

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-ink);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* Opt-in wider page. Used by the deadline board, whose cards carry the case
   number, the due date and both tools on a single row and cramp at 1120px in
   two columns. Everything else stays at the narrower default. */
.container-wide {
  max-width: 1360px;
}

/* --- Typography --- */
h1 {
  font-family: var(--font-serif);
  /* font-style: italic; */
  font-weight: 700;
  font-size: 2.25rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.35rem;
  color: var(--text-ink);
}

h2 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-ink);
  margin: 0 0 1.1rem;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 2rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Horizontal action bar sitting above the case header on the details page. */
.detail-actions {
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 1.25rem;
}

/* --- Surfaces --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

/* --- Form controls --- */
label {
  display: block;
  margin-bottom: 1.1rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
textarea,
select {
  display: block;
  width: 100%;
  padding: 0.85rem 1rem;
  margin-top: 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text-ink);
  text-transform: none;
  letter-spacing: normal;
  background: var(--input-bg);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(26, 74, 138, 0.12);
}

textarea { resize: vertical; min-height: 88px; }

/* Input with a leading icon (e.g. login fields) */
.input-with-icon {
  position: relative;
  margin-top: 0.45rem;
}

.input-with-icon input {
  margin-top: 0;
  padding-left: 2.85rem;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: inline-flex;
  pointer-events: none;
}

.input-with-icon input:focus + .input-icon,
.input-with-icon:focus-within .input-icon {
  color: var(--accent-blue);
}

/* Date field: a typed dd/mm/aaaa box with the calendar on a trailing button.
   See deadline_new.html for why the native date input is not used on its own. */
.date-field {
  position: relative;
  margin-top: 0.45rem;
}

.date-field input[type="text"] {
  margin-top: 0;
  padding-right: 2.85rem;
}

.date-field-button {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  padding: 0.4rem;
  border: none;
  background: none;
  color: var(--text-muted);
}

.date-field-button:hover:not(:disabled) {
  background: none;
  color: var(--accent-blue);
}

/* The global button:active nudge would undo the vertical centering. */
.date-field-button:active:not(:disabled) { transform: translateY(-50%); }

/* Invisible but still laid out: showPicker() anchors the calendar to this
   input, and a display:none one has nothing to anchor to. */
.date-field-native {
  position: absolute;
  right: 1rem;
  bottom: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: none;
  opacity: 0;
  pointer-events: none;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%238b94a3' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* --- Buttons --- */
button {
  background: var(--navy-deep);
  color: white;
  border: 1px solid var(--navy-deep);
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

button:hover:not(:disabled) {
  background: var(--navy-darker);
  border-color: var(--navy-darker);
}

button:active:not(:disabled) { transform: translateY(1px); }

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

button.secondary {
  background: transparent;
  color: var(--accent-blue);
  border: 1px solid var(--border-soft);
}

button.secondary:hover:not(:disabled) {
  background: var(--pill-blue-bg);
  border-color: transparent;
  color: var(--accent-blue);
}

/* --- Inline alerts --- */
.error {
  color: var(--pill-red-fg);
  background: var(--pill-red-bg);
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-top: 0.5rem;
}

.hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 400;
}

code {
  background: var(--input-bg);
  color: var(--navy-deep);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* ====================================================================== */
/* Navbar                                                                  */
/* ====================================================================== */
.navbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-ink);
}

.navbar-brand:hover { text-decoration: none; }

.brand-icon {
  color: var(--navy-deep);
  flex-shrink: 0;
}

.brand-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-ink);
}

.navbar-center {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  color: var(--accent-blue);
  text-decoration: none;
}

.nav-link.active {
  background: var(--pill-blue-bg);
  color: var(--accent-blue);
  font-weight: 600;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}

.navbar-username {
  color: var(--text-ink);
  font-size: 0.92rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.navbar-signout {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.navbar-signout:hover:not(:disabled) {
  background: transparent;
  color: var(--text-ink);
  border-color: transparent;
}

.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--pill-blue-bg);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ====================================================================== */
/* Login (split-screen)                                                    */
/* ====================================================================== */
.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  background: var(--surface);
}

.login-aside {
  position: relative;
  background: var(--navy-deep);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  overflow: hidden;
}

/* Decorative circles, mimicking the reference */
.login-aside::before,
.login-aside::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}
.login-aside::before {
  width: 460px;
  height: 460px;
  top: -120px;
  right: -180px;
}
.login-aside::after {
  width: 360px;
  height: 360px;
  bottom: -160px;
  left: -120px;
}

.login-aside-content {
  position: relative;
  z-index: 1;
  max-width: 460px;
  text-align: center;
}

.login-logo {
  display: block;
  height: 120px;
  width: auto;
  margin: 0 auto 1.5rem;
  /* Icon fill is dark navy; invert to white for the dark aside */
  filter: brightness(0) invert(1);
}

.login-aside h1 {
  font-family: var(--font-serif);
  /* font-style: italic; */
  font-weight: 700;
  color: white;
  font-size: 2.6rem;
  line-height: 1.15;
  margin: 0 0 1rem;
}

.login-aside .subtitle {
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 1.75rem;
}

.login-aside-divider {
  width: 48px;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
  margin: 0 auto;
}

.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: var(--surface);
}

.login-form-wrap form {
  width: 100%;
  max-width: 380px;
}

.login-form-wrap .card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.login-form-wrap button[type='submit'] {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.95rem 1rem;
}

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-aside { padding: 2.5rem 1.5rem; min-height: 220px; }
  .login-aside h1 { font-size: 1.85rem; }
  .login-form-wrap { padding: 2rem 1.5rem; }
}

/* ====================================================================== */
/* Dashboard toolbar                                                        */
/* ====================================================================== */
.dashboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.filter-label {
  margin-bottom: 0;
  flex: 0 1 240px;
  min-width: 180px;
}

.toolbar-search {
  flex: 1 1 280px;
  min-width: 220px;
  margin-bottom: 0;
}

.toolbar-search .input-with-icon {
  margin-top: 0;
}

.toolbar-search input {
  margin-top: 0;
  font-size: 0.9rem;
}

/* ====================================================================== */
/* Case grid + card                                                        */
/* ====================================================================== */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.case-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.35rem;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-family: var(--font-sans);
  font-size: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

button.case-card:hover:not(:disabled) {
  background: var(--surface);
  color: inherit;
  border-color: var(--border-soft);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.case-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.case-number {
  font-weight: 700;
  color: var(--text-ink);
  font-size: 0.98rem;
  letter-spacing: -0.005em;
}

.case-card-client {
  color: var(--text-ink);
  font-weight: 500;
}

/* The card is a flex column, so the badge would otherwise stretch the full
   width. Shrink it back to its text. */
.case-card .status-badge {
  align-self: flex-start;
  width: fit-content;
}

/* Court (fixed) + adverse party (clamps) on one row. No pill here: the icon
   carries the colour and the label reads as plain text. */
.case-card-parties {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.case-part {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Sized in em so the glyphs track the label if its size is ever tuned. */
.case-part svg {
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
}

.case-part-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-part-court {
  flex: 0 0 auto;
}

.case-part-court svg {
  color: var(--pill-blue-fg);
}

.case-part-adverse {
  flex: 0 1 auto;
}

/* The double arrow reads heavier than the scales at the same box, so it gets a
   slightly smaller one. */
.case-part-adverse svg {
  color: var(--pill-red-fg);
  width: 1.05em;
  height: 1.05em;
}

/* Sentence case, not the small-caps treatment it used to have. */
.case-card-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  font-weight: 500;
}

/* ====================================================================== */
/* Status / role / generic pill badges                                     */
/* ====================================================================== */
.status-badge,
.pill {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  background: var(--pill-gray-bg);
  color: var(--pill-gray-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  vertical-align: middle;
}

.status-opened   { background: var(--pill-blue-bg);  color: var(--pill-blue-fg); }
.status-updated  { background: var(--pill-amber-bg); color: var(--pill-amber-fg); }
.status-finished { background: var(--pill-green-bg); color: var(--pill-green-fg); }
.status-canceled { background: var(--pill-red-bg);   color: var(--pill-red-fg); }
.status-irdr     { background: var(--pill-orange-bg); color: var(--pill-orange-fg); }
.status-resource { background: var(--pill-purple-bg); color: var(--pill-purple-fg); }

.pill-blue   { background: var(--pill-blue-bg);   color: var(--pill-blue-fg); }
.pill-green  { background: var(--pill-green-bg);  color: var(--pill-green-fg); }
.pill-amber  { background: var(--pill-amber-bg);  color: var(--pill-amber-fg); }
.pill-orange { background: var(--pill-orange-bg); color: var(--pill-orange-fg); }
.pill-purple { background: var(--pill-purple-bg); color: var(--pill-purple-fg); }
.pill-red    { background: var(--pill-red-bg);    color: var(--pill-red-fg); }
.pill-gray   { background: var(--pill-gray-bg);   color: var(--pill-gray-fg); }

/* ====================================================================== */
/* Details page / history                                                  */
/* ====================================================================== */
.update-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.update-row {
  border-top: 1px solid var(--border-soft);
  padding: 1rem 0;
}

.update-row:first-child { border-top: 0; padding-top: 0; }

.update-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.update-date {
  font-weight: 600;
  color: var(--text-ink);
  font-size: 0.92rem;
}

.update-row-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.update-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-weight: 400;
}

.update-comment {
  margin: 0.55rem 0 0;
  white-space: pre-wrap;
  color: var(--text-ink);
  line-height: 1.55;
}

.icon-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.icon-button:hover {
  color: var(--pill-red-fg);
  background: var(--pill-red-bg);
}

/* ====================================================================== */
/* Modal                                                                   */
/* ====================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
  backdrop-filter: blur(3px);
}

.modal-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-pop);
}

.modal-title {
  margin: 0 0 1.4rem;
  font-family: var(--font-serif);
  /* font-style: italic; */
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.005em;
  color: var(--text-ink);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ====================================================================== */
/* Admin Section                                                           */
/* ====================================================================== */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}

.admin-tab {
  background: transparent;
  color: var(--text-muted);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.65rem 1rem;
  margin-bottom: -1px;
}

.admin-tab:hover:not(:disabled) {
  background: transparent;
  color: var(--text-ink);
  border-color: var(--border-soft);
}

.admin-tab.active {
  color: var(--navy-deep);
  border-bottom-color: var(--navy-deep);
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.inline-form input { flex: 1; }

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.user-table thead th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-label);
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
}

.user-table tbody td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-ink);
  vertical-align: middle;
}

.user-table tbody tr:last-child td { border-bottom: 0; }

.user-table tbody tr:hover { background: rgba(238, 242, 250, 0.4); }

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.row-actions button { padding: 0.45rem 0.85rem; font-size: 0.82rem; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
}

.panel-header h2 { margin-bottom: 0; }

/* ====================================================================== */
/* Print (Salvar PDF)                                                      */
/* ====================================================================== */
@media print {
  .navbar { display: none; }
  .header-actions { display: none; }
  .icon-button { display: none; }
  body { background: white; }
  .card { box-shadow: none; border: none; }
}
