/* ==========================================================================
   ClickEarn — Components (Sidebar, Navbar, Stat Cards, Widgets)
   ========================================================================== */

/* ---------------------------------------------------------------------- */
/* SIDEBAR                                                                 */
/* ---------------------------------------------------------------------- */
.sidebar{
  position:fixed;
  top:0; left:0; bottom:0;
  width:var(--sidebar-width);
  z-index:1030;
  display:flex;
  flex-direction:column;
  transition:var(--transition-slow);
  overflow:hidden;
}
.sidebar-scroll{ flex:1; overflow-y:auto; overflow-x:hidden; padding:8px 14px 20px; }
body.sidebar-collapsed .sidebar{ width:var(--sidebar-width-collapsed); }

.sidebar-brand{
  display:flex; align-items:center; gap:10px;
  padding:22px 20px 18px;
  flex-shrink:0;
}
.sidebar-brand .logo-mark,
.logo-mark{
  width:48px; height:48px; border-radius:14px;
  background:var(--gradient-primary);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:21px; flex-shrink:0; overflow:hidden;
  box-shadow:0 6px 14px rgba(124,58,237,0.35);
}
.sidebar-brand .logo-mark img,
.logo-mark img{ width:100%; height:100%; object-fit:cover; }
.sidebar-brand .brand-text{ line-height:1.1; overflow:hidden; white-space:nowrap; }
.sidebar-brand .brand-text .name{ font-family:var(--font-display); font-weight:800; font-size:17px; }
.sidebar-brand .brand-text .tag{ font-size:9.5px; letter-spacing:.09em; font-weight:700; opacity:.55; }
body.sidebar-collapsed .brand-text{ display:none; }

.nav-group-label{
  font-size:10.5px; text-transform:uppercase; letter-spacing:.08em; font-weight:800;
  padding:16px 12px 6px; opacity:.4;
}
body.sidebar-collapsed .nav-group-label{ display:none; }

.sidebar-link{
  display:flex; align-items:center; gap:12px;
  padding:10.5px 12px;
  border-radius:12px;
  margin-bottom:2px;
  font-size:13.5px; font-weight:600;
  transition:var(--transition);
  position:relative;
  white-space:nowrap;
}
.sidebar-link i{ font-size:16px; width:20px; text-align:center; flex-shrink:0; }
.sidebar-link .lbl{ overflow:hidden; text-overflow:ellipsis; flex:1; }
body.sidebar-collapsed .sidebar-link .lbl,
body.sidebar-collapsed .sidebar-link .link-badge{ display:none; }
.sidebar-link .link-badge{
  margin-left:auto; font-size:10.5px; font-weight:800; border-radius:99px;
  padding:2px 7px; flex-shrink:0;
}

