/*
 * iGoLocal — Dashboard Shell
 * Unified sidebar, topbar, mobile drawer, and responsive layout.
 * Used by: dashboard.html, update-profile.html, review-manager.html, business-reviews.html
 */

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── CSS Variables ── */
:root {
  --ig-bg:           #f7faf6;
  --ig-card:         #ffffff;
  --ig-green:        #5BAA3C;
  --ig-green-dark:   #4a9630;
  --ig-green-soft:   #eef8ea;
  --ig-navy:         #0E2235;
  --ig-muted:        #64748b;
  --ig-border:       #e2e6ef;
  --ig-line:         #edf1f6;
  --ig-red:          #dc2626;
  --ig-shadow:       0 18px 45px rgba(14, 34, 53, .08);
  --ig-shadow-soft:  0 10px 26px rgba(14, 34, 53, .06);
  --topbar-h:        59px;
  font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── App layout ── */
.app-layout {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}
.main-content {
  flex: 1;
  overflow-x: hidden;
  min-width: 0;
}

/* ── Sticky desktop topbar ── */
.topbar {
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--ig-border);
  padding: 12px 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  height: var(--topbar-h);
}
.topbar-logo {
  display: inline-flex;
  align-items: center;
  min-width: 150px;
}
.topbar-logo img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}
.topbar-spacer { flex: 1; }
.topbar-biz {
  font-size: 13px;
  font-weight: 700;
  color: var(--ig-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 34px;
}
.topbar-biz i { font-size: 17px; color: var(--ig-green); }

/* ── Sidebar ── */
.sidebar-nav {
  width: 248px;
  background: rgba(255, 255, 255, .94);
  border-right: 1px solid var(--ig-border);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* section label */
.sidebar-nav .nav-section {
  font-size: 10px;
  font-weight: 900;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 10px 12px 4px;
  margin-top: 8px;
}
.sidebar-nav .nav-section:first-child { margin-top: 0; }

/* nav links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  color: #475569;
  transition: background .16s ease, color .16s ease, transform .16s ease;
  text-decoration: none;
}
.nav-link:hover {
  background: var(--ig-green-soft);
  color: var(--ig-green-dark);
  transform: translateX(2px);
}
.nav-link.active {
  background: var(--ig-green-soft);
  color: var(--ig-green-dark);
  box-shadow: inset 0 0 0 1px rgba(91, 170, 60, .16);
}

/* nav icon box — business-reviews style */
.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: var(--ig-muted);
  font-size: 15px;
  flex-shrink: 0;
  transition: background .16s ease, color .16s ease;
}
.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
  background: #ffffff;
  color: var(--ig-green-dark);
}
.nav-link i:not(.nav-icon i) { font-size: 18px; flex-shrink: 0; }

/* divider + signout */
.nav-divider {
  height: 1px;
  background: var(--ig-line);
  margin: 10px 0;
}
.nav-signout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  color: #94a3b8;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .16s ease;
  margin-top: auto;
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.nav-signout:hover {
  background: #fef2f2;
  color: var(--ig-red);
  transform: translateX(2px);
}
.nav-signout i { font-size: 18px; }
.nav-signout .nav-icon { background: #fef2f2; color: #fca5a5; }
.nav-signout:hover .nav-icon { background: #fee2e2; color: var(--ig-red); }

/* ── Mobile topbar ── */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--ig-border);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.hamburger {
  background: var(--ig-green-soft);
  border: 1px solid rgba(91, 170, 60, .18);
  border-radius: 12px;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 21px;
  height: 2px;
  background: var(--ig-navy);
  border-radius: 2px;
}

/* ── Mobile overlay ── */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 34, 53, .48);
  z-index: 300;
}
.mobile-overlay.open { display: block; }

