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

:root {
  --protege-red: #D90D1E;
  --protege-red-dark: #b30a18;
  --protege-green: #038C8C;
  --protege-green-dark: #026b6b;
  --protege-light: #F2F2F2;
  --protege-dark: #1E1E1E;
  --protege-white: #ffffff;
  --sidebar-width: 250px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Nunito Sans', sans-serif;
  background-color: #f8f9fa;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ========================================== */
/* LAYOUT                                      */
/* ========================================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--protege-dark);
  color: var(--protege-white);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--protege-white);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand img {
  height: 36px;
}

.sidebar-nav {
  padding: 12px 0;
}

.sidebar-nav .nav-item {
  list-style: none;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
  color: var(--protege-white);
  background: rgba(255,255,255,0.05);
  border-left-color: var(--protege-red);
}

.sidebar-nav .nav-link.active {
  color: var(--protege-white);
  background: rgba(217, 13, 30, 0.15);
  border-left-color: var(--protege-red);
  font-weight: 600;
}

.sidebar-nav .nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top navbar (for mobile toggle) */
.topbar {
  background: var(--protege-white);
  border-bottom: 1px solid #dee2e6;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-toggle {
  background: none;
  border: none;
  color: var(--protege-dark);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}

.topbar-brand {
  font-weight: 700;
  color: var(--protege-red);
  font-size: 1.2rem;
}

.content-area {
  padding: 24px;
  flex: 1;
}

/* ========================================== */
/* SIDEBAR OVERLAY (mobile)                    */
/* ========================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1035;
}

/* ========================================== */
/* PAGE WRAPPER (standalone pages, no sidebar) */
/* ========================================== */
.page-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}

/* ========================================== */
/* RESPONSIVE                                  */
/* ========================================== */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .page-wrapper {
    padding: 24px 16px;
  }

  .hero-banner {
    padding: 24px 20px;
  }

  .hero-banner h3 {
    font-size: 1.25rem;
  }

  .sidebar-brand {
    font-size: 1.1rem;
    padding: 0 0 16px 0;
    border-bottom: none;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
  }

  .hero-stat {
    flex: 1 1 40%;
    text-align: left;
  }
}

@media (max-width: 400px) {
  .hero-stat {
    flex: 1 1 100%;
    text-align: center;
  }
}

@media (min-width: 768px) {
  .topbar-toggle {
    display: none;
  }

  .topbar-brand {
    display: none;
  }
}

/* ========================================== */
/* COMPONENTS                                  */
/* ========================================== */
.card-protege {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s ease;
}

.card-protege:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.card-protege .card-header {
  background: var(--protege-white);
  border-bottom: 2px solid var(--protege-red);
  font-weight: 700;
  color: var(--protege-red);
  border-radius: 12px 12px 0 0 !important;
}

.btn-protege {
  background-color: var(--protege-red);
  color: var(--protege-white);
  border: none;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 8px;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-protege:hover {
  background-color: var(--protege-red-dark);
  color: var(--protege-white);
  transform: translateY(-1px);
}

.btn-protege-outline {
  border: 2px solid var(--protege-red);
  color: var(--protege-red);
  background: transparent;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 8px;
  transition: all 0.2s;
}

.btn-protege-outline:hover {
  background: var(--protege-red);
  color: var(--protege-white);
}

.btn-protege-green {
  background-color: var(--protege-green);
  color: var(--protege-white);
  border: none;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.btn-protege-green:hover {
  background-color: var(--protege-green-dark);
  color: var(--protege-white);
}

.badge-protege {
  background-color: var(--protege-red);
  color: var(--protege-white);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.badge-protege-green {
  background-color: var(--protege-green);
  color: var(--protege-white);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}

/* ========================================== */
/* HOMEPAGE HERO + ACTION CARDS                */
/* ========================================== */
.hero-banner {
  background: linear-gradient(135deg, var(--protege-red) 0%, var(--protege-red-dark) 100%);
  border-radius: 16px;
  padding: 40px;
  color: white;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.hero-banner h3 {
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.hero-banner p {
  opacity: 0.9;
  margin-bottom: 0;
  max-width: 600px;
  position: relative;
  z-index: 1;
}

.hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.hero-stat {
  text-align: center;
}

.hero-stat .stat-number {
  font-size: 1.5rem;
  font-weight: 700;
}

.hero-stat .stat-label {
  font-size: 0.75rem;
  opacity: 0.8;
}

.action-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e9ecef;
  text-decoration: none;
  color: var(--protege-dark);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s ease;
  height: 100%;
}

.action-card:hover {
  border-color: var(--protege-red);
  box-shadow: 0 4px 16px rgba(217,13,30,0.12);
  color: var(--protege-dark);
  transform: translateY(-2px);
}

.action-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-icon.red    { background: #fce4e4; }
.action-icon.green  { background: #e0f2f1; }
.action-icon.blue   { background: #e3f2fd; }
.action-icon.orange { background: #fff3e0; }
.action-icon.purple { background: #f3e5f5; }
.action-icon.teal   { background: #e0f7fa; }

.action-icon svg {
  width: 24px;
  height: 24px;
}

.action-info h6 {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.action-info p {
  color: #6c757d;
  font-size: 0.8rem;
  margin-bottom: 8px;
  line-height: 1.4;
}

.action-arrow {
  color: var(--protege-red);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ========================================== */
/* EMERGENCY / SBV CARDS                       */
/* ========================================== */
.card-service {
  background: var(--protege-red);
  border-radius: 12px;
  padding: 20px;
  color: white;
}

.card-service .card-service-title {
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 2px solid rgba(255,255,255,0.4);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.card-service .card-service-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.card-service a {
  color: white;
  text-decoration: none;
}

.card-service a:hover {
  text-decoration: underline;
}

/* ========================================== */
/* SEARCH BAR                                  */
/* ========================================== */
.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 10px 48px 10px 16px;
  border: 2px solid var(--protege-green);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
}

.search-box input:focus {
  outline: none;
  border-color: var(--protege-red);
  box-shadow: 0 0 0 3px rgba(217, 13, 30, 0.15);
}

.search-box .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--protege-green);
  pointer-events: none;
}

/* ========================================== */
/* LOGIN / CADASTRO (standalone pages)          */
/* ========================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--protege-red);
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.auth-card .auth-title {
  color: var(--protege-red);
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: 2px;
  text-align: center;
  margin-bottom: 28px;
}

/* ========================================== */
/* UTILS                                       */
/* ========================================== */
.text-protege { color: var(--protege-red) !important; }
.bg-protege { background-color: var(--protege-red) !important; }
.text-protege-green { color: var(--protege-green) !important; }
.bg-protege-green { background-color: var(--protege-green) !important; }

.section-title {
  font-weight: 700;
  color: var(--protege-dark);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--protege-red);
  display: inline-block;
}

/* ========================================== */
/* LOADER                                      */
/* ========================================== */
.loader {
  width: 80px;
  height: 14px;
  border-radius: 8px;
  margin: 40px auto;
  background: radial-gradient(circle closest-side, var(--protege-red) 94%, #eee) 50% 50%/calc(50% + 8px) 60% repeat-x #eee;
  animation: l9 1s infinite cubic-bezier(0.3, 1, 0, 1);
}

@keyframes l9 {
  100% { background-position: calc(200% - 5px); }
}
