/* ==========================================================================
   GEAR_RUI_MOREIRA - Design System & Styles (Expanded Version)
   Grupo Escoteiro Rui Moreira - Sistema de Progressão e Gestão
   ========================================================================== */

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

:root {
  /* Color Palette - Scout Theme */
  --bg-primary: #0b130e;
  --bg-secondary: #132219;
  --bg-card: rgba(23, 42, 31, 0.7);
  --bg-card-hover: rgba(30, 56, 41, 0.85);
  
  --forest-dark: #0e271a;
  --forest-mid: #1b4332;
  --forest-green: #2d6a4f;
  --forest-light: #52b788;
  --forest-accent: #74c69d;
  
  --gold-primary: #d4af37;
  --gold-glow: rgba(212, 175, 55, 0.4);
  --gold-light: #f4d03f;
  
  /* Ramo / Seção Colors */
  --ramo-lobinho: #f39c12;     /* Amarelo/Laranja - Alcateia */
  --ramo-escoteiro: #27ae60;   /* Verde - Tropa Escoteira */
  --ramo-senior: #8e44ad;      /* Bordô/Vinho - Tropa Sênior */
  --ramo-pioneiro: #e74c3c;    /* Vermelho - Clã Pioneiro */
  
  /* Neutral Colors */
  --text-main: #f0f7f3;
  --text-muted: #95a5a6;
  --text-dim: #6c7a77;
  --border-light: rgba(82, 183, 136, 0.2);
  --border-active: rgba(212, 175, 55, 0.5);
  
  /* Shadows & Effects */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --glass-bg: rgba(19, 34, 25, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(45, 106, 79, 0.25) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(212, 175, 55, 0.12) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

/* Header & Top Bar */
.header {
  background: rgba(14, 39, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.8rem 2rem;
}

.header-container {
  max-width: 1350px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--forest-green), var(--gold-primary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: 0 0 16px var(--gold-glow);
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--forest-green), #1b4332);
  color: #fff;
  border: 1px solid var(--forest-light);
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--forest-light), var(--forest-green));
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(45, 106, 79, 0.4);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-primary), #b38f24);
  color: #0b130e;
  border: none;
  font-weight: 700;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--gold-glow);
}

/* Navigation Tabs */
.nav-bar {
  background: rgba(19, 34, 25, 0.5);
  border-bottom: 1px solid var(--border-light);
  padding: 0 2rem;
}

.nav-container {
  max-width: 1350px;
  margin: 0 auto;
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
}

