@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #090B10;
  --bg-sidebar: #0F121C;
  --bg-card: #131724;
  --bg-card-elevated: #181D2E;
  --border-color: #21273D;
  --border-subtle: #1C2236;
  
  --primary-purple: #7C3AED;
  --primary-purple-light: #8B5CF6;
  --primary-gradient: linear-gradient(135deg, #6D28D9 0%, #8B5CF6 100%);
  
  --accent-green: #10B981;
  --accent-blue: #3B82F6;
  --accent-orange: #F59E0B;
  --accent-red: #EF4444;
  --accent-cyan: #06B6D4;
  
  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --sidebar-width: 250px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.admin-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon-box {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #FF6B00 0%, #FF2E00 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(255, 46, 0, 0.4);
}

.brand-text h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-text h2 span {
  color: #FF7A00;
}

.brand-text p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-menu {
  padding: 20px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  overflow-y: auto;
}

.menu-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.menu-item a .item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-item a .item-left i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.menu-item a .item-arrow {
  font-size: 12px;
  opacity: 0.5;
}

.menu-item.active a {
  background: var(--primary-gradient);
  color: #FFFFFF;
  box-shadow: 0 4px 18px rgba(109, 40, 217, 0.45);
}

.menu-item:not(.active) a:hover {
  background-color: var(--bg-card);
  color: #FFFFFF;
}

.sidebar-footer {
  padding: 16px 14px 24px;
  border-top: 1px solid var(--border-subtle);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: #F87171;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP NAVBAR */
.top-navbar {
  height: 70px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  display: none;
}

.app-selector-dropdown {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.app-selector-dropdown .app-thumb {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: cover;
}

.app-selector-dropdown span {
  font-size: 13.5px;
  font-weight: 700;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.badge-pill.active-users-pill span.count {
  color: var(--accent-green);
  font-weight: 800;
}

.badge-pill .status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
}

.admin-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 12px 6px 6px;
  border-radius: 30px;
}

.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #FFF;
}

.admin-meta {
  display: flex;
  flex-direction: column;
}

.admin-meta .name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 14px;
}

.admin-meta .role {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* PAGE CONTENT WRAPPER */
.content-wrapper {
  padding: 28px;
  flex: 1;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.page-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* METRIC STATS 4-GRID */
.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: 14px;
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
}

.stat-card.card-purple {
  background: linear-gradient(135deg, #581C87 0%, #7C3AED 100%);
  box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.4);
}

.stat-card.card-green {
  background: linear-gradient(135deg, #064E3B 0%, #059669 100%);
  box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.4);
}

.stat-card.card-blue {
  background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%);
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
}

.stat-card.card-orange {
  background: linear-gradient(135deg, #78350F 0%, #D97706 100%);
  box-shadow: 0 10px 25px -5px rgba(217, 119, 6, 0.4);
}

.stat-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-info .label {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 4px;
}

.stat-info .value {
  font-size: 26px;
  font-weight: 900;
  line-height: 28px;
  letter-spacing: -0.5px;
}

.stat-info .sub-time {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 4px;
}

/* MAIN DASHBOARD 2-COLUMN GRID (CHART & DETAILS) */
.dashboard-row-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.card-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 22px;
}

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

.card-panel-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.date-filter-select {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
}

/* TODAY DETAILS LIST */
.details-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-item .item-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.detail-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.detail-item .item-value {
  font-size: 15px;
  font-weight: 800;
  color: #FFF;
}

/* APP INFO CARD */
.app-info-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 0;
}

.app-big-icon {
  width: 90px;
  height: 90px;
  border-radius: 20px;
  object-fit: cover;
  border: 2px solid #FF3B30;
  box-shadow: 0 8px 24px rgba(255, 59, 48, 0.35);
  margin-bottom: 14px;
}

.app-name-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.live-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.app-meta-row {
  display: flex;
  justify-content: space-around;
  width: 100%;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.app-meta-col span.lbl {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.app-meta-col span.val {
  font-size: 13px;
  font-weight: 700;
}

/* BOTTOM 2-COLUMN GRID (RECENT DOWNLOADS & QUICK LINKS) */
.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* QUICK LINKS 2x2 GRID */
.quick-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quick-link-btn {
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  color: #FFF;
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.quick-link-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.1);
}

.quick-link-btn.btn-ql-purple {
  background: linear-gradient(135deg, #4C1D95 0%, #6D28D9 100%);
}

.quick-link-btn.btn-ql-green {
  background: linear-gradient(135deg, #065F46 0%, #059669 100%);
}

.quick-link-btn.btn-ql-blue {
  background: linear-gradient(135deg, #1E40AF 0%, #2563EB 100%);
}

.quick-link-btn.btn-ql-orange {
  background: linear-gradient(135deg, #92400E 0%, #D97706 100%);
}

.quick-link-btn i {
  font-size: 24px;
}

/* TABLES */
.custom-table-responsive {
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.custom-table th {
  text-align: left;
  padding: 12px 16px;
  background-color: var(--bg-card-elevated);
  color: var(--text-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: #FFFFFF;
}

.custom-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

/* FORM CONTROLS */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  background-color: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 10px;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #FFFFFF;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.4);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34D399;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 20px;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 20px;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-row-grid,
  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .menu-toggle {
    display: block;
  }
  .stats-grid-4 {
    grid-template-columns: 1fr;
  }
}
