/* 模态框组件样式 */

/* 模态框遮罩层 */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-overlay);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* 模态框容器 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  pointer-events: none;
}

.modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* 模态框内容 */
.modal-content {
  background-color: var(--bg-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(20px);
  transition: transform var(--transition-base);
  position: relative;
  z-index: var(--z-modal);
  pointer-events: auto;
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

/* 模态框尺寸 */
.modal-sm .modal-content {
  max-width: 400px;
}

.modal-md .modal-content {
  max-width: 500px;
}

.modal-lg .modal-content {
  max-width: 700px;
}

.modal-xl .modal-content {
  max-width: 900px;
}

.modal-full .modal-content {
  max-width: none;
  width: calc(100% - var(--space-8));
  height: calc(100% - var(--space-8));
  max-height: none;
}

/* 模态框头部 */
.modal-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-muted);
}

.modal-close:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* 模态框主体 */
.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-body:first-child {
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
}

.modal-body:last-child {
  border-bottom-left-radius: inherit;
  border-bottom-right-radius: inherit;
}

/* 模态框底部 */
.modal-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--border-primary);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

.modal-footer-start {
  justify-content: flex-start;
}

.modal-footer-center {
  justify-content: center;
}

.modal-footer-between {
  justify-content: space-between;
}

/* 确认对话框样式 */
.modal-confirm .modal-body {
  text-align: center;
  padding: var(--space-8);
}

.modal-confirm-icon {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-4);
}

.modal-confirm-icon.warning {
  color: var(--color-warning);
}

.modal-confirm-icon.error {
  color: var(--color-error);
}

.modal-confirm-icon.success {
  color: var(--color-success);
}

.modal-confirm-icon.info {
  color: var(--color-primary);
}

.modal-confirm-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-3) 0;
}

.modal-confirm-message {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin: 0;
  line-height: var(--leading-relaxed);
}

/* 加载状态 */
.modal-loading {
  position: relative;
}

.modal-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.modal-loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 3px solid var(--border-primary);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: modal-spin 1s linear infinite;
  z-index: 2;
}

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

/* 抽屉式模态框 */
.modal-drawer {
  align-items: flex-end;
  justify-content: center;
}

.modal-drawer .modal-content {
  max-width: none;
  width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  transform: translateY(100%);
}

.modal-drawer.active .modal-content {
  transform: translateY(0);
}

/* 侧边栏式模态框 */
.modal-sidebar {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.modal-sidebar .modal-content {
  max-width: 400px;
  width: 100%;
  max-height: none;
  height: 100%;
  border-radius: 0;
  transform: translateX(100%);
}

.modal-sidebar.active .modal-content {
  transform: translateX(0);
}

.modal-sidebar-left {
  justify-content: flex-start;
}

.modal-sidebar-left .modal-content {
  transform: translateX(-100%);
}

.modal-sidebar-left.active .modal-content {
  transform: translateX(0);
}

/* 全屏模态框 */
.modal-fullscreen {
  padding: 0;
}

.modal-fullscreen .modal-content {
  max-width: none;
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
}

/* 响应式调整 */
@media (max-width: 640px) {
  .modal {
    padding: var(--space-2);
  }

  .modal-content {
    max-height: 95vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--space-4);
  }

  .modal-body {
    max-height: calc(95vh - 120px);
  }

  .modal-lg .modal-content,
  .modal-xl .modal-content {
    max-width: none;
    width: 100%;
  }

  .modal-sidebar .modal-content {
    max-width: none;
    width: 100%;
  }

  .modal-drawer .modal-content {
    max-height: 90vh;
  }
}

/* 无障碍支持 */
.modal[aria-hidden="true"] {
  display: none;
}

.modal-backdrop[aria-hidden="true"] {
  display: none;
}

/* 防止背景滚动 */
body.modal-open {
  overflow: hidden;
}

/* 个人信息弹窗样式 */
.profile-modal {
  max-width: 520px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-body {
  padding: 20px 32px;
  overflow-y: auto;
  flex: 1;
}

/* 用户头像 */
.profile-avatar {
  text-align: center;
  margin-bottom: 24px;
}

.avatar-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: bold;
  text-transform: uppercase;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
  margin: 0 auto;
}

