/* assets/css/app.css - Colégio Donaduzzi - Estilos customizados */
/* Complementa Tailwind CSS com variáveis de marca e componentes específicos */

/* =============================================
   VARIÁVEIS DE MARCA
   ============================================= */
:root {
  --brand-navy:    #0F1B4C;
  --brand-blue:    #1E3A8A;
  --brand-royal:   #1D4ED8;
  --brand-sky:     #3B82F6;
  --brand-yellow:  #F59E0B;
  --brand-gold:    #D97706;
  --brand-white:   #FFFFFF;
  --brand-gray-50: #F8FAFC;
  --brand-gray-100:#F1F5F9;
  --brand-gray-600:#475569;
  --brand-gray-900:#0F172A;

  --shadow-card:  0 1px 3px rgba(15,27,76,0.08), 0 4px 16px rgba(15,27,76,0.06);
  --shadow-float: 0 8px 32px rgba(15,27,76,0.18);
  --radius-card:  0.75rem;
  --radius-btn:   0.5rem;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-sans);
  background-color: var(--brand-gray-50);
  color: var(--brand-gray-900);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-blue) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform 0.3s ease;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo img { max-height: 48px; object-fit: contain; }

.sidebar-nav { flex: 1; padding: 1rem 0.75rem; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  color: rgba(255,255,255,0.75);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  margin-bottom: 0.15rem;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: var(--brand-white);
}

.nav-item.active { background: rgba(245,158,11,0.2); color: var(--brand-yellow); }
.nav-item i { width: 18px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--brand-yellow);
  color: var(--brand-navy);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  min-width: 1.25rem;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  color: rgba(255,255,255,0.8);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand-yellow);
  color: var(--brand-navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-name  { font-size: 0.8rem; font-weight: 600; color: white; }
.user-role  { font-size: 0.7rem; color: rgba(255,255,255,0.5); }

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: white;
  border-bottom: 1px solid #E2E8F0;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--brand-blue);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.page-content { padding: 1.5rem; flex: 1; }

/* =============================================
   CARDS
   ============================================= */
.card {
  background: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--brand-navy);
}

.card-body { padding: 1.25rem; }

/* =============================================
   STAT CARDS - Dashboard
   ============================================= */
.stat-card {
  background: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--brand-yellow);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 0.625rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; color: var(--brand-navy); }
.stat-label { font-size: 0.8rem; color: var(--brand-gray-600); margin-top: 0.2rem; }

/* =============================================
   MENSAGENS
   ============================================= */
.msg-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid #F1F5F9;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  cursor: pointer;
}

