/* ==========================================================================
   CURIOMAS RESEARCH & INNOVATION INSTITUTE (CRII)
   Portal & Admin Management Stylesheet
   Modern, Light/Dark Adaptive, Autz.org Integrated
   ========================================================================== */

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

/* Sidebar */
.portal-sidebar {
  width: 280px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  padding: 1.5rem 1.25rem;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.portal-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.portal-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.18s ease;
}

.portal-nav-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.portal-nav-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

[data-theme="dark"] .portal-nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.portal-nav-btn.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-primary);
  border-color: rgba(37, 99, 235, 0.2);
  font-weight: 600;
}

.portal-nav-badge {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: rgba(37, 99, 235, 0.15);
  color: var(--accent-primary);
  font-weight: 700;
}

.portal-user-card {
  padding: 0.85rem 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-user-meta {
  display: flex;
  flex-direction: column;
}

.portal-user-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.portal-user-email {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.portal-user-role {
  font-size: 0.7rem;
  color: var(--accent-primary);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

/* Main Area */
.portal-main {
  flex-grow: 1;
  margin-left: 280px;
  padding: 2.5rem 3rem;
  background-color: var(--bg-primary);
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.portal-title-block h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.portal-title-block p {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.metric-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-icon-svg {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

.metric-val {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.metric-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Data Tables */
.data-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.table-toolbar {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

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

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

.admin-table th {
  background: var(--bg-primary);
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}

[data-theme="dark"] .admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Chips */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-chip.pending {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-chip.accepted, .status-chip.published {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-chip.rejected, .status-chip.draft {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-crimson);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   AUTZ.ORG LOGIN SCREEN
   ========================================================================== */
.auth-wrapper {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-box {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 2.75rem 2.5rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-crest {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--grad-primary);
  display: grid;
  place-items: center;
  color: #fff;
  margin: 0 auto 1.5rem;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.auth-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 2rem;
}

.autz-login-btn {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #334155;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
  font-family: inherit;
}

[data-theme="dark"] .autz-login-btn {
  background: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
}

.autz-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  filter: brightness(1.1);
}

.autz-logo-badge {
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.security-badge svg {
  width: 14px;
  height: 14px;
  color: var(--accent-emerald);
}

/* Split-Pane Markdown Editor */
.editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.editor-preview-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.5rem;
  height: 380px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-primary);
}

@media (max-width: 900px) {
  .portal-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .portal-layout {
    flex-direction: column;
  }
  .portal-main {
    margin-left: 0;
    padding: 1.5rem;
  }
  .editor-split {
    grid-template-columns: 1fr;
  }
}
