/* ============================================
   POPTEJ.IT ADMIN - Based on Enlite Prime
   ============================================ */

:root {
  --ep-primary: #5C6BC0;
  --ep-primary-dark: #3F51B5;
  --ep-primary-light: #7986CB;
  --ep-primary-lighter: rgba(92, 107, 192, 0.08);
  --ep-secondary: #f50057;
  --ep-accent: #4CAF50;
  --ep-success: #4caf50;
  --ep-warning: #ff9800;
  --ep-danger: #f44336;
  --ep-info: #00bcd4;
  --ep-sidebar-bg: #ffffff;
  --ep-sidebar-text: #616161;
  --ep-sidebar-active: #5C6BC0;
  --ep-sidebar-hover-bg: rgba(92, 107, 192, 0.06);
  --ep-sidebar-width: 260px;
  --ep-header-bg: #ffffff;
  --ep-header-text: #424242;
  --ep-header-height: 56px;
  --ep-content-bg: #fafafa;
  --ep-card-bg: #ffffff;
  --ep-card-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --ep-text-primary: #212121;
  --ep-text-secondary: #757575;
  --ep-divider: #eeeeee;
  --ep-font-family: 'Open Sans', 'Roboto', sans-serif;
  --ep-radius: 12px;
  --ep-radius-sm: 6px;
  --ep-radius-lg: 16px;
}

[data-theme="dark"] {
  --ep-primary: #7986CB;
  --ep-primary-dark: #5C6BC0;
  --ep-sidebar-bg: #1e1e2d;
  --ep-sidebar-text: #8899a6;
  --ep-sidebar-active: #9FA8DA;
  --ep-sidebar-hover-bg: rgba(255,255,255,0.04);
  --ep-header-bg: #1a1a2e;
  --ep-header-text: #e0e0e0;
  --ep-content-bg: #121212;
  --ep-card-bg: #1e1e2d;
  --ep-card-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --ep-text-primary: #e0e0e0;
  --ep-text-secondary: #9e9e9e;
  --ep-divider: #2d2d3f;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--ep-font-family);
  font-size: 14px;
  color: var(--ep-text-primary);
  background: var(--ep-content-bg);
  min-height: 100vh;
}

a { color: var(--ep-primary); text-decoration: none; }
a:hover { color: var(--ep-primary-dark); }

/* ---- Sidebar ---- */
.admin-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--ep-sidebar-width);
  height: 100vh;
  background: var(--ep-sidebar-bg);
  border-right: 1px solid var(--ep-divider);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

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

.admin-sidebar .sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--ep-primary), var(--ep-primary-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}

.admin-sidebar .sidebar-brand .brand-text {
  font-size: 16px; font-weight: 600;
  color: var(--ep-text-primary);
}

