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

:root {
  --primary: #2F9E41;
  --primary-hover: #1A7326;
  --secondary: #CD191E;
  --secondary-hover: #A80D11;
  --danger: #CD191E;
  --danger-hover: #A80D11;
  --background: #F3F4F6;
  --surface: #FFFFFF;
  --text-main: #111827;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --border-radius: 12px;
  --transition: all 0.2s ease-in-out;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', sans-serif;
}

body {
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

a {
  text-decoration: none;
  color: var(--primary);
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

/* Typography */
h1, h2, h3, h4 { color: var(--text-main); margin-bottom: 1rem; font-weight: 600; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }

/* Cards & Layouts */
.card {
  background: var(--surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-main);
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="password"],
input[type="time"],
input[type="number"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover { background-color: var(--primary-hover); color: white !important; transform: translateY(-1px); }

.btn-secondary {
  background-color: var(--secondary);
  color: white;
}
.btn-secondary:hover { background-color: var(--secondary-hover); color: white !important; transform: translateY(-1px); }

.btn-danger {
  background-color: var(--danger);
  color: white;
}
.btn-danger:hover { background-color: var(--danger-hover); color: white !important; transform: translateY(-1px); }

.btn-sm {
  padding: 0.4rem 0.85rem !important;
  font-size: 0.85rem !important;
  min-height: unset !important;
  width: auto !important;
}

/* Alerts */
.alerts {
  margin-bottom: 1.5rem;
}

.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  line-height: 1.4;
}

.alert-success { background-color: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error, .alert-danger { background-color: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-warning { background-color: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background-color: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* Navbar */
.navbar {
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.navbar-links a {
  margin-left: 1.5rem;
  font-weight: 500;
  color: var(--text-muted);
}

.navbar-links a:hover {
  color: var(--primary);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background-color: #F9FAFB;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

tr:hover {
  background-color: #F9FAFB;
}

/* Dashboard Grid */
.grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card-full {
  width: 100%;
}

@media (min-width: 1024px) {
  .grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }
  
  .card-full {
    grid-column: span 2;
  }
}

/* Badges */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.badge-active { background-color: #D1FAE5; color: #065F46; }
.badge-cancelled { background-color: #FEE2E2; color: #991B1B; }
.badge-consumed { background-color: #DBEAFE; color: #1E40AF; }

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

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* QR Code Container */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: white;
  border-radius: 16px;
  border: 2px dashed var(--primary);
}
.qr-container img {
  width: 250px;
  height: 250px;
}
.qr-code-text {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  margin-top: 1rem;
  color: var(--primary);
}

/* Admin Dashboard Menu */
.admin-menu {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-main);
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none !important;
}

.menu-item i {
  font-size: 1.5rem;
  margin-right: 1rem;
  width: 24px;
  display: flex;
  justify-content: center;
}

/* Cores específicas dos ícones (Conforme Print) */
.menu-item:nth-child(1) i { color: #CF1E1E; } /* Turmas */
.menu-item:nth-child(2) i { color: #2F9E41; } /* Alunos */
.menu-item:nth-child(3) i { color: #8B5CF6; } /* Cardápios */
.menu-item:nth-child(4) i { color: #10B981; } /* Relatórios */
.menu-item:nth-child(5) i { color: #F59E0B; } /* Multi-admins */
.menu-item:nth-child(6) i { color: #3B82F6; } /* Mural */

.menu-item:hover {
  background: white;
  border-color: var(--primary);
  transform: translateX(5px);
  box-shadow: var(--shadow-sm);
  color: var(--primary);
}

.menu-item.highlight {
  background: #FEE2E2;
  border-color: #FECACA;
  color: #991B1B;
}

.menu-item.highlight i { color: var(--danger); }

.menu-item.highlight:hover {
  background: #FEF2F2;
  border-color: var(--danger);
  color: var(--danger);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Mobile specific fixes */
@media (max-width: 640px) {
  .navbar { 
    flex-direction: column; 
    gap: 1rem; 
    padding: 1rem; 
    text-align: center;
  }
  .navbar-links { 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 0.5rem; 
    width: 100%;
  }
  .navbar-links a { 
    margin: 0; 
    padding: 0.6rem; 
    background: #f9fafb; 
    border: 1px solid var(--border);
    border-radius: 8px; 
    flex: 1; 
    min-width: 140px;
    font-size: 0.9rem;
  }

  main { padding: 1.5rem 0.75rem; }
  .card { padding: 1.5rem 1.25rem; margin-bottom: 1.5rem; }
  .grid { grid-template-columns: 1fr; gap: 1.25rem; }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }
  
  /* Ajuste para campos de formulário no mobile */
  .form-group { margin-bottom: 1.25rem; }
  input, select, .btn {
    font-size: 16px !important; /* iOS zoom prevention */
    padding: 0.9rem 1rem !important;
    min-height: 48px; /* Touch target size */
  }
  
  .btn { width: 100%; padding: 1rem !important; }
  
  /* Containers flex que devem empilhar no mobile */
  .flex-mobile-column {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
    gap: 1rem !important;
  }

  .qr-container img {
    width: 200px;
    height: 200px;
  }
}

/* Modal overlay - always fixed to viewport regardless of parent context */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.modal-overlay.is-open {
  display: flex;
}

.modal-box {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  padding: 2rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  position: relative;
}

@media (max-width: 480px) {
  .modal-box {
    padding: 1.5rem 1rem;
  }
  
  .modal-box .grid {
    grid-template-columns: 1fr !important;
  }
}

/* Tab Buttons & Contents (Dashboard BI) */
.tab-btn {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  font-size: 1rem;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary) !important;
  border-bottom: 3px solid var(--primary) !important;
}

.tab-content {
  animation: fadeIn 0.3s ease-out;
}

/* Pulsing Red Warning Icon & Modal Animations */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.pulse-warning-icon {
  animation: pulse 1.5s infinite;
}

