/* =============================================
   ARABIM ESFIHARIA — Admin CSS
   Painel de Controle
   ============================================= */

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

:root {
  --admin-bg: #f4f6f8;
  --admin-surface: #ffffff;
  --admin-text: #334155;
  --admin-text-light: #64748b;
  --admin-border: #e2e8f0;
  --admin-primary: #7B1E2D; /* Arabim Bordô */
  --admin-primary-hover: #5a1520;
  --admin-accent: #C8933A; /* Arabim Dourado */
  --admin-success: #10b981;
  --admin-danger: #ef4444;
  
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ==========================================
   LOGIN SCREEN
   ========================================== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--admin-primary);
}
.login-box {
  background: var(--admin-surface);
  padding: 40px; border-radius: var(--radius);
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
  width: 100%; max-width: 400px; text-align: center;
}
.login-box h2 { color: var(--admin-primary); margin-bottom: 8px; font-size: 1.5rem; }
.login-box p { color: var(--admin-text-light); margin-bottom: 24px; font-size: 0.9rem; }
.login-form .form-group { text-align: left; margin-bottom: 16px; }
.login-form label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.9rem; }
.login-form input {
  width: 100%; padding: 12px;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius); outline: none; transition: 0.2s;
}
.login-form input:focus { border-color: var(--admin-primary); box-shadow: 0 0 0 3px rgba(123,30,45,0.1); }
.login-btn {
  width: 100%; padding: 12px; background: var(--admin-accent); color: white;
  border-radius: var(--radius); font-weight: 600; margin-top: 8px;
  transition: 0.2s;
}
.login-btn:hover { background: #b07e2c; }
.login-error { color: var(--admin-danger); font-size: 0.85rem; margin-top: 12px; display: none; }
.login-error.show { display: block; }

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

.sidebar {
  width: var(--sidebar-w); background: var(--admin-surface);
  border-right: 1px solid var(--admin-border);
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 10;
}
.sidebar-header {
  height: var(--header-h); padding: 0 24px; display: flex; align-items: center;
  border-bottom: 1px solid var(--admin-border); font-weight: 700;
  color: var(--admin-primary); font-size: 1.1rem; gap: 10px;
}
.sidebar-nav { padding: 20px 12px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; margin-bottom: 4px; border-radius: var(--radius);
  color: var(--admin-text-light); font-weight: 500; transition: 0.2s;
}
.nav-item:hover { background: var(--admin-bg); color: var(--admin-primary); }
.nav-item.active { background: rgba(123,30,45,0.08); color: var(--admin-primary); }
.nav-icon { font-size: 1.1rem; }
.sidebar-footer { padding: 20px; border-top: 1px solid var(--admin-border); }
.btn-logout {
  width: 100%; padding: 10px; background: #fee2e2; color: var(--admin-danger);
  border-radius: var(--radius); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-logout:hover { background: #fca5a5; }

.main-content {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-height: 100vh;
}
.topbar {
  height: var(--header-h); background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 5;
}
.topbar-right { display: flex; gap: 16px; align-items: center; }
.btn-view-site {
  padding: 8px 16px; border: 1px solid var(--admin-primary);
  color: var(--admin-primary); border-radius: var(--radius);
  font-weight: 500; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; transition: 0.2s;
}
.btn-view-site:hover { background: var(--admin-primary); color: white; }

.content-area { padding: 32px; max-width: 1000px; margin: 0 auto; width: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-title { font-size: 1.5rem; font-weight: 700; color: #0f172a; }

/* Panels structure */
.admin-panel { display: none; animation: fadeIn 0.3s ease; }
.admin-panel.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================
   FORM ELEMENTS
   ========================================== */
.card { background: var(--admin-surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; border: 1px solid var(--admin-border); }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; color: #0f172a; border-bottom: 1px solid var(--admin-border); padding-bottom: 12px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 8px; font-size: 0.9rem; color: #475569; }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--admin-border); border-radius: var(--radius); outline: none; transition: 0.2s; background: var(--admin-bg); }
.form-control:focus { border-color: var(--admin-primary); background: white; box-shadow: 0 0 0 3px rgba(123,30,45,0.1); }
textarea.form-control { resize: vertical; min-height: 100px; }

.checkbox-group { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.checkbox-group input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--admin-primary); }

.btn-save { padding: 12px 24px; background: var(--admin-primary); color: white; border-radius: var(--radius); font-weight: 600; transition: 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-save:hover { background: var(--admin-primary-hover); transform: translateY(-1px); }

.help-text { font-size: 0.8rem; color: var(--admin-text-light); margin-top: 6px; display: block; }

/* ==========================================
   CRUD TABLES & LISTS
   ========================================== */
.data-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--admin-border); }
.data-table th { font-weight: 600; color: #475569; font-size: 0.85rem; text-transform: uppercase; background: var(--admin-bg); }
.data-table tbody tr:hover { background: rgba(0,0,0,0.01); }

.badge-true { background: #d1fae5; color: #065f46; padding: 4px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-false { background: #f1f5f9; color: #475569; padding: 4px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }

.btn-icon { padding: 6px; color: var(--admin-text-light); transition: 0.2s; border-radius: 4px; }
.btn-icon:hover { background: var(--admin-bg); color: var(--admin-primary); }
.btn-icon.delete:hover { color: var(--admin-danger); background: #fee2e2; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  opacity: 0; visibility: hidden; transition: 0.2s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-content {
  background: var(--admin-surface); width: 100%; max-width: 600px;
  border-radius: var(--radius); box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3);
  transform: translateY(20px); transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-overlay.open .modal-content { transform: translateY(0); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--admin-border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 1.2rem; color: #0f172a; }
.btn-close { font-size: 1.5rem; color: var(--admin-text-light); line-height: 1; }
.btn-close:hover { color: var(--admin-text); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--admin-border); display: flex; justify-content: flex-end; gap: 12px; background: var(--admin-bg); border-radius: 0 0 var(--radius) var(--radius); }
.btn-cancel { padding: 10px 16px; background: white; border: 1px solid var(--admin-border); border-radius: var(--radius); font-weight: 500; transition: 0.2s; }
.btn-cancel:hover { background: #f8fafc; }

/* Toast Notification */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: white; border-left: 4px solid var(--admin-success);
  padding: 16px 20px; border-radius: var(--radius); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  display: flex; align-items: center; gap: 12px;
  animation: slideIn 0.3s ease forwards;
}
.toast.hide { animation: slideOut 0.3s ease forwards; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* Utils */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mb-0 { margin-bottom: 0 !important; }
.mt-4 { margin-top: 16px; }
