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

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

:root {
  --green-dark:   #1E5C2E;
  --green-mid:    #2D6E3E;
  --green-light:  #6DBE45;
  --green-pale:   #f0f7f2;
  --white:        #FFFFFF;
  --bg:           #F4F6F5;
  --border:       #E0E0E0;
  --text:         #1F2937;
  --text-muted:   #6B7280;
  --text-light:   #9CA3AF;
  --red:          #EF4444;
  --red-bg:       #fef2f2;
  --yellow:       #F59E0B;
  --font:         'Inter', -apple-system, sans-serif;
  --radius:       12px;
  --radius-sm:    8px;
  --sidebar-w:    224px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.12);
  --transition:   all .18s ease;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; }
input, textarea, select { font-family: var(--font); }

/* ─── Screen management ────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; }

/* ─── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--green-dark);
  display: flex; flex-direction: column;
  z-index: 100; transition: transform .25s ease;
  border-right: 1px solid rgba(255,255,255,.05);
}

.sidebar-logo {
  padding: 22px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo img { width: 72px; object-fit: contain; filter: brightness(0) invert(1); }
.sidebar-logo-fallback {
  font-size: 15px; font-weight: 800; color: #fff;
  letter-spacing: .04em; line-height: 1.2;
}
.sidebar-logo-sub { font-size: 10px; color: rgba(255,255,255,.5); font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }

.sidebar-nav { padding: 12px 0; flex: 1; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 20px; color: rgba(255,255,255,.72);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: var(--transition); border-left: 3px solid transparent;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,.11); color: #fff;
  border-left-color: var(--green-light);
}
.nav-item .nav-icon { font-size: 16px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-item.nav-danger:hover { background: rgba(239,68,68,.12); color: #fca5a5; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
}
.sidebar-user-info { flex: 1; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.5); }

/* ─── App Layout ───────────────────────────────────────────── */
.app-layout {
  display: flex; min-height: 100vh;
}
.main-content {
  margin-left: var(--sidebar-w); flex: 1;
  padding: 32px; min-height: 100vh;
}

/* ─── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 28px;
}
.page-header-left h1 { font-size: 20px; font-weight: 700; line-height: 1.3; }
.page-header-left p { font-size: 13.5px; color: var(--text-muted); margin-top: 2px; }
.user-badge {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; cursor: pointer;
  padding: 7px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--white);
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
.user-badge:hover { border-color: #ccc; box-shadow: var(--shadow-md); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green-light), var(--green-mid));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0;
}
.user-badge-name { font-weight: 500; }
.user-badge-arrow { color: var(--text-muted); font-size: 11px; }

/* ─── Breadcrumb ───────────────────────────────────────────── */
.breadcrumb {
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px;
  display: flex; align-items: center; gap: 4px;
}
.breadcrumb a { color: var(--green-dark); font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--text-light); }

/* ─── Dashboard Cards ──────────────────────────────────────── */
.dashboard-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dash-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
.dash-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.dash-card-icon { font-size: 26px; margin-bottom: 14px; }
.dash-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.dash-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
.dash-card .big-number { font-size: 40px; font-weight: 800; color: var(--green-dark); margin-bottom: 6px; line-height: 1; }
.dash-card .stats-row { display: flex; gap: 20px; margin-bottom: 18px; }
.stat-item { display: flex; flex-direction: column; gap: 2px; }
.stat-val { font-size: 22px; font-weight: 700; color: var(--green-dark); }
.stat-lbl { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ─── Welcome Banner ───────────────────────────────────────── */
.welcome-banner {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green-mid) 100%);
  border-radius: var(--radius); padding: 28px 32px;
  color: #fff; margin-bottom: 24px;
  display: flex; align-items: center; justify-content: space-between;
  overflow: hidden; position: relative;
}
.welcome-banner::after {
  content: '';
  position: absolute; right: -20px; top: -30px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.welcome-banner::before {
  content: '';
  position: absolute; right: 60px; bottom: -50px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(109,190,69,.12);
}
.welcome-text { position: relative; z-index: 1; }
.welcome-text h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.welcome-text p { font-size: 13.5px; color: rgba(255,255,255,.75); }
.welcome-emoji { font-size: 40px; position: relative; z-index: 1; }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  border: none; transition: var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--green-dark); color: #fff; }
.btn-primary:hover { background: var(--green-mid); box-shadow: 0 4px 12px rgba(30,92,46,.3); }
.btn-primary:active { transform: scale(.98); }
.btn-outline { background: transparent; color: var(--green-dark); border: 1.5px solid var(--green-dark); }
.btn-outline:hover { background: var(--green-pale); }
.btn-danger { background: transparent; color: var(--red); border: 1.5px solid var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); border-color: #ccc; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-full { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 15px; }

