/* ==========================================================================
   Advanced UI stylesheet for legal management app (modified)
   - Autor: GitHub Copilot (base) + ajustes do utilizador
   - Alteração principal: tornar o conteúdo principal fluído (100% da área
     disponível) para evitar o "encaixotamento" quando existe sidebar.
   ========================================================================== */

/* =========================
   THEME VARIABLES
   ========================= */
:root{
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",
               Roboto, "Helvetica Neue", Arial;
  --font-mono: "Fira Code", "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 18px;
  --space-lg: 28px;
  --container-max: 1280px;

  --shadow-1: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.06);
  --shadow-2: 0 6px 18px rgba(15,23,42,0.08);
  --shadow-glass: 0 8px 30px rgba(2,6,23,0.35);

  --trans-fast: 140ms;
  --trans-medium: 220ms;
  --trans-smooth: cubic-bezier(.2,.9,.3,1);

  --bg: #f6f7fb;
  --surface: #ffffff;
  --muted: #6b7280;
  --text: #0f172a;
  --primary: #0ea5a4;
  --primary-600: #089a99;
  --accent: #7c3aed;
  --danger: #ef4444;
  --success: #16a34a;
  --glass: rgba(255,255,255,0.6);
  --border: rgba(15,23,42,0.08);

  --info: #2563eb;
  --warning: #f59e0b;
}

.theme-dark, [data-theme="dark"]{
  --bg: #061221;
  --surface: rgba(8,12,20,0.7);
  --muted: #94a3b8;
  --text: #e6eef6;
  --primary: #17b7b3;
  --primary-600: #10a99f;
  --accent: #8b5cf6;
  --danger: #ff6b6b;
  --success: #3ddc84;
  --glass: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.06);
  --shadow-1: 0 1px 2px rgba(2,6,23,0.5);
  --shadow-2: 0 6px 18px rgba(2,6,23,0.6);
  --shadow-glass: 0 8px 30px rgba(0,0,0,0.6);
}

@media (prefers-reduced-motion: reduce){
  :root{
    --trans-fast: 1ms;
    --trans-medium: 1ms;
  }
}

/* =========================
   RESET / BASE
   ========================= */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  background: linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 95%, transparent));
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
  font-size: 16px;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--primary); text-decoration: none; transition: color var(--trans-medium) var(--trans-smooth); }
a:hover { color: var(--primary-600); text-decoration: underline; }

/* =========================
   LAYOUT: NAVBAR / SIDEBAR / CONTAINER
   ========================= */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
}

/* Mobile stack */
@media (max-width: 880px){
  .app { grid-template-columns: 1fr; }
}

/* Top navigation bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px var(--space-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0.35));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}

/* Dark adjustments for topbar */
.theme-dark .topbar, [data-theme="dark"] .topbar {
  background: linear-gradient(180deg, rgba(8,12,20,0.6), rgba(8,12,20,0.45));
}

/* Sidebar */
.sidebar {
  min-height: 100vh;
  padding: var(--space-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,255,255,0.6));
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  position: relative;
  overflow-y: auto;
}

/* Mobile collapsed sidebar behaviour */
.sidebar.collapsed { transform: translateX(-100%); transition: transform var(--trans-medium) var(--trans-smooth); }
@media (max-width: 880px){
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 60;
    transform: translateX(-110%);
    transition: transform var(--trans-medium) var(--trans-smooth);
    background: linear-gradient(180deg, var(--surface), color-mix(in srgb,var(--surface) 90%, transparent));
  }
  .sidebar.open { transform: translateX(0); }
}

/* -------------------------
   MAIN CONTENT FIX (IMPORTANT)
   -------------------------
   Changed so .content is fluid and uses full available width.
   Remove the max-width that caused "boxed" appearance.
*/
.content {
  padding: var(--space-lg);
  /* allow the content to use the full available area (no center-boxing) */
  max-width: none;      /* <-- was var(--container-max) originally */
  margin: 0;            /* remove auto centring */
  width: 100%;
  box-sizing: border-box;
}

/* Page header */
.page-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.page-title {
  display: flex;
  gap: 14px;
  align-items: center;
}
.page-title h1 {
  margin: 0; font-size: 1.4rem; letter-spacing: -0.2px;
}
.page-subtitle { color: var(--muted); font-size: 0.95rem; }

/* =========================
   NAV ITEMS
   ========================= */
.nav-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); cursor: pointer; transition: background var(--trans-medium) var(--trans-smooth), color var(--trans-medium); }
.nav-item:hover{ background: color-mix(in srgb, var(--primary) 6%, transparent); }
.nav-item.active{ background: linear-gradient(90deg, color-mix(in srgb,var(--primary) 12%, transparent), transparent); color: var(--primary-600); font-weight: 600; box-shadow: var(--shadow-1); }

