/* ============================================================
   TurismoBuzios.com — Admin Dashboard CSS
   ============================================================ */

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

:root {
  --turquoise:     #2DE1CE;
  --turquoise-dark:#1FB8A8;
  --navy:          #0B315B;
  --navy-light:    #1A4A7A;
  --sand:          #CEB28E;
  --sand-pale:     #F8F3EC;
  --white:         #FFFFFF;
  --off-white:     #F5F7FA;
  --gray-100:      #F0F2F5;
  --gray-200:      #E1E5EC;
  --gray-400:      #9AA5B4;
  --gray-600:      #5A6473;
  --success:       #22C55E;
  --warning:       #F59E0B;
  --error:         #EF4444;

  --font-heading:  'Manrope', sans-serif;
  --font-body:     'Inter', sans-serif;

  --sidebar-w:     256px;
  --header-h:      64px;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(11,49,91,0.06);
  --shadow-md: 0 4px 16px rgba(11,49,91,0.10);
  --shadow-lg: 0 8px 32px rgba(11,49,91,0.14);

  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-body);
  color: var(--navy);
  background: var(--off-white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── LOGIN SCREEN ─────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 1.5rem;
}
.login-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo {
  height: 64px;
  width: auto;
  margin: 0 auto var(--sp, 1.5rem);
}
.login-card h1 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.login-card p {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 2rem;
}
.login-form .form-group {
  text-align: left;
  margin-bottom: 1.25rem;
}
.login-form label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 0.4rem;
}
.login-form input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  font-size: 0.95rem;
  color: var(--navy);
  background: var(--gray-100);
  transition: var(--transition);
}
.login-form input:focus { outline: none; border-color: var(--turquoise); background: var(--white); }
.login-btn {
  width: 100%;
  padding: 0.875rem;
  background: var(--turquoise);
  color: var(--navy);
  border-radius: var(--r-full);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.95rem;
  transition: var(--transition);
  margin-top: 0.5rem;
}
.login-btn:hover { background: var(--turquoise-dark); }
.login-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 1rem;
  display: none;
}
.login-error.visible { display: block; }

/* ── DASHBOARD LAYOUT ─────────────────────────────────────── */
#dashboard { display: none; min-height: 100vh; }
#dashboard.visible { display: flex; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-logo { height: 40px; width: auto; filter: brightness(0) invert(1); }
.sidebar-brand-text {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  line-height: 1.3;
}
.sidebar-brand-text strong {
  display: block;
  font-size: 0.85rem;
  color: var(--white);
  font-weight: 700;
}
.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.75rem;
}
.sidebar-section-label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 0 0.75rem;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}
.sidebar-section-label:first-child { margin-top: 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: var(--r-md);
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 0.25rem;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active {
  background: rgba(45,225,206,0.12);
  color: var(--turquoise);
}
.nav-item__icon { font-size: 1.1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--r-md);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  transition: var(--transition);
  background: transparent;
  border: none;
}
.logout-btn:hover { color: var(--error); background: rgba(239,68,68,0.08); }

/* Main area */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}
.topbar-breadcrumb {
  font-size: 0.8rem;
  color: var(--gray-400);
  font-family: var(--font-heading);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-badge {
  padding: 0.3rem 0.75rem;
  background: rgba(45,225,206,0.12);
  color: var(--turquoise-dark);
  border-radius: var(--r-full);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
}
.main-content {
  padding: 2rem;
  flex: 1;
}

/* Panels */
.panel { display: none; }
.panel.active { display: block; }

/* ── CARDS / STATS ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 1.5rem;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.stat-card__label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}
.stat-card__value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 0.5rem;
}
.stat-card__sub {
  font-size: 0.78rem;
  color: var(--gray-400);
}
.stat-card__icon {
  float: right;
  font-size: 2rem;
  opacity: 0.25;
  margin-top: -0.5rem;
}

/* Content card */
.content-card {
  background: var(--white);
  border-radius: var(--r-xl);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.content-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.content-card-header h2 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}
.content-card-body { padding: 1.5rem; }

/* ── TABLE ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
thead th {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1.5px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  color: var(--navy);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--off-white); }
.td-product {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.td-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  object-fit: cover;
  background: var(--gray-100);
  flex-shrink: 0;
}
.td-name { font-weight: 600; color: var(--navy); }
.td-sub { font-size: 0.78rem; color: var(--gray-400); }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--r-full);
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.badge-success { background: rgba(34,197,94,0.1); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-error   { background: rgba(239,68,68,0.1);  color: var(--error); }
.badge-navy    { background: rgba(11,49,91,0.08);   color: var(--navy); }
.badge-turquoise { background: rgba(45,225,206,0.12); color: var(--turquoise-dark); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--r-md);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}
.btn-primary-admin {
  background: var(--turquoise);
  color: var(--navy);
}
.btn-primary-admin:hover { background: var(--turquoise-dark); }
.btn-secondary-admin {
  background: var(--navy);
  color: var(--white);
}
.btn-secondary-admin:hover { background: var(--navy-light); }
.btn-ghost-admin {
  background: var(--gray-100);
  color: var(--navy);
}
.btn-ghost-admin:hover { background: var(--gray-200); }
.btn-danger-admin {
  background: rgba(239,68,68,0.1);
  color: var(--error);
}
.btn-danger-admin:hover { background: rgba(239,68,68,0.2); }
.btn-sm-admin {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}

/* Action group */
.action-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-200);
  border-radius: var(--r-full);
  transition: var(--transition);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--white);
  top: 3px;
  left: 3px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