/* ─── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-label-hint { font-size: 11.5px; color: var(--text-muted); font-weight: 400; margin-left: 4px; }

.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text); background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(30,92,46,.08);
}
.form-input.error { border-color: var(--red); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.1); }
.form-error { font-size: 12px; color: var(--red); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.recaptcha-wrap { margin: 16px 0 12px; min-height: 78px; }
.form-textarea { resize: vertical; min-height: 88px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer; }

/* ─── Editor ───────────────────────────────────────────────── */
.editor-wrap { border: 1.5px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color .15s; }
.editor-wrap:focus-within { border-color: var(--green-dark); box-shadow: 0 0 0 3px rgba(30,92,46,.08); }
.editor-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 8px 10px; background: #fafafa;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.editor-btn {
  width: 29px; height: 29px; display: flex; align-items: center;
  justify-content: center; border: none; background: transparent;
  border-radius: 5px; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); transition: var(--transition);
}
.editor-btn:hover { background: var(--border); color: var(--text); }
.editor-btn.active { background: var(--green-pale); color: var(--green-dark); }
.editor-select {
  height: 29px; padding: 0 8px; border: 1px solid var(--border);
  border-radius: 5px; font-size: 12px; color: var(--text-muted);
  background: transparent; cursor: pointer;
}
.editor-divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.editor-textarea {
  width: 100%; min-height: 210px; padding: 14px;
  border: none !important; border-radius: 0 !important;
  resize: vertical; font-size: 13.5px; line-height: 1.65;
}
.editor-textarea:focus { outline: none !important; box-shadow: none !important; }

/* ─── Upload Area ──────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: var(--transition); position: relative; overflow: hidden;
}
.upload-area:hover { border-color: var(--green-dark); background: var(--green-pale); }
.upload-area.has-image { padding: 0; border-style: solid; }
.upload-icon { font-size: 28px; color: var(--text-light); margin-bottom: 10px; }
.upload-label { font-size: 13.5px; font-weight: 600; color: var(--green-dark); }
.upload-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.upload-preview { width: 100%; height: 160px; object-fit: cover; border-radius: calc(var(--radius) - 2px); display: block; }
.upload-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .18s;
  border-radius: calc(var(--radius) - 2px);
}
.upload-area.has-image:hover .upload-overlay { opacity: 1; }
.upload-overlay span { color: #fff; font-size: 13px; font-weight: 500; }

/* ─── Tags Input ───────────────────────────────────────────── */
.tags-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-item {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--green-pale); color: var(--green-dark);
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.tag-remove { cursor: pointer; color: var(--green-mid); font-size: 14px; line-height: 1; }
.tag-remove:hover { color: var(--red); }

/* ─── Table ────────────────────────────────────────────────── */
.table-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #fafafa; padding: 11px 16px;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  text-align: left; border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.data-table td {
  padding: 13px 16px; font-size: 13px;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover td { background: #fafbfa; }
.td-title { font-weight: 500; max-width: 260px; }
.td-title-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 260px; }

/* ─── Badges ───────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-published { background: #dcfce7; color: #15803d; }
.badge-draft { background: #fef9c3; color: #92400e; }

/* ─── Action Buttons (table) ───────────────────────────────── */
.action-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center;
  justify-content: center; border: none; border-radius: 7px;
  cursor: pointer; transition: var(--transition); font-size: 15px; background: transparent;
}
.action-btn-edit   { color: var(--green-dark); }
.action-btn-delete { color: var(--red); }
.action-btn-edit:hover   { background: var(--green-pale); }
.action-btn-delete:hover { background: var(--red-bg); }

/* ─── Form Card Layout ─────────────────────────────────────── */
.form-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.form-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.form-card-title { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ─── Input with icon ──────────────────────────────────────── */
.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 42px; }
.input-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--text-muted); background: none; border: none; font-size: 16px; padding: 4px; display: flex; align-items: center; }
.input-icon:hover { color: var(--text); }