/* 用户信息列表 */
.profile-info {
  margin-bottom: 32px;
}

/* 二维码模态框样式 */
.qr-modal .modal-content {
  max-width: 480px;
  width: 90vw;
}

.qr-modal-body {
  padding: var(--space-6);
  text-align: center;
}

.qr-app-info {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  text-align: left;
}

.app-icon-small {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
}

.app-details {
  flex: 1;
  min-width: 0;
}

.app-details .app-name {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-details .app-bundle-id,
.app-details .app-version {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-code-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--space-6) 0;
  min-height: 280px;
}

.qr-code-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  background: white;
  padding: var(--space-2);
}

.qr-code-error {
  text-align: center;
  color: var(--text-secondary);
}

.qr-code-error .error-icon {
  font-size: 48px;
  margin-bottom: var(--space-2);
}

.qr-instruction {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-4) 0;
}

.install-url-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-4);
}

.install-url {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  word-break: break-all;
  background: var(--bg-tertiary);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
}

.copy-btn {
  width: 100%;
}

/* 移动端二维码模态框适配 */
@media (max-width: 640px) {
  .qr-modal .modal-content {
    width: 95vw;
    margin: var(--space-4);
  }

  .qr-modal-body {
    padding: var(--space-4);
  }

  .qr-app-info {
    flex-direction: column;
    text-align: center;
    gap: var(--space-3);
  }

  .app-icon-small {
    align-self: center;
  }

  .qr-code-container {
    min-height: 240px;
    margin: var(--space-4) 0;
  }

  .qr-code-image {
    max-width: 240px;
    width: 100%;
  }

  .app-details .app-name {
    font-size: var(--text-base);
  }

  .install-url {
    font-size: 11px;
    padding: var(--space-2);
  }
}

@media (max-width: 480px) {
  .qr-modal .modal-content {
    width: 98vw;
    margin: var(--space-2);
  }

  .qr-code-container {
    min-height: 200px;
  }

  .qr-code-image {
    max-width: 200px;
  }
}

/* 上传认证配置样式 */
.auth-config-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  min-height: 500px;
}

.auth-config-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.auth-guide-right {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--border-secondary);
  overflow-y: auto;
}

/* 认证指引样式 */
.auth-guide {
  height: 100%;
}

.guide-header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-secondary);
}

.guide-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-2) 0;
}

.guide-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

.guide-steps {
  margin-bottom: var(--space-6);
}

.guide-step {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
}

.step-content {
  flex: 1;
}

.step-content h5 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-2) 0;
}

.step-content p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.guide-link {
  color: var(--color-primary);
  text-decoration: none;
}

.guide-link:hover {
  text-decoration: underline;
}

/* 上传指引中的列表样式 - 仅在认证指引中使用 */
.auth-guide .guide-list {
  margin: var(--space-2) 0 0 0;
  padding-left: var(--space-6);
  list-style: none;
  position: relative;
}

.auth-guide .guide-list li {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  line-height: 1.5;
  position: relative;
  padding-left: var(--space-1);
}

.auth-guide .guide-list li::before {
  content: "•";
  color: var(--color-primary);
  font-weight: bold;
  position: absolute;
  left: -var(--space-4);
  top: 0;
}

/* 信息列表样式 */
.guide-info-list {
  margin: var(--space-3) 0 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* 个人信息弹窗中的信息项样式 */
.profile-info .info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e2e8f0;
}

.profile-info .info-item:last-child {
  border-bottom: none;
}

.profile-info .info-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.profile-info .info-value {
  font-size: 14px;
  color: #1e293b;
  font-weight: 500;
  text-align: right;
}

/* 上传指引中的信息项样式 */
.guide-info-list .info-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-primary);
}

/* 上传指引中的信息标签和描述样式 */
.guide-info-list .info-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
}

