@import 'base.css';

/* ── Layout ── */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0c1210 0%, #080b0a 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.sidebar__header {
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar__header .logo {
  justify-content: center;
}

.sidebar__header .logo-img {
  height: 32px;
}

.sidebar__header .logo-text {
  color: var(--color-neon);
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.sidebar__user {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(31, 122, 92, 0.22);
  border-radius: 10px;
}

.sidebar__avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #111;
  border: 1px solid rgba(46, 204, 113, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-neon);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.sidebar__username {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-off-white);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__nav {
  flex: 1;
  padding: 10px 10px 16px;
  list-style: none;
}

.sidebar__nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: rgba(232, 240, 236, 0.72);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar__nav li a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-off-white);
}

.sidebar__nav li a.active {
  background: rgba(46, 204, 113, 0.12);
  color: var(--color-neon);
  box-shadow: inset 3px 0 0 var(--color-neon);
}

.sidebar__nav li a .icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
  border-radius: 7px;
  background: rgba(31, 122, 92, 0.14);
  transition: background 0.15s;
}

.sidebar__nav li a .icon .svg-icon {
  width: 17px;
  height: 17px;
  opacity: 0.75;
}

.sidebar__nav li a:hover .icon {
  background: rgba(31, 122, 92, 0.22);
}

.sidebar__nav li a:hover .icon .svg-icon {
  opacity: 0.95;
}

.sidebar__nav li a.active .icon {
  background: rgba(46, 204, 113, 0.2);
}

.sidebar__nav li a.active .icon .svg-icon {
  opacity: 1;
}

.sidebar__section-title {
  padding: 14px 12px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(160, 179, 170, 0.55);
}

/* ── Main area ── */
.dashboard__main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top header ── */
.dashboard__header {
  height: var(--header-height);
  background: var(--color-dark-green);
  border-bottom: 1px solid rgba(31, 122, 92, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.dashboard__header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--color-sage);
}

.dashboard__header-left .online-dot {
  width: 8px;
  height: 8px;
  background: var(--color-neon);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.dashboard__header-left strong {
  color: var(--color-vibrant);
}

.dashboard__header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-search {
  display: flex;
  align-items: center;
  background: var(--color-dark-black);
  border: 1px solid rgba(31, 122, 92, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  gap: 8px;
}

.header-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--color-off-white);
  font-size: 0.875rem;
  width: 180px;
}

.header-search input::placeholder {
  color: var(--color-sage);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-user-menu {
  position: relative;
}

.header-user__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.header-user__trigger:hover,
.header-user-menu.is-open .header-user__trigger {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.header-user__chevron {
  display: flex;
  color: var(--color-sage);
  transition: transform 0.15s;
}

.header-user-menu.is-open .header-user__chevron {
  transform: rotate(180deg);
}

.header-user__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(46, 204, 113, 0.18);
  background: linear-gradient(165deg, #1c2420 0%, #141916 100%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.2);
  z-index: 200;
  overflow: hidden;
}

.header-user__dropdown-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 14px;
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.1) 0%, transparent 70%);
}

.header-user__dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-emerald);
  border: 2px solid rgba(46, 204, 113, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.header-user__dropdown-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-user__dropdown-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.header-user__dropdown-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-off-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user__role-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-user__role-badge--admin {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.header-user__role-badge--developer {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.28);
}

.header-user__role-badge--staff {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.header-user__role-badge--helper {
  background: rgba(46, 204, 113, 0.12);
  color: #86efac;
  border: 1px solid rgba(46, 204, 113, 0.22);
}

.header-user__role-badge--supporter {
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.header-user__role-badge--member {
  background: rgba(160, 179, 170, 0.12);
  color: var(--color-sage);
  border: 1px solid rgba(160, 179, 170, 0.2);
}

.header-user__dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 0;
}

.header-user__dropdown-nav {
  padding: 8px;
}

.header-user__dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--color-off-white);
  font: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.header-user__dropdown-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-user__dropdown-icon .svg-icon {
  width: 16px;
  height: 16px;
}

.header-user__dropdown-icon--profile {
  background: rgba(46, 204, 113, 0.12);
  color: var(--color-neon);
}

.header-user__dropdown-icon--home {
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
}

.header-user__dropdown-icon--logout {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}

.header-user__dropdown-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.header-user__dropdown-item-title {
  font-size: 0.86rem;
  font-weight: 700;
}

.header-user__dropdown-item-desc {
  font-size: 0.72rem;
  color: var(--color-sage);
}

.header-user__dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.header-user__dropdown-item.is-active {
  background: rgba(46, 204, 113, 0.08);
  box-shadow: inset 0 0 0 1px rgba(46, 204, 113, 0.15);
}

.header-user__dropdown-item.is-active .header-user__dropdown-item-title {
  color: var(--color-neon);
}

.header-user__dropdown-item--danger {
  margin: 0 8px 8px;
  width: calc(100% - 16px);
}

.header-user__dropdown-item--danger .header-user__dropdown-item-title {
  color: #fca5a5;
}

.header-user__dropdown-item--danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.header-user__dropdown-item .svg-icon {
  width: 16px;
  height: 16px;
  color: var(--color-sage);
}

.header-user__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
}