/* =========================
   UTILITIES
   ========================= */
.container { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--space-md); }

/* If you want full-width container usage, use .container-fluid */
.container-fluid { max-width: none; margin: 0; padding: 0 var(--space-md); }

.row { display:flex; gap:var(--space-md); align-items: stretch; }
.col { flex: 1; }
.grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(12, 1fr);
}
.grid-6 { grid-column: span 6; }
.grid-4 { grid-column: span 4; }
.grid-3 { grid-column: span 3; }
@media (max-width: 880px){ .grid { grid-template-columns: repeat(6, 1fr); } .grid-6{grid-column: span 6;} .grid-4{grid-column: span 6;} }

/* Spacing helpers */
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.m-sm { margin: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }

/* Flex helpers */
.flex { display: flex; }
.flex-col { display:flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* =========================
   BUTTONS
   ========================= */
.btn {
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform var(--trans-fast) var(--trans-smooth), box-shadow var(--trans-medium);
  font-weight: 600;
  text-decoration: none;
}
.btn:active{ transform: translateY(1px); }
.btn:focus { outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent); }

.btn-primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: white;
  border: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 22%, transparent);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
}

.btn-sm { padding: 6px 10px; font-size: .9rem; border-radius: var(--radius-sm); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: linear-gradient(180deg, var(--danger), color-mix(in srgb,var(--danger) 90%, transparent)); color: white; }

.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 56px; height: 56px;
  border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  box-shadow: var(--shadow-glass);
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb,var(--accent) 85%, transparent));
  color: white; z-index: 90;
}

/* =========================
   FORMS & INPUTS
   ========================= */
.form {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
}

label { display:block; font-weight:600; margin-bottom: 8px; color: var(--muted); font-size: .93rem; }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  color: var(--text);
  transition: border-color var(--trans-medium) var(--trans-smooth), box-shadow var(--trans-medium);
  font-size: .95rem;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--primary) 12%, transparent);
}

.input-group { display:flex; gap:8px; align-items:center; }
.input-icon { display:inline-flex; width:40px; height:40px; align-items:center; justify-content:center; border-radius:8px; background: color-mix(in srgb,var(--surface) 80%, transparent); border:1px solid var(--border); }

.input.invalid { border-color: var(--danger); box-shadow: 0 6px 18px color-mix(in srgb,var(--danger) 8%, transparent); }
.form-hint { font-size: .85rem; color: var(--muted); margin-top:6px; }
.form-error { font-size: .86rem; color: var(--danger); margin-top:6px; }

/* =========================
   CARDS
   ========================= */
.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  transition: transform var(--trans-medium) var(--trans-smooth), box-shadow var(--trans-medium);
}
.card:hover{ transform: translateY(-6px); box-shadow: var(--shadow-2); }

.card-header { display:flex; justify-content:space-between; align-items:center; gap:var(--space-sm); margin-bottom: var(--space-sm); }
.card-title { font-weight:700; font-size:1rem; }
.card-sub { color: var(--muted); font-size:.92rem; }

.card.processo { border-left: 4px solid color-mix(in srgb, var(--primary) 60%, transparent); }
.card.juiz { border-left: 4px solid color-mix(in srgb, var(--accent) 60%, transparent); }
.card.advogado { border-left: 4px solid color-mix(in srgb, #ff7a59 60%, transparent); }
.card.denuncia { border-left: 4px solid color-mix(in srgb, var(--danger) 65%, transparent); }
.card.auto { border-left: 4px solid color-mix(in srgb, var(--warning) 55%, transparent); }

.card-list { display:flex; flex-direction:column; gap:8px; margin-top:6px; }

/* =========================
   TABLES
   ========================= */
.table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  overflow: hidden;
  border-radius: 10px;
}
.table thead tr { background: color-mix(in srgb, var(--surface) 95%, transparent); }
.table th, .table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: .95rem;
  color: var(--muted);
}
.table tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }

.badge {
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight:700;
  font-size:.85rem;
  color: white;
}
.badge.info{ background: var(--info); }
.badge.success{ background: var(--success); }
.badge.warn{ background: var(--warning); color: rgba(0,0,0,0.85); }
.badge.danger{ background: var(--danger); }

/* =========================
   MODALS & DRAWERS
   ========================= */
.modal-backdrop {
  position: fixed; inset:0; display:flex; align-items:center; justify-content:center;
  background: rgba(2,6,23,0.5);
  z-index: 120;
  padding: var(--space-md);
}
.modal {
  width: 100%;
  max-width: 880px;
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb,var(--surface) 90%, transparent));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-glass);
  transform-origin: center;
  animation: popIn .18s var(--trans-smooth);
}
@keyframes popIn{ from { transform: translateY(8px) scale(.99); opacity:0 } to { transform: translateY(0) scale(1); opacity:1 } }

.drawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 420px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 110;
  padding: var(--space-md);
  box-shadow: var(--shadow-glass);
}

/* =========================
   TOASTS / NOTIFICATIONS
   ========================= */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display:flex;
  flex-direction: column;
  gap:10px;
  z-index: 200;
}
.toast {
  min-width: 300px;
  max-width: 420px;
  background: linear-gradient(180deg, color-mix(in srgb,var(--surface) 95%, transparent), var(--surface));
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  display:flex; gap:12px; align-items:flex-start;
}
.toast .title { font-weight:700; }
.toast .meta { color: var(--muted); font-size:.85rem; }

/* =========================
   AVATARS & LIST ITEMS
   ========================= */
.avatar {
  width: 44px; height: 44px; border-radius: 10px;
  display:inline-flex; align-items:center; justify-content:center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 75%, transparent), transparent);
  border: 1px solid var(--border);
  font-weight:700; color: var(--muted);
}
.list-item { display:flex; gap:12px; align-items:center; padding:10px; border-radius:10px; transition: background var(--trans-medium); }
.list-item:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* =========================
   SEARCH INPUT / FILTERS
   ========================= */
.search {
  display:flex; gap:8px; align-items:center;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  padding: 8px; border-radius: 12px; border: 1px solid var(--border);
}
.search .input { border:none; background:transparent; padding:8px; }

/* =========================
   SKELETON LOADING
   ========================= */
.skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,0.04), rgba(0,0,0,0.06), rgba(0,0,0,0.04));
  border-radius: 8px;
  min-height: 14px;
  animation: shimmer 1.2s linear infinite;
}
.theme-dark .skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.06), rgba(255,255,255,0.03)); }
@keyframes shimmer { 0% { background-position:-200px 0; } 100% { background-position:200px 0; } }

/* =========================
   EMPTY STATE
   ========================= */
.empty-state { display:flex; flex-direction:column; gap:12px; align-items:center; justify-content:center; padding:40px; color:var(--muted); text-align:center; }
.empty-state .icon { font-size:48px; color: color-mix(in srgb,var(--muted) 70%, transparent); }

/* =========================
   PAGE-SPECIFIC: Login / Register / Profile
   ========================= */
.auth-panel {
  max-width: 420px; margin: 20px auto; padding: var(--space-md);
  border-radius: var(--radius-md); background: linear-gradient(180deg, var(--surface), color-mix(in srgb,var(--surface) 96%, transparent));
  border:1px solid var(--border); box-shadow: var(--shadow-2);
}
.auth-header { text-align:center; margin-bottom: var(--space-md); }
.auth-header h2 { margin:0; font-size:1.25rem; }
.auth-footer { text-align:center; color:var(--muted); font-size:.94rem; margin-top: var(--space-sm); }

/* =========================
   PAGE: Processos / Detalhes / Criar
   ========================= */
.file-meta { display:flex; gap:10px; align-items:center; color:var(--muted); font-size:.9rem; }
.timeline { display:flex; flex-direction:column; gap:12px; }
.timeline .event { padding:10px; border-radius:10px; background: color-mix(in srgb,var(--surface) 96%, transparent); border:1px dashed var(--border); }

/* =========================
   RESPONSIVE TWEAKS
   ========================= */
@media (max-width: 520px){
  .page-title h1{ font-size: 1.06rem; }
  .topbar { padding: 8px; gap:8px; }
  .content { padding: 18px; }
  .sidebar { padding: 10px; }
}

/* =========================
   ACCESSIBILITY HELPERS
   ========================= */
.sr-only { position: absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* =========================
   MISC: small widgets
   ========================= */
.kpi {
  display:flex; gap:12px; align-items:center; padding:12px; border-radius:12px; background: linear-gradient(180deg, color-mix(in srgb,var(--surface) 98%, transparent), var(--surface));
  border:1px solid var(--border); box-shadow: var(--shadow-1);
}
.kpi .value { font-weight:800; font-size:1.2rem; }
.kpi .label { color: var(--muted); font-size:.9rem; }

/* =========================
   NOTES & USAGE
   ========================= */
/*
  - The important change was .content max-width removed so the main area uses entire available width next to sidebar.
  - If you still see "boxed" content:
      1) Clear browser cache (Ctrl+F5) or disable cache during dev.
      2) Make sure index.html is loading this css/style.css (no older file shadowing).
      3) Verify no inline style or other CSS file re-introduces `max-width` on `.content` or wraps the content in a centered `.container`.
  - If you prefer to keep a centered container on very wide screens but still allow full-width up to some threshold,
    replace `.content` with:
      .content { max-width: 1200px; width: calc(100% - 40px); margin: 0; padding: var(--space-lg); }
*/