.admin-sidebar .sidebar-brand .brand-text small {
  display: block; font-size: 11px; font-weight: 400;
  color: var(--ep-text-secondary);
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.sidebar-nav .nav-section {
  padding: 8px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ep-text-secondary);
  margin-top: 8px;
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--ep-sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-item:hover {
  background: var(--ep-sidebar-hover-bg);
  color: var(--ep-sidebar-active);
}

.sidebar-nav .nav-item.active {
  background: var(--ep-primary-lighter);
  color: var(--ep-sidebar-active);
  border-left-color: var(--ep-sidebar-active);
  font-weight: 600;
}

.sidebar-nav .nav-item .material-icons {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.sidebar-nav .nav-item .nav-badge {
  margin-left: auto;
  background: var(--ep-secondary);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--ep-divider);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user .user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--ep-primary), var(--ep-primary-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 14px;
}

.sidebar-user .user-info { flex: 1; }
.sidebar-user .user-info .user-name { font-size: 13px; font-weight: 600; color: var(--ep-text-primary); }
.sidebar-user .user-info .user-role { font-size: 11px; color: var(--ep-text-secondary); }

/* ---- Header ---- */
.admin-header {
  position: fixed;
  top: 0;
  left: var(--ep-sidebar-width);
  right: 0;
  height: var(--ep-header-height);
  background: var(--ep-header-bg);
  border-bottom: 1px solid var(--ep-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1030;
}

.admin-header .header-left { display: flex; align-items: center; gap: 12px; }
.admin-header .header-right { display: flex; align-items: center; gap: 8px; }

.admin-header .menu-toggle {
  display: none;
  background: none; border: none;
  color: var(--ep-header-text);
  cursor: pointer; padding: 4px;
}

.admin-header .page-title {
  font-size: 16px; font-weight: 600;
  color: var(--ep-text-primary);
}

.admin-header .header-btn {
  background: none; border: none;
  color: var(--ep-text-secondary);
  cursor: pointer; padding: 6px;
  border-radius: 50%;
  transition: background 0.2s;
  position: relative;
}

.admin-header .header-btn:hover {
  background: var(--ep-primary-lighter);
  color: var(--ep-primary);
}

/* ---- Main Content ---- */
.admin-content {
  margin-left: var(--ep-sidebar-width);
  margin-top: var(--ep-header-height);
  padding: 24px;
  min-height: calc(100vh - var(--ep-header-height));
}

/* ---- KPI Cards ---- */
.kpi-card {
  background: var(--ep-card-bg);
  border-radius: var(--ep-radius);
  box-shadow: var(--ep-card-shadow);
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.kpi-card .kpi-value {
  font-size: 32px; font-weight: 700;
  color: var(--ep-text-primary);
  line-height: 1.1;
}

.kpi-card .kpi-label {
  font-size: 12px; color: var(--ep-text-secondary);
  margin-top: 4px; text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-card .kpi-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.kpi-card .kpi-icon .material-icons {
  font-size: 28px; color: #fff;
}

/* ---- Data Card ---- */
.data-card {
  background: var(--ep-card-bg);
  border-radius: var(--ep-radius);
  box-shadow: var(--ep-card-shadow);
  margin-bottom: 24px;
}

.data-card .card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ep-divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.data-card .card-header h6 {
  margin: 0; font-size: 14px; font-weight: 600;
  color: var(--ep-text-primary);
}

.data-card .card-body {
  padding: 16px 20px;
}

/* ---- Tables ---- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--ep-text-secondary);
  padding: 10px 12px;
  border-bottom: 2px solid var(--ep-divider);
  text-align: left;
}

.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ep-divider);
  font-size: 13px;
  color: var(--ep-text-primary);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: var(--ep-primary-lighter);
}

.admin-table .text-muted {
  color: var(--ep-text-secondary) !important;
}

/* ---- Status dot ---- */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.online { background: var(--ep-success); }
.status-dot.offline { background: var(--ep-danger); }

/* ---- Filter bar ---- */
.filter-bar {
  background: var(--ep-card-bg);
  border-radius: var(--ep-radius);
  box-shadow: var(--ep-card-shadow);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-bar .form-control,
.filter-bar .form-select {
  max-width: 200px;
  font-size: 13px;
}

/* ---- Pagination ---- */
.admin-pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
}

.admin-pagination a,
.admin-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px; height: 36px;
  border-radius: var(--ep-radius-sm);
  font-size: 13px; font-weight: 500;
  padding: 0 8px;
  transition: all 0.2s;
}

.admin-pagination a {
  color: var(--ep-text-primary);
  background: var(--ep-card-bg);
  border: 1px solid var(--ep-divider);
}

.admin-pagination a:hover {
  background: var(--ep-primary-lighter);
  border-color: var(--ep-primary);
  color: var(--ep-primary);
}

.admin-pagination span.active {
  background: var(--ep-primary);
  color: #fff;
  border: 1px solid var(--ep-primary);
}

/* ---- Auth page ---- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3F51B5 0%, #1a237e 100%);
  padding: 24px;
}

.auth-card {
  background: var(--ep-card-bg);
  border-radius: var(--ep-radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 440px;
  padding: 40px;
}

.auth-card .auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card .auth-logo .logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--ep-primary), var(--ep-primary-dark));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px; font-weight: 700;
  margin: 0 auto 16px;
}

.auth-card .form-floating { margin-bottom: 16px; }

/* ---- Invoice print ---- */
.invoice-print-area {
  background: #fff;
  padding: 40px;
  color: #212121;
}

@media print {
  .admin-sidebar, .admin-header, .no-print { display: none !important; }
  .admin-content { margin: 0 !important; padding: 0 !important; }
  .invoice-print-area { box-shadow: none; }
}

/* ---- Responsive ---- */
@media (max-width: 991px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-header {
    left: 0;
  }
  .admin-header .menu-toggle {
    display: block;
  }
  .admin-content {
    margin-left: 0;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
  }
  .sidebar-overlay.active {
    display: block;
  }
}