.nav-item {
  padding: 0.9rem 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-item:hover { color: var(--text-main); }
.nav-item.active { color: var(--gold-primary); border-bottom-color: var(--gold-primary); }

/* Main Container */
.main-content {
  max-width: 1350px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

/* Grid & Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-lg);
}

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

.stat-card.gold::before { background: var(--gold-primary); }
.stat-card.lobinho::before { background: var(--ramo-lobinho); }
.stat-card.escoteiro::before { background: var(--ramo-escoteiro); }
.stat-card.senior::before { background: var(--ramo-senior); }
.stat-card.pioneiro::before { background: var(--ramo-pioneiro); }

.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.stat-title { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-icon { font-size: 1.4rem; opacity: 0.8; }
.stat-value { font-family: 'Outfit', sans-serif; font-size: 2.2rem; font-weight: 800; color: #fff; }
.stat-sub { font-size: 0.8rem; color: var(--forest-accent); margin-top: 0.3rem; display: flex; align-items: center; gap: 0.3rem; }

/* Section Selector Bar */
.secao-selector-bar {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  background: rgba(14, 39, 26, 0.4);
  padding: 0.6rem;
  border-radius: 50px;
  border: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.secao-pill {
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.secao-pill:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.secao-pill.active { background: var(--forest-green); color: #fff; box-shadow: 0 0 14px rgba(45, 106, 79, 0.5); }
.secao-pill.lobinho.active { background: var(--ramo-lobinho); color: #000; }
.secao-pill.escoteiro.active { background: var(--ramo-escoteiro); color: #fff; }
.secao-pill.senior.active { background: var(--ramo-senior); color: #fff; }
.secao-pill.pioneiro.active { background: var(--ramo-pioneiro); color: #fff; }

/* Youth List & Cards */
.youth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.4rem;
}

.youth-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
  cursor: pointer;
}

.youth-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gold-primary);
}

.youth-card-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.youth-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2d6a4f, #1b4332);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-primary);
  border: 2px solid var(--border-light);
}

.youth-info h3 { font-size: 1.15rem; font-weight: 700; color: #fff; }
.youth-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-block;
  margin-top: 0.2rem;
}

.tag-lobinho { background: rgba(243, 156, 18, 0.2); color: var(--ramo-lobinho); border: 1px solid var(--ramo-lobinho); }
.tag-escoteiro { background: rgba(39, 174, 96, 0.2); color: var(--ramo-escoteiro); border: 1px solid var(--ramo-escoteiro); }
.tag-senior { background: rgba(142, 68, 173, 0.2); color: var(--ramo-senior); border: 1px solid var(--ramo-senior); }
.tag-pioneiro { background: rgba(231, 76, 60, 0.2); color: var(--ramo-pioneiro); border: 1px solid var(--ramo-pioneiro); }

.progress-container { margin: 1rem 0; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.progress-bar-bg { width: 100%; height: 8px; background: rgba(255, 255, 255, 0.1); border-radius: 10px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--forest-light), var(--gold-primary)); border-radius: 10px; transition: width 0.6s ease; }

.youth-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.specialty-count { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.3rem; }

/* Interactive Attendance Checklist Cards */
.attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.attendance-item-card {
  background: rgba(19, 34, 25, 0.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.attendance-item-card:hover {
  background: rgba(30, 56, 41, 0.9);
  border-color: var(--forest-light);
}

.attendance-item-card.checked {
  border-color: var(--forest-light);
  background: rgba(45, 106, 79, 0.35);
  box-shadow: 0 0 10px rgba(82, 183, 136, 0.2);
}

.attendance-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: transparent;
  font-size: 0.9rem;
  font-weight: 800;
  transition: all 0.2s ease;
}

.attendance-item-card.checked .attendance-checkbox {
  background: var(--forest-light);
  border-color: var(--forest-light);
  color: #0b130e;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal-content {
  background: #132219;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 550px;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-360, .modal-chamada {
  max-width: 850px !important;
  width: 95% !important;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-backdrop.open .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-family: 'Outfit', sans-serif; font-size: 1.3rem; color: #fff; }
.close-modal { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.close-modal:hover { color: #fff; }

.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4rem; }
.form-control { width: 100%; padding: 0.75rem 1rem; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-light); border-radius: var(--radius-sm); color: #fff; font-size: 0.95rem; }
.form-control:focus { outline: none; border-color: var(--gold-primary); box-shadow: 0 0 10px var(--gold-glow); }

/* Embed Box & Code */
.embed-box { background: rgba(0, 0, 0, 0.4); border: 1px dashed var(--border-light); border-radius: var(--radius-md); padding: 1.5rem; margin-top: 1rem; }
.code-block { background: #080f0a; border-radius: var(--radius-sm); padding: 1rem; font-family: 'Courier New', Courier, monospace; font-size: 0.85rem; color: var(--forest-accent); overflow-x: auto; user-select: all; }
.footer { text-align: center; padding: 1.5rem; color: var(--text-dim); font-size: 0.85rem; border-top: 1px solid var(--border-light); margin-top: 3rem; background: rgba(14, 39, 26, 0.5); }

/* ==========================================================================
   PRINT MEDIA STYLES (CORRIGE CORTE DE BARRA DE ROLAGEM NA IMPRESSÃO E PDF)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
  }

  .header, .nav-bar, .secao-selector-bar, .footer, .btn-primary, .btn-gold, .close-modal, .embed-box {
    display: none !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .modal-backdrop {
    position: relative !important;
    background: #ffffff !important;
    opacity: 1 !important;
    pointer-events: all !important;
    width: 100% !important;
    height: auto !important;
  }

  .modal-content, .modal-360, .modal-chamada {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    transform: none !important;
  }

  /* Expand all scrollable inner divs completely during print */
  div, [style*="max-height"], [style*="overflow-y"] {
    max-height: none !important;
    overflow: visible !important;
    color: #000000 !important;
  }

  table, th, td {
    color: #000000 !important;
    border: 1px solid #cccccc !important;
    background: #ffffff !important;
  }

  code {
    background: #f0f0f0 !important;
    color: #000000 !important;
    border: 1px solid #cccccc !important;
  }

  .youth-tag {
    border: 1px solid #000 !important;
    color: #000 !important;
    background: #eee !important;
  }
}
