/* ==========================================================================
   Zenith Agile & Software House - User Authentication & RBAC Styling
   ========================================================================== */

/* Fullscreen Auth Overlay Gate */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at 50% 20%, rgba(30, 111, 186, 0.15), transparent 70%),
              radial-gradient(circle at 80% 80%, rgba(101, 84, 192, 0.12), transparent 60%),
              #070a0e;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  background: rgba(22, 27, 34, 0.92);
  border: 1px solid rgba(56, 139, 253, 0.25);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 32px rgba(30, 111, 186, 0.15);
  padding: 32px;
  color: var(--text-primary, #f0f6fc);
  animation: authCardIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.auth-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(30, 111, 186, 0.15);
  border: 1px solid rgba(56, 139, 253, 0.3);
  margin-bottom: 14px;
}

.auth-logo-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--brand-primary, #1e6fba);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.auth-logo-text {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #58a6ff;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f0f6fc;
  margin: 0 0 8px 0;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary, #8b949e);
  line-height: 1.45;
  margin: 0;
}

/* Auth Navigation Tabs */
.auth-tabs {
  display: flex;
  background: rgba(13, 17, 23, 0.8);
  border: 1px solid var(--border-subtle, #21262d);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 22px;
}

.auth-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted, #6e7681);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-tab-btn.active {
  background: var(--brand-primary, #1e6fba);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30, 111, 186, 0.4);
}

/* User Role Quick Select List */
.quick-users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.quick-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(28, 33, 40, 0.6);
  border: 1px solid var(--border-default, #30363d);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.quick-user-card:hover {
  background: rgba(56, 139, 253, 0.12);
  border-color: #388bfd;
  transform: translateY(-1px);
}

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

.quick-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  flex-shrink: 0;
}

.quick-user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f0f6fc;
}

.quick-user-role {
  font-size: 0.72rem;
  color: var(--text-muted, #6e7681);
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.role-badge.role-admin {
  background: rgba(248, 81, 73, 0.16);
  color: #ff7b72;
  border: 1px solid rgba(248, 81, 73, 0.35);
}

.role-badge.role-lead {
  background: rgba(16, 185, 129, 0.16);
  color: #3fb950;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.role-badge.role-engineer {
  background: rgba(56, 139, 253, 0.16);
  color: #58a6ff;
  border: 1px solid rgba(56, 139, 253, 0.35);
}

.role-badge.role-qa {
  background: rgba(210, 153, 34, 0.16);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.35);
}

.role-badge.role-client {
  background: rgba(163, 113, 247, 0.16);
  color: #bc8cff;
  border: 1px solid rgba(163, 113, 247, 0.35);
}

/* Direct Login Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary, #8b949e);
}

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

.auth-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input, #0d1117);
  border: 1px solid var(--border-default, #30363d);
  border-radius: 8px;
  color: #f0f6fc;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input:focus {
  border-color: #388bfd;
  box-shadow: 0 0 0 3px rgba(56, 139, 253, 0.2);
}

.auth-hint {
  font-size: 0.72rem;
  color: var(--text-muted, #6e7681);
}

.auth-error-banner {
  padding: 10px 12px;
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: 8px;
  color: #ff7b72;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-submit-btn {
  width: 100%;
  padding: 11px;
  background: linear-gradient(135deg, #1e6fba, #155a99);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(30, 111, 186, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-submit-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Header User Profile Widget & Dropdown */
.header-user-widget {
  position: relative;
  display: inline-block;
}

.header-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 6px;
  background: rgba(22, 27, 34, 0.8);
  border: 1px solid var(--border-default, #30363d);
  border-radius: 999px;
  color: #f0f6fc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-user-btn:hover {
  border-color: #388bfd;
  background: rgba(56, 139, 253, 0.1);
}

.header-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.header-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-surface, #161b22);
  border: 1px solid var(--border-default, #30363d);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  padding: 12px;
  z-index: 1000;
  display: none;
  animation: dropdownIn 0.15s ease forwards;
}

.header-user-dropdown.open {
  display: block;
}

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

.dropdown-user-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle, #21262d);
  margin-bottom: 10px;
}

.dropdown-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.dropdown-user-meta {
  flex: 1;
  min-width: 0;
}

.dropdown-user-fullname {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f0f6fc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user-email {
  font-size: 0.72rem;
  color: var(--text-muted, #6e7681);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.dropdown-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6e7681);
  margin: 10px 4px 6px;
}

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-primary, #f0f6fc);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease;
}

.dropdown-menu-item:hover {
  background: rgba(56, 139, 253, 0.12);
  color: #58a6ff;
}

.dropdown-menu-item.danger:hover {
  background: rgba(248, 81, 73, 0.15);
  color: #ff7b72;
}

/* Access Restricted Page View */
.access-denied-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 480px;
  padding: 32px 16px;
}

.access-denied-card {
  max-width: 500px;
  background: var(--bg-card, #1c2128);
  border: 1px solid rgba(248, 81, 73, 0.35);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}

.access-denied-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(248, 81, 73, 0.15);
  color: #ff7b72;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.access-denied-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f0f6fc;
  margin: 0 0 8px 0;
}

.access-denied-desc {
  font-size: 0.84rem;
  color: var(--text-secondary, #8b949e);
  line-height: 1.5;
  margin: 0 0 20px 0;
}

.access-denied-meta {
  padding: 10px 14px;
  background: rgba(13, 17, 23, 0.6);
  border-radius: 8px;
  font-size: 0.76rem;
  color: var(--text-muted, #6e7681);
  margin-bottom: 24px;
}

/* Nav Lock Badge */
.nav-item.locked {
  opacity: 0.75;
}

.nav-item.locked .nav-badge {
  background: rgba(248, 81, 73, 0.15) !important;
  color: #ff7b72 !important;
  font-size: 0.62rem;
}