/* ─── Login Screen ─────────────────────────────────────────── */
.login-screen { display: flex; min-height: 100vh; }
.login-screen.active { display: flex; }
.login-left {
  flex: 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0d3019 0%, #1e5c2e 45%, #2d6e3e 100%);
  overflow: hidden;
}
.login-left-bg {
  position: absolute; inset: 0;
  background: url('../../../painel-page.png') center/cover no-repeat;
  opacity: .82;
}
.login-left-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(10,32,16,.48) 0%, rgba(30,92,46,.32) 100%);
}
.login-left-pattern {
  position: absolute; inset: 0; opacity: .04;
  background-image: radial-gradient(circle, #fff 1px, transparent 1px);
  background-size: 24px 24px;
}
.login-brand { position: relative; z-index: 1; text-align: center; }
.login-brand img { width: 90px; margin-bottom: 20px; filter: brightness(0) invert(1); }
.login-brand-fallback {
  font-size: 28px; font-weight: 800; color: #fff;
  letter-spacing: .06em; margin-bottom: 8px;
}
.login-brand-sub {
  font-size: 11px; color: rgba(255,255,255,.5);
  letter-spacing: .18em; text-transform: uppercase;
  font-weight: 400;
}
.login-brand-tagline {
  font-size: 13px; color: rgba(255,255,255,.65);
  margin-top: 16px; font-weight: 400; letter-spacing: .02em;
}
.login-dots {
  display: flex; justify-content: center; gap: 6px; margin-top: 24px;
}
.login-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.25);
}
.login-dot:first-child { background: var(--green-light); }

.login-right { width: 460px; display: flex; align-items: center; justify-content: center; padding: 48px; background: var(--white); }
.login-card { width: 100%; }
.login-card-header { margin-bottom: 30px; }
.login-card-header h2 { font-size: 23px; font-weight: 700; margin-bottom: 5px; }
.login-card-header p { font-size: 13.5px; color: var(--text-muted); }

.login-checkbox-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox-label input[type=checkbox] { accent-color: var(--green-dark); width: 15px; height: 15px; }
.login-forgot { font-size: 13px; color: var(--green-dark); font-weight: 500; }
.login-forgot:hover { text-decoration: underline; }

.login-divider { text-align: center; margin: 24px 0; position: relative; }
.login-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.login-divider span { background: var(--white); padding: 0 12px; font-size: 12px; color: var(--text-muted); position: relative; }

.login-footer { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 22px; }
.login-footer a { color: var(--green-dark); font-weight: 600; }
.login-footer a:hover { text-decoration: underline; }

/* ─── Logout Screen ────────────────────────────────────────── */
.logout-screen { display: flex; min-height: 100vh; }
.logout-screen.active { display: flex; }
.logout-left { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #0d3019, #2d6e3e); overflow: hidden; }
.logout-card { text-align: center; }
.logout-card .logout-icon { font-size: 48px; margin-bottom: 16px; }
.logout-card h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.logout-card p { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }

/* ─── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.48);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; opacity: 0; pointer-events: none;
  transition: opacity .18s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-card {
  background: var(--white); border-radius: var(--radius);
  padding: 28px; width: 380px; box-shadow: var(--shadow-lg);
  transform: scale(.96) translateY(8px);
  transition: transform .2s ease;
}
.modal-overlay.open .modal-card { transform: scale(1) translateY(0); }
.modal-icon { font-size: 32px; margin-bottom: 14px; }
.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.modal-text { font-size: 13.5px; color: var(--text-muted); margin-bottom: 26px; line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ─── Notification Toast ───────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--green-dark); color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  z-index: 9999; transform: translateY(80px); opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--red); }

/* ─── Section Header ───────────────────────────────────────── */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-header h2 { font-size: 18px; font-weight: 700; }

/* ─── Mobile sidebar toggle ────────────────────────────────── */
.sidebar-toggle {
  display: none; position: fixed; top: 16px; left: 16px;
  z-index: 200; width: 38px; height: 38px;
  border-radius: var(--radius-sm); background: var(--green-dark);
  color: #fff; font-size: 18px; border: none;
  align-items: center; justify-content: center; box-shadow: var(--shadow-md);
}
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 960px) {
  .dashboard-cards { grid-template-columns: 1fr 1fr; }
  .form-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0; padding: 20px 16px 16px; padding-top: 64px; }
  .dashboard-cards { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { width: 100%; padding: 32px 24px; }
  .logout-left { display: none; }
  .page-header { flex-direction: column; gap: 12px; }
  .table-wrap { overflow-x: auto; }
}
