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

:root {
  --primary-color: #0b5394;
  /* Adventist Blue */
  --secondary-color: #1a73e8;
  --accent-color: #ff9900;
  --bg-color: #f8fafd;
  --text-color: #1e293b;
  --white: #ffffff;
  --border-radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --sidebar-width: 300px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Background Image with Blur */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../img/Educação\ Adventista.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.4;
  /* Semi-transparente, mas mais viva */
  filter: blur(8px);
  /* Turva */
  z-index: -1;
}

/* Typography */
h1,
h2,
h3 {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 1.5rem;
}

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

/* Navbar */
.navbar {
  background-color: rgba(11, 83, 148, 0.95);
  /* Glassmorphism effect */
  backdrop-filter: blur(10px);
  color: var(--white);
  padding: 0.8rem 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-radius: 0 0 18px 18px;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 40px;
}

.navbar .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  text-decoration: none;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.navbar-logo {
  height: 90px;
  /* Logo maior no cabeçalho */
  width: auto;
  filter: brightness(0) invert(1);
  /* Makes the logo white if it was dark */
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  opacity: 0.9;
}

.nav-links a:hover {
  opacity: 1;
  transform: translateY(-1px);
}



/* Menu Toggle Button - Fixed outside navbar so it always stays above sidebar */
.menu-toggle {
  position: fixed;
  top: 0;
  right: 0;
  width: 98px;
  height: 113px;
  /* matches navbar height */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 3000;
}

/* Placeholder in navbar to keep layout spacing */
.menu-toggle-placeholder {
  display: inline-block;
  width: 32px;
  height: 26px;
  margin-left: 15px;
}

.menu-toggle span {
  width: 32px;
  height: 3px;
  background-color: var(--white);
  border-radius: 10px;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  transform-origin: center;
}

/* When open: turn black and form X */
.menu-toggle.open span {
  background-color: #1e293b;
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  right: calc(-1 * var(--sidebar-width));
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--white);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 2000;
  transition: var(--transition);
  padding: 80px 30px calc(70px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sidebar.open {
  right: 0;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1999;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
  display: block;
  opacity: 1;
}

.sidebar-header {
  margin-bottom: 30px;
  text-align: center;
}

.sidebar-logo {
  height: 90px;
  margin-bottom: 15px;
}

/* Sidebar header logo (used with sidebar-sidebar-logo class in header.php) */
.sidebar-sidebar-logo {
  height: 70px !important;
  width: auto;
  margin-bottom: 12px;
}

.sidebar-menu {
  list-style: none;
  padding-right: 2px;
  padding-bottom: 28px;
}

.sidebar-account {
  margin-top: 10px;
  padding-top: 10px;
  padding-bottom: 12px;
  border-top: 1px solid #e2e8f0;
  background: var(--white);
}

.sidebar-account .sidebar-section-title {
  margin-top: 0;
}

.sidebar-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 20px 0 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  color: var(--text-color);
  text-decoration: none;
  border-radius: 8px;
  transition: var(--transition);
  font-weight: 500;
}

.sidebar-link:hover {
  background-color: #f1f5f9;
  color: var(--primary-color);
}

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.sidebar-submenu {
  list-style: none;
  padding-left: 32px;
}

.sidebar-submenu .sidebar-link {
  padding: 8px 15px;
  font-size: 0.9rem;
  font-weight: 400;
}

/* Main Container */
.main-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 40px auto;
  padding: 0 24px;
}

/* Footer */
.footer {
  background-color: rgba(255, 255, 255, 0.15);
  /* Glassmorphism - remove a barra branca sólida */
  backdrop-filter: blur(15px);
  /* Efeito glass */
  -webkit-backdrop-filter: blur(15px);
  text-align: center;
  padding: 30px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  /* Borda sutil para diferenciar */
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
  margin-top: auto;
  color: var(--text-color);
  font-size: 0.9rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-logo-section {
  margin-bottom: 25px;
}

.footer-logo {
  height: 100px;
  width: auto;
  opacity: 0.85;
  transition: var(--transition);
}

.footer-logo:hover {
  opacity: 1;
}

.footer-bottom {
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 5px;
}

.footer-copyright {
  font-size: 0.85rem;
  color: var(--text-color);
  margin: 0;
  opacity: 0.9;
}

/* Responsividade do rodapé */
@media (max-width: 900px) {
  .footer-bottom {
    flex-direction: column;
    gap: 20px;
    padding-bottom: 20px;
  }
}


/* Jumbotron (Hero) */
.jumbotron {
  background: var(--white);
  padding: 60px 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  margin-bottom: 30px;
  text-align: center;
}

.jumbotron h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.jumbotron p {
  font-size: 1.25rem;
  color: #64748b;
  margin-bottom: 2rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
  min-height: 52px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.form-actions {
  gap: 12px;
  margin-top: 1rem;
}

.form-actions .col {
  padding: 0;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--white);
  box-shadow: 0 4px 6px -1px rgba(11, 83, 148, 0.4);
}

.btn-primary:hover,
.btn-primary:active {
  background-color: var(--accent-color);
  /* Muda para amarelo ao passar o mouse ou clicar */
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(255, 153, 0, 0.4);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline:hover,
.btn-outline:active {
  background-color: var(--accent-color);
  /* Muda para amarelo ao passar o mouse ou clicar */
  color: var(--white);
  border-color: var(--accent-color);
}

/* Custom Styled Buttons */
/* Premium Navigation Button (Voltar) */
.btn-premium-nav {
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 22px !important;
  background: var(--white) !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 12px !important;
  color: #64748b !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  text-decoration: none !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
  margin-bottom: 20px !important;
  cursor: pointer !important;
}

.btn-premium-nav:hover {
  transform: translateX(-5px) !important;
  background: #f8fafc !important;
  border-color: var(--primary-color) !important;
  color: var(--primary-color) !important;
  box-shadow: 0 4px 12px rgba(11, 83, 148, 0.12) !important;
}

/* Variant for Yellow Hover (Maintenance flow) */
.btn-nav-yellow-hover:hover {
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
  box-shadow: 0 4px 12px rgba(255, 153, 0, 0.15) !important;
}

/* Variant for Red Hover (Admin/Critical flow) */
.btn-nav-red-hover:hover {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15) !important;
}

.btn-premium-nav i {
  font-size: 0.85rem !important;
  transition: transform 0.3s ease !important;
}

.btn-premium-nav:hover i {
  transform: translateX(-2px) !important;
}

/* Auth Cards e Forms */
.auth-container {
  max-width: 480px;
  margin: 0 auto;
}

.card {
  background: rgba(255, 255, 255, 0.9);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #334155;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--white);
}

.form-control:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(11, 83, 148, 0.1);
}

