/* ─── Fonte DIN Light ─────────────────────────────────────────────────────── */
@font-face {
  font-family: 'DIN Light';
  src: url('/static/fonts/DIN-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
}

/* ─── Variáveis ───────────────────────────────────────────────────────────── */
:root {
  --dark:        #2A2A2A;
  --dark-soft:   #3A3A3A;
  --gold:        #B8964A;
  --gold-dark:   #9A7A3A;
  --gold-light:  #C9AA72;
  --gold-pale:   #F0E8D8;
  --bg:          #F8F7F4;
  --white:       #FFFFFF;
  --text:        #2A2A2A;
  --text-light:  #6B6B6B;
  --border:      #E0D8CC;
  --error:       #C0392B;
  --error-bg:    #FDECEA;
  --success:     #1E7E4B;
  --success-bg:  #E8F5EE;
  --sidebar-w:   240px;
  --radius:      6px;
  --shadow:      0 2px 12px rgba(0,0,0,0.08);
}

/* ─── Reset / Base ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: 'DIN Light', 'Segoe UI', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-dark); }

/* ─── Tela de Login ───────────────────────────────────────────────────────── */
body.login-body {
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-wrapper {
  display: flex;
  width: 900px;
  max-width: 100%;
  min-height: 540px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* Painel esquerdo — brand */
.login-brand {
  flex: 0 0 42%;
  background: var(--dark);
  border-right: 1px solid #3A3A3A;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
  position: relative;
  overflow: hidden;
}

.login-logo {
  width: 130px;
  height: auto;
  margin-bottom: 28px;
  filter: brightness(0.95);
}

.login-brand-name {
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 300;
  text-align: center;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.login-brand-sub {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-top: 8px;
  text-align: center;
}

.login-brand-tag {
  color: var(--text-light);
  font-size: 0.8rem;
  margin-top: 40px;
  text-align: center;
  letter-spacing: 0.05em;
}

/* Elemento decorativo SVG (arcos geométricos da assinatura) */
.login-decor {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 160px;
  opacity: 0.25;
  pointer-events: none;
}

/* Painel direito — formulário */
.login-form-panel {
  flex: 1;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 44px;
}

.login-form-inner {
  width: 100%;
  max-width: 340px;
}

.login-title {
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--dark);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.login-subtitle {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 32px;
}

/* ─── Formulários ─────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.93rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,150,74,0.12);
}

.form-control::placeholder { color: #BCBAB6; }

.input-group {
  position: relative;
}

.input-group .form-control { padding-right: 42px; }

.input-group-btn {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 42px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.input-group-btn:hover { color: var(--gold); }

/* ─── Botões ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gold);
  color: var(--white);
  border-color: var(--gold);
}

.btn-primary:hover {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}

.btn-outline:hover {
  background: var(--gold-pale);
}

.btn-ghost {
  background: transparent;
  color: var(--text-light);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: #F5C6C2;
}

.btn-danger:hover { background: var(--error-bg); }

.btn-full { width: 100%; }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ─── Alertas ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.87rem;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error  { background: var(--error-bg);   color: var(--error);   border: 1px solid #F5C6C2; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #A8D9BC; }
.alert-info   { background: var(--gold-pale);  color: var(--gold-dark); border: 1px solid var(--gold-light); }

/* ─── Layout principal (com sidebar) ─────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid #3A3A3A;
}

.sidebar-logo {
  width: 110px;
  height: auto;
  display: block;
  margin: 0 auto 12px;
  filter: brightness(0.9);
}

.sidebar-brand-text {
  text-align: center;
  color: var(--white);
  font-size: 0.7rem;
  line-height: 1.4;
  opacity: 0.7;
}

.sidebar-brand-sub {
  color: var(--gold);
  letter-spacing: 0.3em;
  font-size: 0.6rem;
  text-align: center;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-section-label {
  padding: 16px 20px 6px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5A5A5A;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #A0A0A0;
  font-size: 0.87rem;
  letter-spacing: 0.02em;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
  border-left: 3px solid transparent;
}

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

.nav-item.active {
  background: rgba(184,150,74,0.12);
  color: var(--gold-light);
  border-left-color: var(--gold);
}

.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid #3A3A3A;
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  color: var(--white);
  font-weight: 500;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-info { overflow: hidden; }

.user-name {
  color: var(--white);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: #6A6A6A;
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Conteúdo principal */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 300;
  color: var(--dark);
  letter-spacing: 0.02em;
}

.page-body {
  padding: 28px 32px;
  flex: 1;
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--dark);
  letter-spacing: 0.02em;
}

.card-body { padding: 24px; }

/* Cards de ação (dashboard) */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.action-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.action-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 20px rgba(184,150,74,0.15);
  transform: translateY(-2px);
  color: var(--text);
}

.action-card-icon {
  width: 48px;
  height: 48px;
  background: var(--gold-pale);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.action-card-label {
  font-size: 0.87rem;
  letter-spacing: 0.02em;
}

/* ─── Tabelas ─────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #F0EDE8;
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FDFCFA; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}

.badge-active  { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: #F5F5F5; color: #999; }
.badge-admin   { background: var(--gold-pale);  color: var(--gold-dark); }
.badge-tipo    { background: #EEF2FF; color: #3B4EBF; }

/* ─── Separador dourado ───────────────────────────────────────────────────── */
.gold-line {
  height: 2px;
  background: linear-gradient(90deg, var(--gold) 0%, transparent 100%);
  border: none;
  margin: 24px 0;
}

/* ─── Utilitários ─────────────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-light { color: var(--text-light); }
.text-sm { font-size: 0.82rem; }
.text-gold { color: var(--gold); }
.text-right { text-align: right; }
.w-full { width: 100%; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 0.97rem; font-weight: 400; }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── Responsivo ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .login-wrapper { flex-direction: column; border-radius: 0; min-height: 100vh; width: 100%; }
  .login-brand { flex: none; padding: 32px 24px; min-height: 220px; }
  .login-logo { width: 100px; }
  .login-form-panel { padding: 32px 24px; }

  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 20px 16px; }
  .page-header { padding: 16px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
