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

:root {
  --primary-hj: #00583C;
  --primary-hj-dark: #003E2A;
  --accent-blue: #0284c7;
  --accent-red: #dc2626;
  --accent-orange: #ea580c;
  
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --success: #10b981;
  --warning: #f59e0b;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: linear-gradient(135deg, #00583C 0%, #003E2A 100%);
  color: #ffffff;
  padding: 1.5rem 2rem;
  box-shadow: 0 4px 20px -2px rgba(0, 88, 60, 0.25);
}

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

.logo-group {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-badge {
  background-color: #ffffff;
  color: var(--primary-hj);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.logo-title h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-title p {
  font-size: 0.85rem;
  opacity: 0.85;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-pill {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* Main Content */
.main-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  width: 100%;
  flex: 1;
}

.hero-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero-section h2 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.hero-section p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 650px;
  margin: 0 auto;
}

/* Grid de Escalas */
.escalas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 25px;
  margin-bottom: 3rem;
}

/* Card de Escala */
.sector-card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
}

.sector-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.card-top-bar {
  height: 6px;
  width: 100%;
}

.card-top-bar.ti { background: linear-gradient(90deg, #00583C, #10b981); }
.card-top-bar.amb { background: linear-gradient(90deg, #dc2626, #f97316); }
.card-top-bar.man { background: linear-gradient(90deg, #0284c7, #38bdf8); }

.card-body {
  padding: 1.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.sector-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.sector-icon.ti { background: #00583C; }
.sector-icon.amb { background: #dc2626; }
.sector-icon.man { background: #0284c7; }

.sector-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.sector-badge.ti { background: #e6f3ee; color: #00583C; }
.sector-badge.amb { background: #fef2f2; color: #dc2626; }
.sector-badge.man { background: #f0f9ff; color: #0284c7; }

.sector-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.sector-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Painel de Plantonista de HOJE */
.hoje-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.hoje-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.hoje-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hoje-tag.ti { color: #00583C; }
.hoje-tag.amb { color: #dc2626; }
.hoje-tag.man { color: #0284c7; }

.hoje-escala-tipo {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: #0f172a;
  color: #fff;
}

.hoje-person {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.hoje-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}

.hoje-info {
  flex: 1;
  min-width: 0;
}

.hoje-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hoje-periodo {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hoje-contact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  color: var(--text-main);
  margin-top: 4px;
}

/* Ações dos Cards */
.card-actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.btn-card {
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-card-primary {
  flex: 1 1 auto;
}

.btn-card-primary.ti { background: #00583C; color: #fff; }
.btn-card-primary.ti:hover { background: #007E56; }

.btn-card-primary.amb { background: #dc2626; color: #fff; }
.btn-card-primary.amb:hover { background: #b91c1c; }

.btn-card-primary.man { background: #0284c7; color: #fff; }
.btn-card-primary.man:hover { background: #0369a1; }

.btn-card-secondary {
  flex: 0 0 auto;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  white-space: nowrap;
}

.btn-card-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Regra para quando a página estiver embutida via iframe (ex: intranet/dashboard) */
.is-iframe header {
  display: none !important;
}

.is-iframe .main-wrapper {
  padding-top: 1.5rem;
}

.is-iframe .btn-card-secondary {
  display: none !important;
}

.is-iframe .btn-card-primary {
  width: 100%;
}

/* Rodapé Informativo */
footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
}

/* Tema Escuro */
html.dark-theme {
  --bg-main: #0b1120;
  --bg-card: #151e2e;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #1e293b;
}

html.dark-theme body {
  background-color: var(--bg-main);
  color: var(--text-main);
}

html.dark-theme .sector-card {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

html.dark-theme .hoje-panel {
  background-color: #0f172a;
  border-color: #1e293b;
}

html.dark-theme .hoje-contact {
  background-color: #151e2e;
  border-color: #334155;
  color: #f1f5f9;
}

html.dark-theme .btn-card-secondary {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}

html.dark-theme .btn-card-secondary:hover {
  background: #334155;
}

html.dark-theme footer {
  background: #0f172a;
  border-top-color: #1e293b;
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    text-align: center;
  }
  .header-actions {
    justify-content: center;
  }
  .escalas-grid {
    grid-template-columns: 1fr;
  }
}
