/* ==========================================================================
   Acaders Workshop & Assessment Portal Stylesheet
   Theme: Official Acaders Brand Design (Crisp Light Mode, Red #ea242c)
   Matching: acaders.com
   ========================================================================== */

:root {
  --brand-primary: #ea242c;
  --brand-primary-hover: #c91c23;
  --brand-primary-active: #b3161c;
  --brand-light: #fff1f2;
  --brand-glow: rgba(234, 36, 44, 0.20);
  --brand-glow-subtle: rgba(234, 36, 44, 0.08);

  /* Acaders Official Light Backgrounds */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;

  --border-subtle: #e2e8f0;
  --border-focus: #ea242c;
  --border-card: #e2e8f0;

  /* Typography Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --info: #0284c7;
  --info-bg: #f0f9ff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 10px 25px -5px rgba(234, 36, 44, 0.25);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Acaders Top Utility Bar
   ========================================================================== */

.acaders-topbar {
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  padding: 8px 32px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
  font-size: 0.82rem;
  color: #475569;
}

.acaders-topbar a, .acaders-topbar span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  text-decoration: none;
  font-weight: 500;
}

.acaders-topbar a:hover {
  color: var(--brand-primary);
}

.acaders-topbar svg {
  color: var(--brand-primary);
}

/* ==========================================================================
   Acaders Main Navigation Bar
   ========================================================================== */

.acaders-navbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.03);
}

.acaders-nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.acaders-nav-link {
  color: #0f172a;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color var(--transition-fast);
}

.acaders-nav-link:hover {
  color: var(--brand-primary);
}

.btn-enter-lab {
  background: #fdf2f2;
  color: var(--brand-primary) !important;
  border: 1px solid rgba(234, 36, 44, 0.2);
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-enter-lab:hover {
  background: var(--brand-primary);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(234, 36, 44, 0.3);
}

/* ==========================================================================
   Login & Auth Viewport
   ========================================================================== */

.login-viewport {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.login-viewport::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-primary);
}

.login-container {
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 10;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 40px 36px;
  position: relative;
}

.login-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-primary);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.brand-header .brand-logo-img {
  max-width: 210px;
  height: auto;
  display: block;
  margin: 0 auto 16px auto;
}

.portal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-light);
  color: var(--brand-primary);
  border: 1px solid rgba(234, 36, 44, 0.25);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}

.portal-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--brand-primary);
  box-shadow: 0 0 6px var(--brand-primary);
}

.portal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.portal-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Form Controls
   ========================================================================== */

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

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.form-control {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 44px;
  background-color: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(234, 36, 44, 0.12);
}

.input-wrapper:focus-within .input-icon {
  color: var(--brand-primary);
}

.form-control::placeholder {
  color: #94a3b8;
}

.password-toggle {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: var(--text-primary);
}

/* Checkbox */
.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox-mark {
  width: 18px;
  height: 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.custom-checkbox input:checked ~ .checkbox-mark {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.checkbox-mark svg {
  display: none;
  width: 12px;
  height: 12px;
  color: white;
}

.custom-checkbox input:checked ~ .checkbox-mark svg {
  display: block;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-primary {
  width: 100%;
  height: 48px;
  background: var(--brand-primary);
  color: #ffffff !important;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(234, 36, 44, 0.3);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--brand-primary-hover);
  box-shadow: 0 6px 20px rgba(234, 36, 44, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  background: var(--brand-primary-active);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  width: 100%;
  height: 48px;
  background: #ffffff;
  color: #334155 !important;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.4;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-danger {
  background-color: var(--danger-bg);
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background-color: var(--success-bg);
  border: 1px solid #a7f3d0;
  color: #047857;
}

.alert-warning {
  background-color: var(--warning-bg);
  border: 1px solid #fde68a;
  color: #b45309;
}

.alert-info {
  background-color: var(--info-bg);
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.alert .alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert .alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: currentColor;
  opacity: 0.7;
  cursor: pointer;
  padding: 2px;
}

.alert .alert-close:hover {
  opacity: 1;
}

/* ==========================================================================
   Footer & Meta
   ========================================================================== */

.login-footer {
  text-align: center;
  margin-top: 24px;
  color: #64748b;
  font-size: 0.82rem;
}

.login-footer a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Admin Dashboard Core Layout (Light Acaders Corporate Theme)
   ========================================================================== */

.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-page);
}

.admin-sidebar {
  width: 260px;
  background-color: #ffffff;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-header .brand-logo-img {
  max-height: 40px;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 1px;
  padding: 12px 14px 6px 14px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #475569;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  margin-bottom: 4px;
}

.nav-link:hover {
  background-color: var(--brand-light);
  color: var(--brand-primary);
}

.nav-link.active {
  background-color: var(--brand-light);
  color: var(--brand-primary);
  font-weight: 700;
  border-left: 3px solid var(--brand-primary);
}

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

.admin-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-page);
}

.admin-topbar {
  height: 72px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.admin-content {
  padding: 32px;
  flex: 1;
}

/* User pill in topbar */
.user-menu-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  padding: 6px 16px 6px 8px;
  border-radius: var(--radius-full);
}

.user-avatar-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

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

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.user-role {
  font-size: 0.72rem;
  color: var(--brand-primary);
  font-weight: 700;
  text-transform: uppercase;
}

/* Dashboard Cards & Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  background: var(--brand-light);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-title {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* Tables */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.data-table th {
  background-color: #f8fafc;
  padding: 14px 20px;
  color: #475569;
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  color: #1e293b;
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

/* Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-badge.success {
  background-color: var(--success-bg);
  color: #047857;
  border: 1px solid #a7f3d0;
}

.status-badge.danger {
  background-color: var(--danger-bg);
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.status-badge.warning {
  background-color: var(--warning-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
}
