/* ==========================================================================
   AMOR D+ | SISTEMA DE GESTÃO DE EQUIPE & INDICAÇÃO DE CASAS DE REPOUSO
   Design System Tokens, Typography, Reset, and Layout Utilities
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette - Healthcare Trust & Elegance */
  --primary-900: #0f172a;
  --primary-800: #1e293b;
  --primary-700: #334155;
  --primary-600: #475569;
  
  --brand-50: #fff1f2;
  --brand-100: #ffe4e6;
  --brand-500: #f43f5e;
  --brand-600: #e11d48;
  --brand-700: #be123c;
  --brand-gradient: linear-gradient(135deg, #f43f5e 0%, #e11d48 50%, #be123c 100%);
  
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  
  --emerald-50: #ecfdf5;
  --emerald-500: #10b981;
  --emerald-600: #059669;

  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  --indigo-50: #eef2ff;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;

  --purple-50: #faf5ff;
  --purple-500: #a855f7;

  /* Neutrals & Surfaces */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-hover: #f8fafc;

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #e11d48;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 25px rgba(225, 29, 72, 0.25);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', 'Plus Jakarta Sans', sans-serif;

  /* Layout dimensions */
  --sidebar-width: 270px;
  --topbar-height: 70px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* CSS Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Typography Presets */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-900);
  line-height: 1.25;
}

p {
  color: var(--text-secondary);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* App Frame Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--primary-900);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 1.5rem 1.4rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: var(--brand-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.35);
  font-size: 1.35rem;
  font-weight: 800;
}

.brand-info h1 {
  font-size: 1.25rem;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-info h1 span.plus {
  color: var(--brand-500);
  font-weight: 800;
}

.brand-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-nav {
  padding: 1.25rem 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.35rem;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.18) 0%, rgba(244, 63, 94, 0.05) 100%);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid var(--brand-500);
}

.nav-item.active .nav-icon {
  color: var(--brand-500);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: color var(--transition-fast);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-badge.alert {
  background-color: var(--brand-600);
  color: white;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.9; }
  100% { transform: scale(1); opacity: 1; }
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* Main Content Area */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100vw - var(--sidebar-width));
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-xs);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.topbar-title h2 {
  font-size: 1.25rem;
  color: var(--primary-900);
}

.topbar-title p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.45rem 1rem;
  width: 320px;
  transition: all var(--transition-fast);
}

.search-bar:focus-within {
  background-color: #ffffff;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.12);
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.85rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Content Views */
.content-area {
  padding: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 80px;
  }
  .sidebar-header .brand-info,
  .brand-tagline,
  .nav-item span,
  .nav-section-title,
  .user-info,
  .nav-badge {
    display: none;
  }
  .sidebar-header {
    justify-content: center;
    padding: 1rem 0;
  }
  .nav-item {
    justify-content: center;
    padding: 0.85rem;
  }
  .sidebar-footer {
    justify-content: center;
    padding: 1rem 0;
  }
  .search-bar {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    width: 260px;
  }
  .sidebar.mobile-open .brand-info,
  .sidebar.mobile-open .nav-item span,
  .sidebar.mobile-open .nav-section-title,
  .sidebar.mobile-open .user-info {
    display: block;
  }
  .main-wrapper {
    margin-left: 0;
    width: 100vw;
  }
  .content-area {
    padding: 1rem;
  }
  .topbar {
    padding: 0 1rem;
  }
  .search-bar {
    display: none;
  }
}
