/* ==========================================================
   App Shell — sidebar / topbar / bottom-nav dashboard layout
   Used on user-facing app pages (dashboard, etc.)
   ========================================================== */

.app-shell { display: flex; min-height: 100vh; background: var(--surface); }

/* ---------- Desktop sidebar ---------- */
.app-sidebar {
  width: 250px; flex-shrink: 0; background: var(--bg);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 1030;
  display: flex; flex-direction: column; overflow-y: auto;
  transition: transform .25s ease, width .2s ease;
}
.app-sidebar-brand {
  display: flex; align-items: center; padding: 18px 20px 14px; flex-shrink: 0;
}
.app-sidebar-brand img { height: 38px; max-width: 170px; object-fit: contain; }

.app-sidebar-nav { list-style: none; margin: 0; padding: 4px 12px; flex: 1 1 auto; }
.app-sidebar-nav li { margin-bottom: 2px; }
.app-sidebar-nav .app-nav-divider { height: 1px; background: var(--border); margin: 10px 6px; }

.app-nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 10px; color: var(--text); font-weight: 500; font-size: 14px;
  text-decoration: none; transition: background .15s ease, color .15s ease;
}
.app-nav-link i { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; color: var(--text-muted); }
.app-nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.app-nav-link:hover i { color: var(--primary); }
.app-nav-link.active { background: var(--primary); color: #fff; }
.app-nav-link.active i { color: #fff; }
.app-nav-link .app-nav-badge {
  margin-left: auto; background: var(--primary); color: #fff; font-size: 11px;
  font-weight: 700; line-height: 1; padding: 4px 7px; border-radius: 100px;
}
.app-nav-link.active .app-nav-badge { background: rgba(255,255,255,.25); color: #fff; }
.app-nav-link.logout-link { color: #dc2626; }
.app-nav-link.logout-link i { color: #dc2626; }
.app-nav-link.logout-link:hover { background: rgba(220,38,38,.08); }
.app-nav-link.premium-link { color: #b45309; }
.app-nav-link.premium-link i { color: #d97706; }

.app-sidebar-upsell {
  margin: 10px 14px 18px; padding: 16px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
}
.app-sidebar-upsell .upsell-icon {
  width: 34px; height: 34px; border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center; color: #d97706;
  font-size: 16px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.app-sidebar-upsell .upsell-title { font-weight: 700; font-size: 14px; color: #78350f; margin-bottom: 3px; }
.app-sidebar-upsell .upsell-text { font-size: 12px; color: #92400e; line-height: 1.4; margin-bottom: 12px; }
.app-sidebar-upsell .upsell-btn {
  display: block; width: 100%; text-align: center; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; padding: 8px 0; font-weight: 700; font-size: 13px;
  text-decoration: none; transition: background .15s ease;
}
.app-sidebar-upsell .upsell-btn:hover { background: var(--primary-dark); color: #fff; }

.app-sidebar-brandmark {
  margin: 0 14px 16px; padding-top: 12px; border-top: 1px solid var(--border);
  text-align: center; font-size: 11px; color: var(--text-muted); flex-shrink: 0;
}
.app-sidebar-brandmark strong { color: var(--text-muted); }

.app-sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1025;
}

/* ---------- Main column ---------- */
.app-main { margin-left: 250px; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Topbar ---------- */
.app-topbar {
  background: var(--bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; gap: 12px;
}
.app-topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.app-hamburger-btn {
  background: none; border: none; font-size: 22px; color: var(--text); line-height: 1;
  padding: 4px; border-radius: 8px; cursor: pointer; flex-shrink: 0;
}
.app-hamburger-btn:hover { background: var(--surface-2); }
.app-mobile-logo { display: none; align-items: center; }
.app-mobile-logo img { height: 30px; }

.app-topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.app-bell-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 17px; cursor: pointer;
}
.app-bell-btn:hover { background: var(--surface-2); }
.app-bell-badge {
  position: absolute; top: -3px; right: -3px; background: #dc2626; color: #fff;
  font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); padding: 0 3px;
}

.app-user-btn {
  display: flex; align-items: center; gap: 10px; background: none; border: none; cursor: pointer;
  padding: 4px 8px 4px 4px; border-radius: 100px; color: var(--text);
}
.app-user-btn:hover { background: var(--surface-2); }
.app-user-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.app-user-info { text-align: left; display: none; }
.app-user-name { font-weight: 700; font-size: 13.5px; line-height: 1.3; color: var(--text); }
.app-user-tier { font-size: 11px; font-weight: 600; line-height: 1.3; }
.app-user-btn .bi-chevron-down { font-size: 11px; color: var(--text-muted); display: none; }

@media (min-width: 576px) {
  .app-user-info { display: block; }
  .app-user-btn .bi-chevron-down { display: inline-block; }
}

/* ---------- Content ---------- */
.app-content { padding: 24px; flex: 1 1 auto; }

/* ---------- Announcement banner ---------- */
.app-announcement {
  background: linear-gradient(135deg,#0f172a,#1e293b); border-radius: 14px; padding: 16px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; position: relative;
}
.app-announcement-pill {
  background: #facc15; color: #78350f; font-size: 10.5px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 100px; flex-shrink: 0;
}
.app-announcement-text { color: #f1f5f9; font-size: 13.5px; flex: 1 1 200px; min-width: 0; }
.app-announcement-btn {
  background: #facc15; color: #78350f; font-weight: 700; font-size: 13px; border: none;
  padding: 7px 16px; border-radius: 8px; text-decoration: none; flex-shrink: 0; white-space: nowrap;
}
.app-announcement-btn:hover { background: #eab308; color: #78350f; }
.app-announcement-close {
  background: none; border: none; color: rgba(255,255,255,.5); font-size: 18px; cursor: pointer;
  line-height: 1; flex-shrink: 0; margin-left: auto;
}
.app-announcement-close:hover { color: #fff; }

/* ---------- Quick actions ---------- */
.app-quick-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.app-quick-action {
  flex: 1 1 130px; background: var(--surface); border-radius: 12px; padding: 16px 10px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  text-decoration: none; color: var(--text); transition: transform .12s ease, box-shadow .12s ease;
  border: 1px solid transparent;
}
.app-quick-action:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); border-color: var(--border); }
.app-quick-action .qa-icon {
  width: 44px; height: 44px; border-radius: 50%; background: rgba(22,163,74,.12); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.app-quick-action .qa-label { font-weight: 600; font-size: 12.5px; line-height: 1.3; }
.app-quick-action .qa-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; background: var(--primary);
  color: #fff; padding: 1px 6px; border-radius: 100px;
}

/* ---------- Task / earnings card ---------- */
.app-task-card { background: var(--bg); }
.app-task-card .task-icon-wrap {
  width: 38px; height: 38px; border-radius: 10px; background: rgba(22,163,74,.12); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}

/* ---------- Newsletter card (dashboard variant) ---------- */
.app-newsletter-card {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 14px; padding: 20px; color: #fff;
}
.app-newsletter-card .nl-icon { font-size: 1.6rem; color: #fff; margin-bottom: 8px; }
.app-newsletter-card .nl-title { font-weight: 700; font-size: 14.5px; margin-bottom: 3px; }
.app-newsletter-card .nl-sub { font-size: 12.5px; color: rgba(255,255,255,.85); margin-bottom: 14px; }
.app-newsletter-card .newsletter-form { display: flex; flex-direction: column; gap: 8px; }
.app-newsletter-card .newsletter-input {
  width: 100%; padding: 9px 14px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.12); color: #fff; font-size: 13px; outline: none;
}
.app-newsletter-card .newsletter-input::placeholder { color: rgba(255,255,255,.7); }
.app-newsletter-card .newsletter-btn {
  padding: 9px 18px; border-radius: 8px; border: none; background: #fff; color: var(--primary-dark);
  font-weight: 700; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.app-newsletter-card .newsletter-feedback { margin-top: 8px; font-size: 12px; text-align: left; }
.app-newsletter-card .newsletter-feedback.success { color: #dcfce7; }
.app-newsletter-card .newsletter-feedback.error { color: #fecaca; }

/* ---------- Floating chat launcher offset (keep above mobile bottom nav) ---------- */
@media (max-width: 767px) {
  #alice-launcher, .alice-launcher, .chat-launcher { bottom: 78px !important; }
}

/* ---------- Mobile bottom nav ---------- */
.app-bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  background: var(--bg); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  align-items: stretch; justify-content: space-around;
}
.app-bottom-nav a {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 2px; color: var(--text-muted); text-decoration: none; font-size: 10.5px; font-weight: 600;
  border-radius: 10px;
}
.app-bottom-nav a i { font-size: 19px; }
.app-bottom-nav a.active { color: var(--primary); }

/* ==========================================================
   Responsive breakpoints
   ========================================================== */
@media (max-width: 991px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .app-sidebar.open { transform: translateX(0); }
  .app-sidebar-backdrop.show { display: block; }
  .app-main { margin-left: 0; }
  .app-mobile-logo { display: flex; }
  .app-bottom-nav { display: flex; }
  .app-content { padding-bottom: 90px; }
}

@media (max-width: 575px) {
  .app-topbar { padding: 10px 14px; }
  .app-content { padding: 14px 14px 90px; }
  .app-announcement { padding: 14px 44px 14px 14px; }
  .app-announcement-close { position: absolute; top: 10px; right: 10px; margin-left: 0; }
  .app-announcement-btn { order: 3; }
}