/* Password Visibility Toggle */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.toggle-password {
  position: absolute;
  right: 15px;
  color: #94a3b8;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-password:hover {
  color: var(--primary-color);
}

/* Dashboard Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 30px;
}

.dashboard-card {
  background: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0, 0, 0, 0.03);
  text-align: center;
  transition: var(--transition);
}

.dashboard-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

/* New Grid Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  align-items: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 900px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

/* Tables */
.table-container {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin: 20px 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  background-color: #f1f5f9;
  color: var(--primary-color);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 16px;
  text-align: left;
}

.table td {
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #475569;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-container,
.jumbotron,
.dashboard-card {
  animation: fadeIn 0.5s ease-out forwards;
}

/* Sidebar Accordion */
.sidebar-link-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.sidebar-link-toggle .toggle-icon {
  transition: transform 0.3s ease;
  font-size: 0.8rem;
}

.sidebar-link-toggle.active .toggle-icon {
  transform: rotate(180deg);
}

.sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.sidebar-submenu.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.sidebar-submenu:not(.collapsed) {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-submenu li {
  padding-left: 15px;
}

/* Responsive Table Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  margin-bottom: 15px;
}

/* Base Responsive Fixes */
@media (max-width: 900px) {
  .main-container {
    margin: 20px auto;
    padding: 0 15px;
    width: 100%;
  }

  .card {
    padding: 20px;
  }

  .jumbotron {
    padding: 30px 20px;
  }

  .jumbotron h1 {
    font-size: 2rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

@media (max-width: 768px) {
  /* Fix layout structures that use flexbox */
  [style*="display:flex"]:not(.menu-toggle):not(.navbar .container):not(.nav-links):not(.sidebar-link):not(.sidebar-link-toggle):not(.btn-block):not(.btn-premium-nav) {
    flex-wrap: wrap !important;
  }

  /* Specific handling for page headers (Title + Action buttons) */
  h2 + div[style*="display:flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
    margin-top: 15px;
  }

  h2 + div[style*="display:flex"] .btn {
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
    justify-content: center;
  }

  /* Form Filters & Controls */
  form[style*="display: flex"], 
  .form-row,
  .form-group.row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  
  form[style*="display: flex"] > div,
  .form-row > div,
  .form-group.row > div {
    width: 100% !important;
    flex: 1 1 100% !important;
    margin-bottom: 10px;
  }

  /* Ensure inputs take full width on mobile */
  .form-control, 
  select.form-control {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Dynamic Table Container Fixes */
  .table-responsive {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 15px;
  }

  .table {
    margin-bottom: 0;
    min-width: 600px; /* Forces scrolling if content is too wide */
  }

  /* Responsive Grids */
  .responsive-grid-2,
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .table th, .table td {
    padding: 12px 10px;
    font-size: 0.85rem;
    white-space: nowrap; /* Prevents text from breaking badly in small columns */
  }

  /* Action buttons inside table */
  .table td div[style*="display: flex"] {
    flex-wrap: nowrap !important;
  }
}

@media (max-width: 480px) {
  .navbar .logo {
    font-size: 1.1rem;
  }
  
  .navbar-logo {
    height: 60px;
  }

  /* Hide textual menu items and rely on sidebar wrapper */
  .nav-links li:not(:last-child) {
    display: none;
  }

  /* Fix for buttons and inputs that might overflow on extra small devices */
  .btn {
    padding: 10px 15px !important;
    font-size: 0.9rem !important;
    height: auto !important;
    min-height: 46px; 
    white-space: normal !important;
    line-height: 1.2;
    text-align: center;
  }

  .form-control {
    padding: 10px 12px !important;
    font-size: 0.95rem !important;
  }

  .card {
    padding: 18px 14px !important;
  }
}