.header-user__info {
  display: flex;
  flex-direction: column;
}

.header-user__name {
  font-size: 0.875rem;
  font-weight: 600;
}

.header-user__role {
  font-size: 0.75rem;
  color: var(--color-neon);
}

/* ── Content ── */
.dashboard__content {
  flex: 1;
  padding: 28px 32px 36px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(31, 122, 92, 0.12), transparent),
    var(--color-dark-black);
}

/* Hero banner */
.dashboard-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(12, 24, 20, 0.95), rgba(8, 14, 12, 0.98));
  border: 1px solid rgba(46, 204, 113, 0.2);
  border-radius: 18px;
  padding: 32px 36px;
  margin-bottom: 28px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.dashboard-hero__glow {
  position: absolute;
  top: -40%;
  right: -10%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(0, 255, 156, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.dashboard-hero__body {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.dashboard-hero__eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-vibrant);
  margin-bottom: 10px;
}

.dashboard-hero__title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--color-neon);
  margin-bottom: 10px;
  line-height: 1.1;
}

.dashboard-hero__desc {
  color: var(--color-sage);
  max-width: 520px;
  font-size: 0.92rem;
  line-height: 1.65;
}

.dashboard-hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.dashboard-hero__stats {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 180px;
}

.dashboard-hero__stat {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(46, 204, 113, 0.25);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
}

.dashboard-hero__stat--muted {
  border-color: rgba(255, 255, 255, 0.08);
}

.dashboard-hero__stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-neon);
  line-height: 1.2;
  margin-bottom: 4px;
}

.dashboard-hero__stat--muted .dashboard-hero__stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-off-white);
  letter-spacing: 0.02em;
}

.dashboard-hero__stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-sage);
}

/* Home layout */
.dashboard-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.dashboard-home__head {
  margin-bottom: 18px;
}

.dashboard-home__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-off-white);
  margin-bottom: 4px;
}

.dashboard-home__subtitle {
  font-size: 0.85rem;
  color: var(--color-sage);
}

.dashboard-home__aside {
  position: sticky;
  top: calc(var(--header-height) + 20px);
}

/* Link cards */
.dash-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-card {
  background: rgba(17, 25, 23, 0.85);
  border: 1px solid rgba(31, 122, 92, 0.18);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.dash-card--link {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.dash-card--link:hover {
  border-color: rgba(46, 204, 113, 0.4);
  background: rgba(31, 122, 92, 0.08);
  transform: translateX(3px);
}

.dash-card__body {
  flex: 1;
  min-width: 0;
}

.dash-card__body h3 {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-off-white);
}

.dash-card__body p {
  color: var(--color-sage);
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0;
}

.dash-card__arrow {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--color-vibrant);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.15s, transform 0.15s;
}

.dash-card--link:hover .dash-card__arrow {
  opacity: 1;
  transform: translateX(0);
}

.dash-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-vibrant);
}

.dash-card__icon--green {
  background: rgba(31, 122, 92, 0.22);
}

.dash-card__icon--neon {
  background: rgba(0, 255, 156, 0.1);
  color: var(--color-neon);
}

/* Profile panel */
.dash-profile {
  background: linear-gradient(180deg, rgba(17, 25, 23, 0.95), rgba(11, 15, 13, 0.98));
  border: 1px solid rgba(46, 204, 113, 0.2);
  border-radius: 16px;
  padding: 22px;
}

