/* ============================================================
   HORTA BOA VISTA — ADMIN.CSS
   Painel administrativo CMS
   ============================================================ */

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

:root {
  --green-900: #1B5E20;
  --green-700: #388E3C;
  --green-500: #4CAF50;
  --green-100: #C8E6C9;
  --green-50:  #E8F5E9;
  --lime:      #8BC34A;
  --gold:      #F9A825;
  --red:       #EF4444;
  --red-lt:    #FEE2E2;
  --white:     #FFFFFF;
  --gray-50:   #FAFAFA;
  --gray-100:  #F5F5F5;
  --gray-200:  #EEEEEE;
  --gray-300:  #E0E0E0;
  --gray-600:  #757575;
  --gray-700:  #616161;
  --gray-900:  #212121;
  --dark:      #1A1A1A;
  --sidebar-bg: #0d1f0f;
  --sidebar-w:  260px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.08);
  --shadow-md:  0 4px 20px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--gray-100);
  color: var(--dark);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; }
input, textarea, select {
  font-family: 'Inter', sans-serif;
  outline: none;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--green-50); }
::-webkit-scrollbar-thumb { background: var(--green-500); border-radius: 99px; }

/* ─── LOGIN PAGE ─────────────────────────────────────────────── */
.login-page {
  background: linear-gradient(135deg, #0a2e0a, #1B5E20);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
}

.login-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-leaves {
  position: absolute;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5rem;
  padding: 2rem;
  opacity: .1;
  font-size: 3rem;
}

.login-leaves span {
  animation: leaf-drift 8s ease-in-out infinite;
}
.login-leaves span:nth-child(odd)  { animation-duration: 6s;  animation-delay: 1s; }
.login-leaves span:nth-child(3n+1) { animation-duration: 10s; animation-delay: 3s; }

@keyframes leaf-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-20px) rotate(15deg); }
}

.login-container {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  animation: card-in .5s ease;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(30px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--green-700), var(--lime));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 30px rgba(27,94,32,.35);
}

.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--green-900);
  margin-bottom: .3rem;
}

.login-logo p {
  font-size: .85rem;
  color: var(--gray-600);
}

.login-form { display: flex; flex-direction: column; gap: 1.2rem; }

.login-field { display: flex; flex-direction: column; gap: .4rem; }
.login-field label { font-size: .85rem; font-weight: 600; color: var(--gray-700); }

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: .85rem;
  font-size: 1rem;
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: .85rem 1rem .85rem 2.8rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  transition: border .3s;
}

.input-wrapper input:focus { border-color: var(--green-500); }

.toggle-pass {
  position: absolute;
  right: .75rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: .25rem;
}

.login-error {
  background: var(--red-lt);
  color: var(--red);
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  border-left: 3px solid var(--red);
}

.login-btn {
  padding: 1rem;
  background: linear-gradient(135deg, var(--green-700), var(--green-500));
  color: var(--white);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .3s;
  box-shadow: 0 4px 20px rgba(27,94,32,.3);
}

.login-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(27,94,32,.4); }
.login-btn:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.login-back {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  font-size: .85rem;
  color: var(--gray-600);
  transition: color .3s;
}
.login-back:hover { color: var(--green-700); }

/* ─── ADMIN PANEL LAYOUT ─────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--green-700), var(--lime));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.sidebar-logo-text strong {
  display: block;
  color: var(--white);
  font-size: .95rem;
  line-height: 1.2;
}

.sidebar-logo-text span {
  font-size: .72rem;
  color: rgba(255,255,255,.4);
}

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

.sidebar-section-label {
  font-size: .67rem;
  font-weight: 700;
  color: rgba(255,255,255,.25);
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: .5rem .75rem;
  margin-top: .75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.6);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: .25rem;
}

.sidebar-link .icon { font-size: 1.1rem; width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,.06); color: var(--white); }
.sidebar-link.active { background: linear-gradient(135deg, var(--green-700), var(--green-500)); color: var(--white); }

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

/* MAIN CONTENT */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

/* TOPBAR */
.admin-topbar {
  background: var(--white);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar h2 { font-size: 1.1rem; color: var(--green-900); }
.admin-topbar-right { display: flex; align-items: center; gap: 1rem; }

.admin-user-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .9rem;
  background: var(--green-50);
  border-radius: 99px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--green-800);
}

/* CONTENT AREA */
.admin-content {
  padding: 2rem;
}

/* ─── Panels / Sections ──────────────────────────────────────── */
.admin-panel {
  display: none;
  animation: panel-in .3s ease;
}