input:checked + .toggle-slider { background: var(--turquoise); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── MODAL ────────────────────────────────────────────────── */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,49,91,0.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
}
.admin-modal-overlay.open { opacity: 1; pointer-events: all; }
.admin-modal {
  background: var(--white);
  border-radius: var(--r-xl);
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-lg);
}
.admin-modal-overlay.open .admin-modal { transform: scale(1); }
.admin-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}
.admin-modal-body { padding: 1.5rem; }
.admin-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ── FORMS ────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid .form-full { grid-column: 1 / -1; }
.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.admin-form-group label {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-400);
}
.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  color: var(--navy);
  background: var(--off-white);
  transition: var(--transition);
  width: 100%;
}
.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
  outline: none;
  border-color: var(--turquoise);
  background: var(--white);
}
.admin-form-group textarea { resize: vertical; min-height: 100px; }

/* ── BLOG EDITOR ──────────────────────────────────────────── */
.blog-editor-toolbar {
  display: flex;
  gap: 0.35rem;
  padding: 0.5rem;
  background: var(--gray-100);
  border-radius: var(--r-md) var(--r-md) 0 0;
  border: 1.5px solid var(--gray-200);
  border-bottom: none;
  flex-wrap: wrap;
}
.toolbar-btn {
  padding: 0.3rem 0.6rem;
  border-radius: var(--r-sm);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-600);
  background: transparent;
  border: none;
  transition: var(--transition);
  cursor: pointer;
}
.toolbar-btn:hover { background: var(--white); color: var(--navy); }
.blog-editor-area {
  border: 1.5px solid var(--gray-200);
  border-radius: 0 0 var(--r-md) var(--r-md);
  min-height: 240px;
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--navy);
  line-height: 1.7;
  outline: none;
  background: var(--white);
  overflow-y: auto;
}
.blog-editor-area:focus { border-color: var(--turquoise); }
.blog-editor-area[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-400);
  pointer-events: none;
}

/* Image preview */
.img-preview-wrap {
  position: relative;
  display: inline-block;
}
.img-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--r-md);
  display: none;
  margin-top: 0.5rem;
}
.img-preview.visible { display: block; }

/* ── ADMIN MAP ────────────────────────────────────────────── */
#admin-map {
  width: 100%;
  height: 360px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--gray-200);
  margin-bottom: 1rem;
}
.map-hint {
  font-size: 0.8rem;
  color: var(--gray-400);
  font-family: var(--font-heading);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ── AFFILIATES CODE ──────────────────────────────────────── */
.aff-code {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
  padding: 0.2rem 0.5rem;
  color: var(--navy);
}
.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.15rem 0.35rem;
  border-radius: var(--r-sm);
  transition: var(--transition);
  color: var(--gray-400);
}
.copy-btn:hover { color: var(--turquoise-dark); background: var(--gray-100); }
.conversion-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--r-full);
  overflow: hidden;
  min-width: 80px;
}
.conversion-fill {
  height: 100%;
  background: var(--turquoise);
  border-radius: var(--r-full);
  transition: width 0.5s ease;
}

/* ── TOAST ────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--navy);
  color: var(--white);
  border-radius: var(--r-lg);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--turquoise); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SEARCH BAR ───────────────────────────────────────────── */
.search-bar {
  position: relative;
  max-width: 280px;
}
.search-bar input {
  width: 100%;
  padding: 0.55rem 0.9rem 0.55rem 2.2rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--r-full);
  font-size: 0.85rem;
  background: var(--off-white);
  color: var(--navy);
  transition: var(--transition);
}
.search-bar input:focus { outline: none; border-color: var(--turquoise); background: var(--white); }
.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  pointer-events: none;
}

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}
.empty-state__icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}
.empty-state p { font-size: 0.85rem; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .main-content { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr; }
}
