/* ═══════════════════════════════════════════════
   WayClinic — CSS Global (layout sidebar moderno)
   ═══════════════════════════════════════════════ */

:root {
  --sb-w:      260px;
  --sb-bg1:    #0f172a;
  --sb-bg2:    #1e293b;
  --accent:    #2563eb;
  --accent-lt: #60a5fa;
  --bg:        #f0f4f8;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --muted:     #64748b;
  --radius:    12px;
  --shadow:    0 1px 6px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--bg);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

a { text-decoration: none; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }

/* ══════════════════
   SIDEBAR
══════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sb-w);
  height: 100vh;
  background: linear-gradient(180deg, var(--sb-bg1) 0%, var(--sb-bg2) 100%);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  border-right: 1px solid rgba(255,255,255,.04);
  transition: transform .25s ease;
}

/* Brand */
.sb-brand {
  padding: 1.5rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  text-align: center;
  flex-shrink: 0;
}
.sb-logo-wrap {
  width: 200px;
  height: 60px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
}
.sb-logo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.sb-logo-fallback {
  width: 80px; height: 80px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem; flex-shrink: 0;
}
.sb-name {
  color: #fff;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.sb-sub {
  color: rgba(255,255,255,.32);
  font-size: .67rem;
  letter-spacing: .02em;
}

.sb-divider {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin: 0 1rem .375rem;
  flex-shrink: 0;
}

/* Nav items */
.sb-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}
.nav-section {
  padding: .75rem 1.375rem .2rem;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.22);
  font-weight: 600;
}
.sidebar .nav-link {
  color: rgba(255,255,255,.55);
  padding: .575rem 1rem;
  border-radius: 9px;
  margin: 1px .625rem;
  font-size: .845rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: background .15s, color .15s;
  text-decoration: none;
  position: relative;
}
.sidebar .nav-link i,
.sidebar .nav-link .fa,
.sidebar .nav-link .fas,
.sidebar .nav-link .bi {
  font-size: .9rem;
  width: 18px;
  flex-shrink: 0;
  opacity: .7;
  transition: opacity .15s;
}
.sidebar .nav-link:hover {
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.08);
}
.sidebar .nav-link:hover i,
.sidebar .nav-link:hover .bi { opacity: 1; }

.sidebar .nav-link.active {
  color: #fff;
  background: rgba(37,99,235,.25);
}
.sidebar .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 22%; bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-lt);
}
.sidebar .nav-link.active i,
.sidebar .nav-link.active .bi {
  opacity: 1;
  color: var(--accent-lt);
}

/* Sidebar footer */
.sb-footer {
  margin-top: auto;
  padding: .75rem .75rem 1rem;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sb-user-card {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border-radius: 9px;
  background: rgba(255,255,255,.07);
  margin-bottom: .5rem;
}
.sb-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  color: #fff; flex-shrink: 0;
}
.sb-user-name {
  font-size: .8rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-user-role {
  font-size: .68rem;
  color: rgba(255,255,255,.32);
}
.sb-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .45rem;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.5);
  font-size: .78rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  width: 100%;
}
.sb-logout:hover {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
}

/* Mobile overlay */
.sb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sb-overlay.show { display: block; }

/* ══════════════════
   MAIN WRAP
══════════════════ */
.main-wrap {
  margin-left: var(--sb-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  background: var(--surface);
  padding: .75rem 1.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 0 var(--border);
  flex-shrink: 0;
}
.topbar-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.topbar-meta { display: flex; align-items: center; gap: .75rem; }
.topbar-date {
  font-size: .78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--bg);
  padding: .35rem .8rem;
  border-radius: 99px;
  border: 1px solid var(--border);
}
.btn-hamburguer {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .3rem .45rem;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.btn-hamburguer:hover { background: var(--bg); }

/* Page content */
.page-content {
  padding: 1.75rem;
  flex: 1;
}

/* Footer */
.site-footer {
  background: #1e293b;
  color: rgba(255,255,255,.5);
  text-align: center;
  font-size: .78rem;
  padding: .85rem 1rem;
  margin-left: 0; /* footer cobre toda a largura */
}
.footer-link { color: #facc15 !important; }
.footer-link:hover { color: #fff !important; }

/* ══════════════════
   CARDS
══════════════════ */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: .875rem 1.25rem;
  font-weight: 600;
  font-size: .875rem;
}
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); }

/* KPI / Stat cards */
.stat-card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

/* ══════════════════
   TABLES
══════════════════ */
.table th {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border-bottom-width: 1px;
  background: #f8fafc;
  padding: .75rem 1rem;
}
.table td {
  vertical-align: middle;
  font-size: .875rem;
  padding: .65rem 1rem;
}
.table tbody tr:hover td { background: #f8fafc; }

/* ══════════════════
   BUTTONS & MISC
══════════════════ */
.btn-xs {
  padding: .15rem .4rem !important;
  font-size: .72rem !important;
  border-radius: .25rem !important;
}
.bg-purple { background-color: #7c3aed !important; }

/* Badge util */
.badge { font-weight: 600; }

/* ══════════════════
   SEM SIDEBAR (login etc.)
══════════════════ */
.main-wrap--full {
  margin-left: 0;
}
.page-content--full {
  padding: 0;
}

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .topbar { padding: .7rem 1rem; }
  .page-content { padding: 1rem; }
  .topbar-date { display: none; }
}