.msg-item:hover { background: #F8FAFC; }
.msg-item.unread { background: #EFF6FF; }
.msg-item.unread .msg-title { font-weight: 700; }

.msg-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.msg-title   { font-size: 0.9rem; font-weight: 600; color: var(--brand-navy); }
.msg-preview { font-size: 0.8rem; color: var(--brand-gray-600); margin-top: 0.15rem; 
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.msg-time    { font-size: 0.75rem; color: #94A3B8; white-space: nowrap; margin-left: auto; flex-shrink: 0; }
.msg-unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-royal);
  flex-shrink: 0; margin-top: 6px;
}

/* =============================================
   PRIORIDADE BADGES
   ============================================= */
.badge-normal    { background: #EFF6FF; color: #1D4ED8; }
.badge-importante{ background: #FFFBEB; color: #D97706; }
.badge-urgente   { background: #FEF2F2; color: #DC2626; }

.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =============================================
   FORMULÁRIOS
   ============================================= */
.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--brand-navy);
  margin-bottom: 0.35rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1.5px solid #CBD5E1;
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  color: var(--brand-gray-900);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand-royal);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

.form-textarea { resize: vertical; min-height: 100px; }

/* =============================================
   BOTÕES
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.575rem 1.125rem;
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-royal);
  color: white;
}
.btn-primary:hover { background: var(--brand-blue); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(29,78,216,0.3); }

.btn-yellow {
  background: var(--brand-yellow);
  color: var(--brand-navy);
}
.btn-yellow:hover { background: var(--brand-gold); }

.btn-outline {
  background: transparent;
  color: var(--brand-royal);
  border: 1.5px solid var(--brand-royal);
}
.btn-outline:hover { background: #EFF6FF; }

.btn-danger {
  background: #DC2626;
  color: white;
}
.btn-danger:hover { background: #B91C1C; }

.btn-ghost {
  background: transparent;
  color: var(--brand-gray-600);
  padding: 0.5rem 0.75rem;
}
.btn-ghost:hover { background: #F1F5F9; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* =============================================
   TABELAS
   ============================================= */
.table-wrapper { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  background: #F8FAFC;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-gray-600);
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #F1F5F9;
  color: var(--brand-gray-900);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #F8FAFC; }

/* =============================================
   CALENDÁRIO
   ============================================= */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0.25rem;
  border-radius: 0.375rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 42px;
}

.calendar-day:hover { background: #F1F5F9; }
.calendar-day.today { background: var(--brand-royal); color: white; font-weight: 700; }
.calendar-day.has-event::after {
  content: '';
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--brand-yellow);
  margin-top: 2px;
  display: block;
}
.calendar-day.other-month { opacity: 0.35; }

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress-bar {
  height: 8px;
  background: #E2E8F0;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-royal), var(--brand-sky));
  border-radius: 9999px;
  transition: width 0.6s ease;
}

/* =============================================
   ALERT / TOAST
   ============================================= */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-btn);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.alert-success { background: #ECFDF5; color: #065F46; border-left: 4px solid #059669; }
.alert-error   { background: #FEF2F2; color: #991B1B; border-left: 4px solid #DC2626; }
.alert-warning { background: #FFFBEB; color: #92400E; border-left: 4px solid #F59E0B; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border-left: 4px solid #3B82F6; }

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--brand-navy);
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-float);
  font-size: 0.875rem;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toastIn 0.3s ease;
  border-left: 4px solid var(--brand-yellow);
}

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

/* =============================================
   PÁGINA DE LOGIN
   ============================================= */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-blue) 60%, #1D4ED8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: white;
  border-radius: 1rem;
  box-shadow: var(--shadow-float);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));
  padding: 2rem;
  text-align: center;
}

.login-body { padding: 2rem; }

/* =============================================
   STATUS BADGES
   ============================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-pendente    { background: #FEF3C7; color: #92400E; }
.status-visualizada { background: #DBEAFE; color: #1E40AF; }
.status-confirmada  { background: #D1FAE5; color: #065F46; }

/* =============================================
   NOTIFICAÇÃO AGENDA - Destaque no topo
   ============================================= */
.agenda-banner {
  background: linear-gradient(135deg, var(--brand-yellow), var(--brand-gold));
  color: var(--brand-navy);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 12px rgba(245,158,11,0.25);
}

.agenda-banner-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* =============================================
   ÁREA CHIP
   ============================================= */
.area-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #EFF6FF;
  color: var(--brand-royal);
  gap: 0.25rem;
}

/* =============================================
   LEITURA - Painel de confirmação
   ============================================= */
.read-confirm-box {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-card);
  padding: 1.5rem;
  text-align: center;
  margin-top: 1.5rem;
}

.read-confirm-box.confirmed {
  border-color: #059669;
  background: #F0FDF4;
}

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

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-float);
  }

  .sidebar-overlay {
    display: block !important;
    position: fixed; inset: 0;
    background: rgba(15,27,76,0.5);
    z-index: 39;
  }

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

  .hamburger-btn { display: flex; }

  .page-content { padding: 1rem; }

  .msg-preview { max-width: 200px; }

  #toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }
}

/* =============================================
   PWA - Install banner
   ============================================= */
#pwa-install-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--brand-navy);
  color: white;
  padding: 1rem 1.5rem;
  display: none;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
}

#pwa-install-banner.show { display: flex; }

/* =============================================
   SCROLLBAR CUSTOMIZADA
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* =============================================
   ANIMAÇÕES
   ============================================= */
.fade-in {
  animation: fadeIn 0.3s ease;
}

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

.skeleton {
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: 0.375rem;
}

@keyframes skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #94A3B8;
}

.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state p { font-size: 0.9rem; }
