/* ===== ADMIN PANEL CSS ===== */

/* Layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}
.sidebar-logo-img {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--accent), var(--accent-blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-logo-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}
.sidebar-logo-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.sidebar-logo-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  cursor: pointer;
  user-select: none;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
  flex-shrink: 0;
}
.user-info { flex: 1; overflow: hidden; }
.user-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  font-size: 11px; color: var(--text-muted); text-transform: capitalize;
}
.logout-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: 6px; transition: var(--transition);
  display: flex; align-items: center;
}
.logout-btn:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

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

/* ===== TOP BAR ===== */
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 99;
}
.topbar-left h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.topbar-left .breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
}
.topbar-icon-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.notif-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-secondary);
}

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

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  cursor: default;
}
.stat-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.green  { background: rgba(16,185,129,0.15); }
.stat-icon.blue   { background: rgba(59,130,246,0.15); }
.stat-icon.purple { background: rgba(139,92,246,0.15); }
.stat-icon.orange { background: rgba(245,158,11,0.15); }
.stat-icon.red    { background: rgba(239,68,68,0.15); }
.stat-info {}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filters-bar .search-bar { flex: 1; min-width: 200px; }
.filter-select {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.filter-select:focus {
  border-color: var(--accent);
}

/* ===== ACTIONS IN TABLE ===== */
.action-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
}
.action-btn:hover        { background: var(--bg-card-hover); color: var(--text-primary); }
.action-btn.edit:hover   { border-color: var(--accent-blue); color: var(--accent-blue); }
.action-btn.delete:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.1); }
.action-btn.view:hover   { border-color: var(--accent); color: var(--accent); }

/* ===== STATUS SELECT ===== */
.status-select {
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 150px;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(16,185,129,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(59,130,246,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(139,92,246,0.05) 0%, transparent 50%);
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-circle {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900; color: white;
  margin: 0 auto 12px;
  overflow: hidden;
}
.login-logo-circle img {
  width: 100%; height: 100%; object-fit: cover;
}
.login-company-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}
.login-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

/* ===== ROLE BADGE ===== */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.role-superadmin { background: rgba(139,92,246,0.15); color: #a78bfa; }
.role-admin      { background: rgba(59,130,246,0.15); color: #60a5fa; }
.role-manager    { background: rgba(16,185,129,0.15); color: #34d399; }

/* ===== SETTINGS PAGE ===== */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.settings-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-preview-area {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}
.logo-preview-box {
  width: 80px; height: 80px;
  border-radius: 16px;
  background: var(--bg-input);
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.logo-preview-box:hover { border-color: var(--accent); }
.logo-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.logo-preview-box .placeholder-icon { font-size: 28px; opacity: 0.3; }
.color-swatch {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== DETAIL DRAWER ===== */
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.detail-row:last-child { border: none; }
.detail-label { font-size: 13px; color: var(--text-muted); }
.detail-value { font-size: 13px; color: var(--text-primary); font-weight: 500; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