/* ── Mobile drawer ── */
.mobile-drawer {
  position: fixed;
  top: 0;
  left: -292px;
  width: 292px;
  height: 100vh;
  background: var(--ig-card);
  z-index: 400;
  transition: left .25s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 18px 0 45px rgba(14, 34, 53, .16);
}
.mobile-drawer.open { left: 0; }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ig-border);
}
.drawer-logo { display: flex; align-items: center; }
.drawer-logo img { height: 30px; width: auto; object-fit: contain; }
.drawer-close {
  background: var(--ig-bg);
  border: 1px solid var(--ig-border);
  border-radius: 12px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  font-size: 18px;
  color: var(--ig-muted);
  line-height: 1;
  display: grid;
  place-items: center;
}
.drawer-nav { padding: 14px 10px; flex: 1; }
.drawer-section {
  font-size: 10px;
  font-weight: 900;
  color: #94a3b8;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 10px 12px 5px;
}
.drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ig-muted);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.drawer-link .nav-icon {
  background: #f1f5f9;
  color: var(--ig-muted);
}
.drawer-link:hover,
.drawer-link.active {
  background: var(--ig-green-soft);
  color: var(--ig-green-dark);
}
.drawer-link:hover .nav-icon,
.drawer-link.active .nav-icon {
  background: #ffffff;
  color: var(--ig-green-dark);
}
.drawer-link i { font-size: 18px; }
.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--ig-border);
}
.drawer-signout {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ig-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}
.drawer-signout:hover { color: var(--ig-red); }

/* ── Shared drawer/signout JS helpers ── */
/* openDrawer / closeDrawer defined inline per page */

/* ── Responsive breakpoints ── */
@media (max-width: 768px) {
  .topbar,
  .sidebar-nav { display: none !important; }
  .mobile-topbar { display: flex !important; }
  .app-layout {
    flex-direction: column !important;
    min-height: 100vh;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* ── Hide business name text on mobile (keep store icon only) ── */
@media (max-width: 768px) {
  .topbar-biz {
    font-size: 0 !important;
    max-width: 44px !important;
    gap: 0 !important;
  }
  .topbar-biz i {
    font-size: 20px !important;
  }
}

/* ── Mobile topbar: hamburger | logo (center) | store icon (right) ── */
.mobile-topbar {
  justify-content: space-between;
  align-items: center;
}
.mobile-logo {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}
.mobile-store-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  color: var(--ig-green);
}
.mobile-store-link i { font-size: 24px; }

/* ── Spinning loader icon ── */
@keyframes ig-spin {
  to { transform: rotate(360deg); }
}
.ti-loader-2 {
  display: inline-block;
  animation: ig-spin 0.7s linear infinite;
}

/* ── Spinning loader override (Tabler webfont) ── */
i.ti-loader-2,
.ti.ti-loader-2 {
  animation: ig-spin 0.7s linear infinite !important;
  display: inline-block !important;
  transform-origin: center center;
}

/* ── FAQ AI Suggestions Modal ── */
.suggest-modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(14,34,53,.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.suggest-modal-overlay.open { opacity: 1; visibility: visible; }
.suggest-modal {
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  max-width: 620px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 28px 70px rgba(14,34,53,.25);
  transform: translateY(16px) scale(.97);
  opacity: 0;
  transition: transform .28s cubic-bezier(.16,1,.3,1), opacity .28s ease;
}
.suggest-modal-overlay.open .suggest-modal { transform: translateY(0) scale(1); opacity: 1; }
.suggest-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.suggest-modal-title { font-size: 19px; font-weight: 800; color: #0E2235; display: flex; align-items: center; gap: 8px; letter-spacing: -.02em; }
.suggest-modal-title i { color: #5BAA3C; }
.suggest-modal-close { background: #f7faf6; border: 1px solid #e6ebf2; border-radius: 10px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; color: #64748b; display: grid; place-items: center; }
.suggest-modal-close:hover { color: #dc2626; border-color: #fca5a5; background: #fef2f2; }
.suggest-card { border: 1px solid #e6ebf2; border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; background: #f7fbf5; }
.suggest-card-q { font-size: 14px; font-weight: 800; color: #0E2235; margin-bottom: 6px; line-height: 1.4; }
.suggest-card-a { font-size: 13px; color: #475569; line-height: 1.65; margin-bottom: 14px; }
.suggest-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: #5BAA3C;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: background .15s, transform .15s;
}
.suggest-card-btn:hover { background: #4a9630; transform: translateY(-1px); }
.suggest-card-btn.added { background: #e8f5e2; color: #3a7a22; cursor: default; transform: none; }
