/* ============================================================================
   Authentication & User Profile Styles
   Additional styles for login page and user profile in sidebar
   ========================================================================= */

/* ========================================
   User Profile in Sidebar
   ======================================== */

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin: 16px 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s;
}

.user-profile:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.12);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-cyan), var(--color-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

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

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.logout-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

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

/* Sidebar closed state - hide user info text */
.sidebar.closed .user-name,
.sidebar.closed .logout-btn {
  display: none;
}

.sidebar.closed .user-profile {
  justify-content: center;
  padding: 12px;
}

/* ========================================
   Leaderboard Modal Enhancements
   ======================================== */

.dm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal, 40);
  opacity: 0;
  transition: opacity 0.3s;
}

.dm-modal-overlay:not([hidden]) {
  opacity: 1;
}

.dm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--glass-dark, rgba(0, 0, 0, 0.85));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  z-index: calc(var(--z-modal, 40) + 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.dm-modal:not([hidden]) {
  opacity: 1;
}

.dm-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.dm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dm-modal-title {
  font-family: 'Do Hyeon', sans-serif;
  font-size: 24px;
  color: white;
}

.dm-modal-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dm-modal-btn {
  padding: 8px 16px;
  background: var(--color-cyan);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.dm-modal-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 171, 194, 0.3);
}

.dm-modal-close {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dm-modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.dm-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Leaderboard Specific Styles */
.dm-lb-shell {
  color: white;
}

.dm-lb-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.dm-lb-title {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
}

.dm-lb-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.dm-lb-refresh {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.dm-lb-refresh:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.dm-lb-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dm-lb-table {
  width: 100%;
  border-collapse: collapse;
}

.dm-lb-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.dm-lb-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dm-lb-table td {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  color: white;
}

.dm-lb-table tbody tr {
  transition: background 0.2s;
}

.dm-lb-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Skeleton Loading */
.dm-lb-row-skel td {
  padding: 16px;
}

.dm-skel {
  height: 12px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

.dm-skel.w-30 {
  width: 30px;
}

.dm-skel.w-40 {
  width: 40px;
}

.dm-skel.w-70 {
  width: 70px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* State Messages */
.dm-lb-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.dm-lb-state-title {
  font-size: 18px;
  font-weight: 600;
  color: white;
  margin-bottom: 8px;
}

.dm-lb-state-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 24px;
}

.dm-lb-action {
  padding: 10px 20px;
  background: var(--color-cyan);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.dm-lb-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 171, 194, 0.4);
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
  .dm-modal {
    width: 95%;
    max-height: 90vh;
  }

  .dm-modal-head {
    padding: 16px;
  }

  .dm-modal-body {
    padding: 16px;
  }

  .dm-modal-title {
    font-size: 20px;
  }

  .dm-lb-top {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }

  .dm-lb-table th,
  .dm-lb-table td {
    padding: 12px 8px;
    font-size: 13px;
  }

  .user-profile {
    margin: 12px 8px;
    padding: 12px;
  }
}

/* ========================================
   Accessibility Improvements
   ======================================== */

.dm-modal-btn:focus,
.dm-modal-close:focus,
.dm-lb-refresh:focus,
.dm-lb-action:focus,
.logout-btn:focus {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .dm-modal,
  .dm-modal-overlay,
  .user-profile,
  .dm-modal-btn,
  .dm-lb-refresh,
  .dm-lb-action,
  .logout-btn {
    transition: none;
  }

  .dm-skel {
    animation: none;
  }
}