.admin-panel.active { display: block; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 { font-size: 1rem; color: var(--green-900); }
.card-body { padding: 1.5rem; }

/* ─── Stats grid ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow .3s;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-card-icon.green  { background: var(--green-50);  }
.stat-card-icon.gold   { background: #FFF8E1;           }
.stat-card-icon.blue   { background: #E3F2FD;           }
.stat-card-icon.purple { background: #F3E5F5;           }

.stat-card-info strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--green-900);
  line-height: 1;
}

.stat-card-info span {
  font-size: .8rem;
  color: var(--gray-600);
  margin-top: .2rem;
  display: block;
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  transition: all .2s;
}

.btn-green  { background: var(--green-700); color: var(--white); }
.btn-green:hover  { background: var(--green-900); transform: translateY(-1px); }
.btn-red    { background: var(--red-lt); color: var(--red); }
.btn-red:hover    { background: #FCA5A5; }
.btn-gray   { background: var(--gray-100); color: var(--gray-700); }
.btn-gray:hover   { background: var(--gray-200); }
.btn-outline-green { border: 2px solid var(--green-700); color: var(--green-700); background: transparent; }
.btn-outline-green:hover { background: var(--green-700); color: var(--white); }

/* ─── Table ───────────────────────────────────────────────────── */
.admin-table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.admin-table th {
  text-align: left;
  padding: .85rem 1rem;
  background: var(--gray-50);
  color: var(--gray-700);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

.admin-table td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  color: var(--gray-700);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--gray-50); }

.table-img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--green-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  overflow: hidden;
}

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

.badge-ativo   { display: inline-flex; padding: .2rem .7rem; border-radius: 99px; font-size: .72rem; font-weight: 700; }
.badge-sim     { background: var(--green-100); color: var(--green-900); }
.badge-nao     { background: var(--red-lt);    color: var(--red); }
.badge-destaque { background: #FFF8E1; color: #b45309; }

.table-actions { display: flex; gap: .5rem; }

/* ─── Forms ────────────────────────────────────────────────────── */
.form-grid { display: grid; gap: 1.25rem; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-size: .83rem; font-weight: 600; color: var(--gray-700); }

.form-control {
  padding: .75rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
  color: var(--dark);
  transition: border .2s;
  resize: vertical;
}

.form-control:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(76,175,80,.12); }

.form-control-file {
  padding: .6rem 1rem;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--gray-50);
  transition: all .2s;
  font-size: .88rem;
}

.form-control-file:hover { border-color: var(--green-500); background: var(--green-50); }

.img-preview {
  width: 120px;
  height: 90px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  overflow: hidden;
  border: 2px solid var(--gray-200);
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }

.form-check {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  user-select: none;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green-500);
  cursor: pointer;
}

/* ─── Modal ────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all .3s;
}

.modal-backdrop.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  transform: scale(.95);
  transition: transform .3s;
}

.modal-backdrop.open .modal { transform: scale(1); }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}

.modal-header h3 { font-size: 1rem; color: var(--green-900); }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .9rem;
  transition: all .2s;
}

.modal-close:hover { background: var(--red-lt); color: var(--red); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: .75rem; }

/* ─── Toast ─────────────────────────────────────────────────────── */
.admin-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: .9rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  z-index: 9999;
  transform: translateX(200%);
  opacity: 0;
  transition: all .4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 350px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.admin-toast.show { transform: translateX(0); opacity: 1; }
.admin-toast.success { background: var(--green-700); color: var(--white); }
.admin-toast.error   { background: var(--red);       color: var(--white); }
.admin-toast.info    { background: #1E40AF;           color: var(--white); }

/* ─── Settings ──────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.settings-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.settings-card h4 {
  font-size: .9rem;
  color: var(--green-900);
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--green-100);
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ─── Color swatch ──────────────────────────────────────────────── */
.cat-icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.cat-icon-opt {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  cursor: pointer;
  transition: all .2s;
  border: 2px solid transparent;
}

.cat-icon-opt:hover { background: var(--green-100); transform: scale(1.1); }
.cat-icon-opt.selected { border-color: var(--green-500); background: var(--green-50); }

/* ─── Upload zone ───────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all .3s;
  background: var(--gray-50);
}

.upload-zone:hover { border-color: var(--green-500); background: var(--green-50); }
.upload-zone .icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.upload-zone p  { font-size: .85rem; color: var(--gray-600); }
.upload-zone.has-img { border-style: solid; border-color: var(--green-300); }

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .admin-content { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-height: 100vh; border-radius: 0; }
}

/* ─── Empty state ──────────────────────────────────────────────── */
.empty-table {
  text-align: center;
  padding: 3rem;
  color: var(--gray-600);
}
.empty-table .icon { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* ─── Sidebar overlay (mobile) ─────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  display: none;
}
.sidebar-overlay.show { display: block; }

/* ─── Hamburger admin ─────────────────────────────────────────── */
.admin-hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: .4rem;
}
.admin-hamburger span { display: block; width: 22px; height: 2px; background: var(--gray-700); border-radius: 99px; }

@media (max-width: 1024px) {
  .admin-hamburger { display: flex; }
}

/* ─── Depoimentos stars ─────────────────────────────────────────── */
.star-rating { display: flex; gap: .25rem; cursor: pointer; }
.star-rating .star { font-size: 1.4rem; color: var(--gray-300); transition: color .15s; }
.star-rating .star.active { color: var(--gold); }
.star-rating .star:hover  { color: var(--gold); }

/* ─── Hero slide preview ─────────────────────────────────────────── */
.slide-preview {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 100px;
  background: var(--gray-100);
}
.slide-preview img { width: 100%; height: 100%; object-fit: cover; }
.slide-preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,rgba(27,94,32,.7),rgba(10,46,10,.5));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  padding: .5rem;
}
.slide-preview-overlay strong { font-size: .8rem; display: block; }