.guide-info-list .info-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* 注意事项列表样式 */
.guide-note-list {
  margin: var(--space-3) 0 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.note-item {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: var(--space-4);
  position: relative;
}

.note-item::before {
  content: "•";
  color: var(--color-info);
  font-weight: bold;
  position: absolute;
  left: 0;
  top: 0;
}



.guide-tips {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.tip-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}

.tip-item:last-child {
  margin-bottom: 0;
}

.tip-icon {
  flex-shrink: 0;
}

.tip-success {
  color: var(--color-success);
}

.tip-info {
  color: var(--color-info);
}

.tip-warning {
  color: var(--color-warning);
}

.tip-error {
  color: var(--color-danger);
}

.guide-note {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border-left: 4px solid var(--color-info);
}

.guide-note h5 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-3) 0;
}

/* 移动端适配 */
@media (max-width: 1024px) {
  .auth-config-layout {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .auth-guide-right {
    order: -1;
    max-height: 400px;
  }
}

@media (max-width: 640px) {
  .auth-config-layout {
    gap: var(--space-4);
  }

  .auth-guide-right {
    padding: var(--space-4);
    max-height: 300px;
  }

  .guide-step {
    gap: var(--space-3);
  }

  .step-number {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-primary);
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 14px;
}

.info-value {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
  text-align: right;
}

/* 角色徽章 */
.role-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.role-super_admin {
  background: #fee2e2;
  color: #dc2626;
}

.role-admin {
  background: #dbeafe;
  color: #2563eb;
}

.role-user {
  background: #f3f4f6;
  color: #6b7280;
}

/* 到期状态 */
.expired {
  color: #dc2626;
}

.active {
  color: #059669;
}

/* 修改密码区域 */
.profile-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-primary);
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px 0;
}

/* 密码表单 */
.password-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-input {
  padding: 10px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s ease;
  background: var(--bg-primary);
  color: var(--text-primary);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* 导航栏用户按钮 */
.navbar-user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  color: inherit;
  text-align: left;
  width: 100%;
}

.navbar-user-profile:hover {
  background-color: var(--bg-muted);
}

.navbar-user-profile:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* 响应式优化 */
@media (max-width: 640px) {
  .profile-modal {
    width: 95%;
    max-width: none;
    max-height: 95vh;
  }

  .profile-body {
    padding: 16px 20px;
  }

  .avatar-circle {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }

  .info-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .info-value {
    text-align: left;
  }

  .profile-section {
    margin-top: 16px;
    padding-top: 16px;
  }

  .section-title {
    font-size: 14px;
    margin: 0 0 10px 0;
  }

  .password-form {
    gap: 8px;
  }

  .form-input {
    padding: 8px 10px;
  }
}

/* 上传完成选择选项样式 */
.upload-complete-options {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-primary);
}

.upload-complete-options .options-text {
  margin-bottom: 15px;
}

.upload-complete-options .options-text p {
  margin: 5px 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.upload-complete-options .options-text p:first-child {
  font-weight: var(--font-semibold);
  color: var(--color-success);
  font-size: var(--text-base);
}

.upload-complete-options .options-buttons {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

.upload-complete-options .btn {
  flex: 1;
  max-width: 200px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

/* 进度条增强样式 */
.progress-container {
  margin: var(--space-4) 0;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  transition: width 0.3s ease;
  border-radius: var(--radius-full);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}

.progress-text {
  color: var(--text-secondary);
}

.progress-percentage {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

/* 记录状态描述样式 */
.record-status-description {
  margin: var(--space-3) 0;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-primary);
}

.record-status-description .status-desc {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* 状态特定的边框颜色 */
.status-uploading .record-status-description {
  border-left-color: var(--color-info);
}

.status-uploaded .record-status-description {
  border-left-color: var(--color-warning);
}

.status-pending .record-status-description {
  border-left-color: var(--color-warning);
}

.status-processing .record-status-description {
  border-left-color: var(--color-primary);
}

.status-success .record-status-description {
  border-left-color: var(--color-success);
}

.status-failed .record-status-description {
  border-left-color: var(--color-error);
}
