/* ==========================================================================
   SUPER ADMIN PORTAL STYLESHEET (Dark Default Theme)
   ========================================================================== */

:root {
  /* Dark Mode Variables (Default) */
  --bg-main: #0b0f19;
  --bg-card: #111827;
  --bg-sidebar: #0b0f19;
  --border-color: #1f2937;
  --text-main: #f9fafb;
  --text-secondary: #9ca3af;
  --primary-color: #f59e0b; /* Gold Accent for Super Admin */
  --primary-hover: #d97706;
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.light-mode {
  --bg-main: #f3f4f6;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --border-color: #e5e7eb;
  --text-main: #111827;
  --text-secondary: #6b7280;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* AUTHENTICATION OVERLAY */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(12px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-overlay.active {
  display: flex;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 36px;
  box-shadow: var(--card-shadow);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.superadmin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.login-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 20px;
}

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

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  color: var(--text-secondary);
}

.input-with-icon input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: 8px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  outline: none;
  transition: all 0.2s ease;
}

.input-with-icon input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--primary-color);
  color: #111827;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.login-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* MAIN APP LAYOUT */
.app-container {
  display: flex;
  min-height: 100vh;
}

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

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

.logo {
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.version-tag {
  font-size: 0.72rem;
  background: rgba(245, 158, 11, 0.15);
  color: var(--primary-color);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item:hover, .nav-item.active {
  background: rgba(245, 158, 11, 0.12);
  color: var(--primary-color);
}

.badge-count {
  margin-left: auto;
  background: var(--accent-red);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  font-size: 1.4rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-details span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  font-size: 0.68rem;
  color: var(--primary-color);
  font-weight: 800;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.btn-logout:hover {
  color: var(--accent-red);
}

/* MAIN CONTENT */
.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 24px 32px;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.top-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
}

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

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

.context-selector select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* VIEWS */
.content-view {
  display: none;
}

.content-view.active {
  display: block;
}

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

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--card-shadow);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.bg-purple { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.bg-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.bg-gold { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.bg-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }

.metric-info .metric-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.metric-info h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 2px;
}

/* TABLES */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}

th {
  background: var(--bg-main);
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-success { background: #10b981; }
.toast-danger { background: #ef4444; }
.toast-info { background: #3b82f6; }
