/* ── ARE custom element wrappers ────────── */
are-root,
dashboard-app {
  display: block;
  min-height: 100vh;
}

dashboard-header,
dashboard-sidebar,
dashboard-main,
dashboard-logo,
dashboard-nav,
dashboard-nav-item,
dashboard-user-card,
dashboard-menu,
dashboard-stats,
dashboard-stat-card,
dashboard-table {
  display: contents;
}

/* ── Reset & Base ────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --clr-bg:        #f0f2f5;
  --clr-surface:   #ffffff;
  --clr-primary:   #16213e;
  --clr-primary-d: #0f3460;
  --clr-accent:    #e94560;
  --clr-accent-l:  #ff6b81;
  --clr-sidebar:   #1a1a2e;
  --clr-text:      #1a1a2e;
  --clr-text-sec:  #8892b0;
  --clr-text-mute: #a8b2d1;
  --clr-border:    #e8ecf1;
  --clr-green:     #00b894;
  --clr-green-bg:  #d4edda;
  --clr-green-fg:  #155724;
  --clr-yellow-bg: #fff3cd;
  --clr-yellow-fg: #856404;
  --clr-red-bg:    #f8d7da;
  --clr-red-fg:    #721c24;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.12);
  --transition:    .2s cubic-bezier(.4,0,.2,1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Animations ──────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── Layout ──────────────────────────────── */
.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 60px 1fr;
  grid-template-areas:
    "header  header"
    "sidebar main";
  min-height: 100vh;
}

/* ── Header ──────────────────────────────── */
.header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: linear-gradient(135deg, var(--clr-primary) 0%, var(--clr-primary-d) 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--clr-accent) 0%, var(--clr-accent-l) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 8px rgba(233,69,96,.35);
  transition: transform var(--transition);
}

.logo-icon:hover {
  transform: rotate(-8deg) scale(1.1);
}

.logo-text {
  font-weight: 700;
  letter-spacing: .3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-search {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 6px 14px;
  gap: 8px;
  transition: background var(--transition);
}

.header-search:hover {
  background: rgba(255,255,255,.16);
}

.header-search-icon {
  font-size: 14px;
  opacity: .7;
}

.header-search-text {
  font-size: 13px;
  color: var(--clr-text-mute);
}

.header-notification {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.header-notification:hover {
  background: rgba(255,255,255,.16);
}

.header-notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--clr-accent);
  border-radius: 50%;
  border: 2px solid var(--clr-primary);
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-item {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--clr-text-mute);
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.nav-item-active {
  background: rgba(233,69,96,.15);
  color: var(--clr-accent-l);
  font-weight: 600;
}

.nav-item-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--clr-accent);
  border-radius: 1px;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--clr-sidebar);
  padding: 0;
  color: var(--clr-text-mute);
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.04);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.1);
  border-radius: 2px;
}

.user-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 8px;
  background: linear-gradient(180deg, rgba(15,52,96,.3) 0%, transparent 100%);
}

.user-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-primary-d) 0%, var(--clr-accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(233,69,96,.25);
  border: 3px solid rgba(255,255,255,.1);
  transition: transform var(--transition), box-shadow var(--transition);
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(233,69,96,.35);
}

.user-info {
  text-align: center;
}

.user-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.user-role {
  font-size: 12px;
  color: var(--clr-text-mute);
}

.user-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(0,184,148,.12);
  color: var(--clr-green);
  font-size: 11px;
  font-weight: 600;
}

.user-status-dot {
  width: 6px;
  height: 6px;
  background: var(--clr-green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.menu-section {
  padding: 12px 20px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(168,178,209,.5);
}

.menu {
  list-style: none;
  padding: 0 8px;
}

.menu-item {
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  position: relative;
}

.menu-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.menu-item-active {
  background: rgba(233,69,96,.1);
  color: var(--clr-accent-l);
}

.menu-item-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--clr-accent);
  border-radius: 0 2px 2px 0;
}

.menu-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  opacity: .7;
}

.menu-text {
  flex: 1;
}

.menu-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: var(--clr-accent);
  color: #fff;
}

/* ── Main ────────────────────────────────── */
.main {
  grid-area: main;
  padding: 28px 32px;
  overflow-y: auto;
  background: var(--clr-bg);
}

.main::-webkit-scrollbar {
  width: 6px;
}

.main::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.12);
  border-radius: 3px;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.main-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--clr-primary);
}