.dash-profile__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dash-profile__avatar {
  width: 56px !important;
  height: 56px !important;
  font-size: 1.25rem !important;
  margin-bottom: 0 !important;
}

.dash-profile__name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--color-off-white);
}

.dash-profile__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-sage);
  margin-bottom: 10px;
}

.dash-profile__btn {
  width: 100%;
  margin-top: 16px;
}

.dash-profile__ranks {
  margin-bottom: 4px;
}

/* Legacy card grid (other pages may still use) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.dash-card:not(.dash-card--link):hover {
  border-color: rgba(46, 204, 113, 0.35);
  box-shadow: var(--shadow-glow-sm);
}

.dash-card:not(.dash-card--link) h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.dash-card:not(.dash-card--link) p {
  color: var(--color-sage);
  font-size: 0.85rem;
  line-height: 1.5;
  flex: 1;
}

.dash-card__link {
  margin-top: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-vibrant);
  transition: color 0.2s;
}

.dash-card__link:hover {
  color: var(--color-neon);
}

/* Profile card */
.dash-card--profile {
  align-items: center;
  text-align: center;
}

.dash-card--profile .sidebar__avatar {
  width: 72px;
  height: 72px;
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.profile-badge {
  display: inline-block;
  background: rgba(0, 255, 156, 0.15);
  border: 1px solid rgba(0, 255, 156, 0.3);
  color: var(--color-neon);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 100px;
  margin: 8px 0 16px;
}

.dash-card--profile .btn {
  width: 100%;
  margin-bottom: 8px;
}

.profile-ranks {
  width: 100%;
  margin: 12px 0 16px;
  text-align: left;
}

.profile-ranks__empty {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
  margin: 0;
}

.profile-rank {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(31, 122, 92, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.profile-rank__name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.profile-rank__meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.75rem;
}

.profile-rank__mode {
  text-transform: capitalize;
  color: var(--color-sage);
}

.profile-rank__status {
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 600;
}

.profile-rank__status--active {
  background: rgba(57, 255, 20, 0.12);
  color: var(--color-neon);
}

.profile-rank__status--pending_delivery {
  background: rgba(240, 192, 64, 0.15);
  color: #f0c040;
}

.profile-rank__expiry {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.profile-rank__subscription {
  font-size: 0.7rem;
  color: #f0c040;
  margin-top: 4px;
}

.profile-rank__subscription--warn {
  color: #ff9f43;
}

.dashboard-section {
  margin-top: 28px;
}

.dashboard-home .dashboard-section {
  margin-top: 32px;
}

.dashboard-section__title {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: var(--color-neon);
}

.dashboard-orders {
  display: grid;
  gap: 12px;
}

.dashboard-order {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(31, 122, 92, 0.25);
  border-radius: 10px;
  padding: 14px 16px;
}

.dashboard-order__head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.dashboard-order__items {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.dashboard-order__foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.dashboard-order__delivery--delivered { color: var(--color-neon); }
.dashboard-order__delivery--failed,
.dashboard-order__delivery--manual { color: #f08080; }
.dashboard-order__delivery--pending,
.dashboard-order__delivery--processing { color: #f0c040; }

/* ── Footer ── */
.dashboard__footer {
  background: var(--color-dark-green);
  border-top: 1px solid rgba(31, 122, 92, 0.15);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--color-sage);
}

.dashboard__footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.dashboard__footer-links a:hover {
  color: var(--color-neon);
}

.dashboard__footer-cvr {
  color: var(--color-sage);
  opacity: 0.9;
}

/* Mobile toggle */
.sidebar-toggle {
  display: none;
  background: var(--color-dark-green);
  border: 1px solid rgba(31, 122, 92, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--color-off-white);
}

.sidebar-toggle .svg-icon {
  width: 22px;
  height: 22px;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .dashboard__main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .header-search {
    display: none;
  }

  .dashboard-hero {
    padding: 24px;
  }

  .dashboard-hero__title {
    font-size: 1.75rem;
  }

  .dashboard-home {
    grid-template-columns: 1fr;
  }

  .dashboard-home__aside {
    position: static;
    order: -1;
  }

  .dash-links {
    gap: 8px;
  }
}