/* Light sidebar (Admin) */
.sidebar--light{ background:#FFFFFF; border-right:1px solid var(--color-border); }
.sidebar--light .sidebar-brand .brand-text .name{ color:var(--color-text); }
.sidebar--light .sidebar-link{ color:#4B4E5E; }
.sidebar--light .sidebar-link:hover{ background:var(--color-primary-50); color:var(--color-primary-dark); }
.sidebar--light .sidebar-link.active{
  background:var(--gradient-primary); color:#fff;
  box-shadow:0 6px 16px rgba(124,58,237,0.3);
}
.sidebar--light .sidebar-link.active .link-badge{ background:rgba(255,255,255,.25); color:#fff; }
.sidebar--light .sidebar-link:not(.active) .link-badge{ background:var(--color-danger-bg); color:var(--color-danger); }
.sidebar--light .logout-link{ color:var(--color-danger); }
.sidebar--light .logout-link:hover{ background:var(--color-danger-bg); }

/* Dark sidebar (User) */
.sidebar--dark{ background:var(--color-sidebar); }
.sidebar--dark .sidebar-brand .brand-text .name{ color:#fff; }
.sidebar--dark .sidebar-brand .brand-text .name span{ color:var(--color-primary-light); }
.sidebar--dark .sidebar-brand .brand-text .tag{ color:var(--color-primary-light); opacity:.8; }
.sidebar--dark .nav-group-label{ color:#9490AC; }
.sidebar--dark .sidebar-link{ color:#B7B3CC; }
.sidebar--dark .sidebar-link:hover{ background:rgba(255,255,255,.06); color:#fff; }
.sidebar--dark .sidebar-link.active{ background:var(--gradient-primary); color:#fff; box-shadow:0 6px 16px rgba(124,58,237,0.35); }
.sidebar--dark .sidebar-link:not(.active) .link-badge{ background:var(--color-danger); color:#fff; }
.sidebar--dark .sidebar-link.active .link-badge{ background:rgba(255,255,255,.25); color:#fff; }

.sidebar-status-card{
  margin:14px 14px 18px; padding:16px; border-radius:16px;
  background:linear-gradient(135deg, rgba(124,58,237,.25), rgba(124,58,237,.08));
  border:1px solid rgba(167,139,250,.35);
}
.sidebar-status-card .st-label{ font-size:10.5px; color:#C9C4E6; text-transform:uppercase; letter-spacing:.06em; font-weight:700; }
.sidebar-status-card .st-value{ color:#fff; font-weight:800; font-size:14px; margin:4px 0 10px; display:flex; align-items:center; gap:6px; }
.sidebar-status-card a{ font-size:12px; font-weight:700; color:var(--color-primary-light); }
body.sidebar-collapsed .sidebar-status-card{ display:none; }

/* Mobile drawer */
@media (max-width: 1199.98px){
  .sidebar{ transform:translateX(-105%); box-shadow:none; }
  body.sidebar-mobile-open .sidebar{ transform:translateX(0); box-shadow:0 20px 60px rgba(0,0,0,.35); width:280px; }
  .sidebar-backdrop{
    display:none; position:fixed; inset:0; background:rgba(10,6,20,.5); z-index:1025; backdrop-filter:blur(2px);
  }
  body.sidebar-mobile-open .sidebar-backdrop{ display:block; }
}

/* ---------------------------------------------------------------------- */
/* TOPBAR                                                                  */
/* ---------------------------------------------------------------------- */
.topbar{
  height:var(--topbar-height);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 32px;
  position:sticky; top:0; z-index:1010;
  background:rgba(246,247,251,.85);
  backdrop-filter:blur(10px);
  border-bottom:1px solid transparent;
}
@media (max-width: 767.98px){ .topbar{ padding:0 16px; } }

.topbar-greeting h1{ font-size:17px; }
.topbar-logo{
  width:40px; height:40px; border-radius:12px; background:var(--gradient-primary);
  align-items:center; justify-content:center; color:#fff; font-size:16px; flex-shrink:0; overflow:hidden;
}
.topbar-logo img{ width:100%; height:100%; object-fit:cover; }
.topbar-greeting p{ margin:2px 0 0; font-size:13px; color:var(--color-text-muted); }

.topbar-right{ display:flex; align-items:center; gap:16px; }
.icon-btn{
  width:42px; height:42px; border-radius:13px; background:#fff; border:1px solid var(--color-border);
  display:flex; align-items:center; justify-content:center; position:relative; color:var(--color-text);
  transition:var(--transition); flex-shrink:0;
}
.icon-btn:hover{ border-color:var(--color-primary-light); color:var(--color-primary); }
.icon-btn .ping{
  position:absolute; top:-6px; right:-6px; background:var(--color-danger); color:#fff;
  font-size:10px; font-weight:800; min-width:18px; height:18px; border-radius:99px;
  display:flex; align-items:center; justify-content:center; padding:0 4px; border:2px solid var(--color-bg);
}
.sidebar-toggle-btn{
  width:42px; height:42px; border-radius:13px; background:#fff; border:1px solid var(--color-border);
  display:flex; align-items:center; justify-content:center; color:var(--color-text);
}
.user-menu-btn{
  display:flex; align-items:center; gap:10px; background:#fff; border:1px solid var(--color-border);
  padding:6px 12px 6px 6px; border-radius:99px; cursor:pointer;
}
.user-menu-btn img{ width:34px; height:34px; border-radius:50%; object-fit:cover; }
.user-menu-btn .u-name{ font-size:13px; font-weight:800; line-height:1.1; }
.user-menu-btn .u-role{ font-size:10.5px; color:var(--color-text-muted); }

/* ---------------------------------------------------------------------- */
/* STAT CARDS                                                              */
/* ---------------------------------------------------------------------- */
.stat-card{
  background:var(--color-surface); border:1px solid var(--color-border); border-radius:var(--radius-lg);
  padding:20px; box-shadow:var(--shadow-card); height:100%;
  transition:var(--transition);
}
.stat-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lg); }
.stat-icon-tile{
  width:48px; height:48px; border-radius:14px; display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:19px; margin-bottom:14px;
}
.stat-card .stat-value{ font-family:var(--font-display); font-size:24px; font-weight:800; line-height:1.1; }
.stat-card .stat-label{ font-size:12.5px; color:var(--color-text-muted); margin-top:3px; font-weight:600; }
.stat-card .stat-trend{ font-size:11.5px; font-weight:800; display:inline-flex; align-items:center; gap:2px; margin-left:6px; }
.stat-trend.up{ color:var(--color-success); }
.stat-trend.down{ color:var(--color-danger); }
.stat-card .stat-link{ display:block; margin-top:12px; font-size:12.5px; font-weight:700; }

.bg-tile-purple{ background:var(--gradient-primary); }
.bg-tile-blue{ background:linear-gradient(135deg,#60A5FA,#2563EB); }
.bg-tile-green{ background:linear-gradient(135deg,#4ADE80,#16A34A); }
.bg-tile-orange{ background:linear-gradient(135deg,#FB923C,#EA580C); }
.bg-tile-red{ background:linear-gradient(135deg,#F87171,#DC2626); }

/* Hero / promo panel (user dashboard "Watch Ads & Earn") */
.promo-hero{
  background:var(--gradient-hero); border-radius:var(--radius-lg); padding:32px;
  position:relative; overflow:hidden; color:#fff; height:100%;
  box-shadow:var(--shadow-purple);
}
.promo-hero::before{
  content:''; position:absolute; width:260px; height:260px; border-radius:50%;
  background:rgba(255,255,255,.08); top:-90px; right:-60px;
}
.promo-hero h3{ font-size:24px; color:#fff; margin-bottom:8px; }
.promo-hero p{ color:rgba(255,255,255,.85); font-size:13.5px; max-width:340px; margin-bottom:20px; }
.promo-hero .btn-white{ background:#fff; color:var(--color-primary-dark); border:none; font-weight:800; }
.promo-hero .btn-white:hover{ background:#F3F0FF; }
.promo-illustration{ position:absolute; right:24px; bottom:0; width:170px; opacity:.95; }

/* Streak dots */
.streak-row{ display:flex; justify-content:space-between; gap:8px; margin:14px 0 8px; }
.streak-day{ text-align:center; flex:1; }
.streak-day .dot{
  width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:var(--color-primary-50); color:var(--color-primary-light); margin:0 auto 6px; font-size:14px;
}
.streak-day.done .dot{ background:var(--gradient-primary); color:#fff; }
.streak-day .lbl{ font-size:10.5px; color:var(--color-text-muted); font-weight:700; }

/* Widget list rows (recent earnings / activity) */
.list-row{ display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid #F1F1F7; }
.list-row:last-child{ border-bottom:none; }
.list-row .li-icon{ width:38px; height:38px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.list-row .li-title{ font-size:13px; font-weight:700; }
.list-row .li-sub{ font-size:11.5px; color:var(--color-text-muted); }
.list-row .li-amount{ margin-left:auto; font-weight:800; font-size:13.5px; }

/* Announcement item */
.announce-item{ display:flex; gap:12px; padding:12px 0; border-bottom:1px solid #F1F1F7; }
.announce-item:last-child{ border-bottom:none; }
.announce-item .a-icon{ width:40px; height:40px; border-radius:11px; background:var(--color-primary-50); color:var(--color-primary); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.announce-item .a-title{ font-size:13px; font-weight:800; }
.announce-item .a-text{ font-size:12px; color:var(--color-text-muted); margin-top:2px; }
.announce-item .a-date{ font-size:11px; color:var(--color-text-soft); white-space:nowrap; }

/* System overview rows */
.sys-row{ display:flex; align-items:center; justify-content:space-between; padding:11px 0; border-bottom:1px solid #F1F1F7; font-size:13px; }
.sys-row:last-child{ border-bottom:none; }
.sys-row .sys-label{ color:var(--color-text-muted); font-weight:600; }
.sys-row .sys-value{ font-weight:800; }

/* Login streak card legacy alias */
.account-status-box{ border:1px dashed var(--color-primary-light); border-radius:14px; padding:14px; background:var(--color-primary-50); }

/* Legend dots for donut chart */
.legend-row{ display:flex; align-items:center; gap:10px; padding:9px 0; }
.legend-dot{ width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.legend-row .legend-lbl{ font-size:13px; font-weight:600; flex:1; }
.legend-row .legend-val{ font-size:13px; font-weight:800; }

/* Footer */
.app-footer{ padding:20px 32px 26px; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; font-size:12px; color:var(--color-text-soft); }
.app-footer a{ color:var(--color-text-soft); margin-left:16px; }
.app-footer a:hover{ color:var(--color-primary); }
@media (max-width: 767.98px){ .app-footer{ padding:16px; flex-direction:column; text-align:center; } .app-footer a{ margin:0 8px; } }

/* Auth pages */
.auth-wrap{ min-height:100vh; display:flex; }
.auth-side{
  flex:1; background:var(--gradient-hero); position:relative; overflow:hidden;
  display:flex; flex-direction:column; justify-content:center; padding:60px; color:#fff;
}
.auth-side::before{ content:''; position:absolute; width:420px; height:420px; border-radius:50%; background:rgba(255,255,255,.06); top:-140px; left:-120px; }
.auth-side::after{ content:''; position:absolute; width:300px; height:300px; border-radius:50%; background:rgba(255,255,255,.06); bottom:-120px; right:-80px; }
.auth-side .content{ position:relative; z-index:1; max-width:420px; }
.auth-form-side{ flex:1; display:flex; align-items:center; justify-content:center; padding:40px; background:#fff; }
.auth-card{ width:100%; max-width:400px; }
@media (max-width: 991.98px){ .auth-side{ display:none; } }