.main-subtitle {
  font-size: 13px;
  color: var(--clr-text-sec);
  margin-top: 4px;
}

.main-actions {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--clr-accent) 0%, var(--clr-accent-l) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(233,69,96,.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(233,69,96,.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--clr-surface);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}

.btn-outline:hover {
  border-color: var(--clr-text-sec);
  box-shadow: var(--shadow-sm);
}

.btn-icon {
  font-size: 14px;
}

/* ── Stats ────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--clr-surface);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,.03);
  transition: all var(--transition);
  animation: fadeInUp .4s ease-out both;
  position: relative;
  overflow: hidden;
}

.stat-card:nth-child(1) { animation-delay: .05s; }
.stat-card:nth-child(2) { animation-delay: .1s; }
.stat-card:nth-child(3) { animation-delay: .15s; }
.stat-card:nth-child(4) { animation-delay: .2s; }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-card:nth-child(1)::after { background: linear-gradient(90deg, #6c5ce7, #a29bfe); }
.stat-card:nth-child(2)::after { background: linear-gradient(90deg, var(--clr-green), #55efc4); }
.stat-card:nth-child(3)::after { background: linear-gradient(90deg, var(--clr-accent), var(--clr-accent-l)); }
.stat-card:nth-child(4)::after { background: linear-gradient(90deg, #0984e3, #74b9ff); }

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--clr-text-sec);
  font-weight: 600;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.stat-icon-purple  { background: rgba(108,92,231,.1); color: #6c5ce7; }
.stat-icon-green   { background: rgba(0,184,148,.1);  color: var(--clr-green); }
.stat-icon-red     { background: rgba(233,69,96,.1);  color: var(--clr-accent); }
.stat-icon-blue    { background: rgba(9,132,227,.1);  color: #0984e3; }

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--clr-primary);
  line-height: 1.1;
  margin-bottom: 8px;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(0,184,148,.1);
  color: var(--clr-green);
}

.stat-change-icon {
  font-size: 10px;
}

.stat-change-down {
  background: rgba(233,69,96,.1);
  color: var(--clr-accent);
}

/* ── Table ───────────────────────────────── */
.table-container {
  background: var(--clr-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,.03);
  overflow: hidden;
  animation: fadeInUp .4s ease-out .25s both;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--clr-border);
}

.table-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--clr-primary);
}

.table-subtitle {
  font-size: 12px;
  color: var(--clr-text-sec);
  margin-top: 2px;
}

.table-filter {
  display: flex;
  gap: 6px;
}

.table-filter-btn {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--clr-border);
  background: transparent;
  color: var(--clr-text-sec);
  transition: all var(--transition);
  font-family: inherit;
}

.table-filter-btn:hover {
  border-color: var(--clr-text-sec);
  color: var(--clr-text);
}

.table-filter-btn-active {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 12px 24px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--clr-text-sec);
  font-weight: 600;
  background: rgba(0,0,0,.015);
  border-bottom: 1px solid var(--clr-border);
}

.table td {
  padding: 14px 24px;
  font-size: 13px;
  border-bottom: 1px solid #f5f6f8;
  color: var(--clr-text);
}

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover {
  background: rgba(15,52,96,.02);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-cell-primary {
  font-weight: 600;
  color: var(--clr-primary);
}

.table-cell-secondary {
  color: var(--clr-text-sec);
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 600;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-active {
  background: var(--clr-green-bg);
  color: var(--clr-green-fg);
}

.status-active .status-dot {
  background: var(--clr-green-fg);
}

.status-pending {
  background: var(--clr-yellow-bg);
  color: var(--clr-yellow-fg);
}

.status-pending .status-dot {
  background: var(--clr-yellow-fg);
}

.status-inactive {
  background: var(--clr-red-bg);
  color: var(--clr-red-fg);
}

.status-inactive .status-dot {
  background: var(--clr-red-fg);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--clr-border);
  font-size: 12px;
  color: var(--clr-text-sec);
}

.table-pagination {
  display: flex;
  gap: 4px;
}

.table-page-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
  background: transparent;
  color: var(--clr-text-sec);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-family: inherit;
}

.table-page-btn:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

.table-page-btn-active {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: 60px auto 1fr;
    grid-template-areas:
      "header"
      "sidebar"
      "main";
  }
  .sidebar { max-height: 200px; }
  .stats { grid-template-columns: 1fr; }
  .header-search { display: none; }
}
