/* =========================================================================
   DESIGN SYSTEM - INTERCORRÊNCIAS (HOSPITAL GERAL)
   ========================================================================= */

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

:root {
  /* Brand Colors (Ophthalmology/Health Corporate) */
  --color-brand-primary: hsl(205, 77%, 26%); /* Deep blue */
  --color-brand-secondary: hsl(199, 89%, 48%); /* Soft cyan */
  --color-brand-accent: hsl(210, 100%, 60%);

  /* Neutral Scale */
  --color-neutral-50: hsl(210, 40%, 98%);
  --color-neutral-100: hsl(210, 40%, 96%);
  --color-neutral-200: hsl(214, 32%, 91%);
  --color-neutral-300: hsl(213, 27%, 84%);
  --color-neutral-800: hsl(215, 28%, 17%);
  --color-neutral-900: hsl(221, 39%, 11%);

  /* Semantic / Risk Colors */
  --color-risk-low: hsl(160, 84%, 39%);
  --color-risk-medium: hsl(38, 92%, 50%);
  --color-risk-high: hsl(12, 85%, 52%);
  --color-risk-critical: hsl(348, 83%, 47%);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--color-brand-primary) 0%, var(--color-brand-secondary) 100%);
  
  /* Shadows & Glass */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.2);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --bottom-nav-height: 64px;
}

/* =========================================================================
   RESET & BASE
   ========================================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-neutral-50);
  color: var(--color-neutral-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: var(--color-brand-secondary);
  transition: color 0.2s ease;
}
a:hover {
  color: var(--color-brand-primary);
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* =========================================================================
   LAYOUT (PWA / DESKTOP / MOBILE)
   ========================================================================= */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar (Desktop) */
.sidebar {
  width: var(--sidebar-width);
  background-color: white;
  border-right: 1px solid var(--color-neutral-200);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--color-neutral-200);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-brand-primary);
}

.sidebar-nav {
  padding: 1.5rem 1rem;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--color-neutral-800);
  margin-bottom: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
  background-color: var(--color-neutral-100);
  color: var(--color-brand-primary);
}
.nav-item.active {
  background-color: rgba(15, 74, 117, 0.05); /* very light primary */
}

.nav-icon {
  margin-right: 12px;
  font-size: 1.25rem;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

.top-header {
  height: var(--header-height);
  background-color: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-content {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Bottom Nav (Mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: white;
  border-top: 1px solid var(--color-neutral-200);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-neutral-800);
  font-size: 0.7rem;
  flex: 1;
}

.bottom-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 4px;
}
.bottom-nav-item.active {
  color: var(--color-brand-primary);
}

/* =========================================================================
   COMPONENTS
   ========================================================================= */

/* Cards */
.card {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Badges (Risk) */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-risk-baixo { background-color: rgba(22, 163, 74, 0.1); color: var(--color-risk-low); }
.badge-risk-medio { background-color: rgba(245, 158, 11, 0.1); color: var(--color-risk-medium); }
.badge-risk-alto { background-color: rgba(239, 68, 68, 0.1); color: var(--color-risk-high); }
.badge-risk-critico { background-color: rgba(225, 29, 72, 0.1); color: var(--color-risk-critical); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 10px rgba(15, 74, 117, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(15, 74, 117, 0.3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--color-neutral-300);
  color: var(--color-neutral-800);
}

.btn-outline:hover {
  background: var(--color-neutral-50);
  border-color: var(--color-neutral-800);
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--color-neutral-200);
  background: white;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  background-color: var(--color-neutral-50);
  padding: 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-neutral-800);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-neutral-200);
}
td {
  padding: 1rem;
  border-bottom: 1px solid var(--color-neutral-100);
  font-size: 0.9rem;
  color: var(--color-neutral-800);
}
tr:hover td {
  background-color: var(--color-neutral-50);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
}
.stat-title {
  font-size: 0.85rem;
  color: var(--color-neutral-800);
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-brand-primary);
  line-height: 1;
}

/* Auth Layout */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  padding: 1rem;
}
.auth-box {
  background: white;
  padding: 3rem 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
}
.auth-box h1 {
  text-align: center;
  color: var(--color-brand-primary);
  margin-bottom: 0.5rem;
}
.auth-box p {
  text-align: center;
  color: var(--color-neutral-800);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}
.form-group {
  margin-bottom: 1.25rem;
}
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-neutral-300);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-brand-secondary);
  box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.15);
}

/* =========================================================================
   MEDIA QUERIES (RESPONSIVE)
   ========================================================================= */
@media (max-width: 768px) {
  .sidebar {
    display: none; /* Hide sidebar on mobile */
  }
  .bottom-nav {
    display: flex; /* Show bottom nav on mobile */
  }
  .main-content {
    padding-bottom: var(--bottom-nav-height); /* Space for bottom nav */
  }
  .top-header {
    padding: 0 1rem;
  }
  .page-content {
    padding: 1.5rem 1rem;
  }
}
