/* 通用样式 */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, #fdf2f8 0%, #ffffff 100%);
}

.form-group {
  margin-bottom: 1rem;
}

/* 应用容器布局 */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
  width: 200px;
  background: linear-gradient(180deg, #fdf2f8 0%, #ffffff 100%);
  color: #4a5568;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 1000;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-brand {
  color: #2d3748;
  margin: 0;
  font-weight: 600;
  font-size: 1.1rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-nav .nav {
  padding: 0 0.5rem;
  text-align: left;
}

.sidebar-nav .nav-item {
  text-align: left;
}

.sidebar-nav .nav-link {
  color: #4a5568;
  border-radius: 0.5rem;
  margin-bottom: 0.25rem;
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
  border: none;
  text-align: left;
  display: flex;
  align-items: center;
}

.sidebar-nav .nav-link:hover {
  color: #667eea;
  background-color: rgba(102, 126, 234, 0.1);
  transform: translateX(4px);
}

.sidebar-nav .nav-link.active {
  color: #667eea;
  background-color: rgba(102, 126, 234, 0.15);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-footer .btn-outline-light {
  border-color: #dc3545;
  color: #dc3545;
  background-color: transparent;
}

.sidebar-footer .btn-outline-light:hover {
  background-color: #dc3545;
  border-color: #dc3545;
  color: white;
}

/* 用户下拉菜单样式 */
.user-dropdown {
  width: 100%;
}

.user-avatar-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(168, 85, 247, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s ease;
  color: #4a5568;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.user-avatar-btn:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.user-avatar-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.user-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(139, 92, 246, 0.3);
}

.notification-indicator {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: 2px solid #ffffff;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

.user-basic-info .username {
  font-weight: 600;
  font-size: 0.9rem;
  color: #2d3748;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-basic-info .user-status {
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 500;
}

.dropdown-arrow {
  color: #6b7280;
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.user-avatar-btn[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  width: 280px;
  margin-top: 0.5rem;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  padding: 0;
  overflow: hidden;
  animation: dropdownSlide 0.3s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-info-header {
  padding: 1.5rem;
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar-large img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

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

.username-large {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-credits {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  width: fit-content;
}

.user-dropdown-menu .dropdown-item {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  border: none;
  color: #374151;
}

.user-dropdown-menu .dropdown-item:hover {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
  color: #8b5cf6;
  transform: translateX(4px);
}

.user-dropdown-menu .dropdown-item.text-danger {
  color: #dc2626 !important;
}

.user-dropdown-menu .dropdown-item.text-danger:hover {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
  color: #dc2626 !important;
}

.user-dropdown-menu .dropdown-divider {
  margin: 0.5rem 0;
  border-color: rgba(0, 0, 0, 0.1);
}

.user-dropdown-menu .position-relative .badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
}

/* 主内容区样式 */
.main-content {
  flex: 1;
  margin-left: 200px;
  overflow-y: auto;
  background: linear-gradient(180deg, #fdf2f8 0%, #ffffff 100%);
  height: 100vh;
}

.main-content .container-fluid {
  padding: 2rem;
}

/* 页面头部样式 */
.header {
  margin-bottom: 2rem;
}

/* 结果显示样式 */
.result-item {
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.success {
  background-color: rgba(25, 135, 84, 0.1);
  border-left: 4px solid #198754;
}

.error {
  background-color: rgba(220, 53, 69, 0.1);
  border-left: 4px solid #dc3545;
}

.running {
  background-color: rgba(13, 110, 253, 0.1);
  border-left: 4px solid #0d6efd;
}

#resultContainer {
  max-height: 400px;
  overflow-y: auto;
}

/* 表格预览样式 */
#previewModal .modal-content {
  height: 100%;
}

#previewModal .modal-body {
  height: calc(100% - 120px);
  overflow-y: auto;
  padding: 1rem;
}

.table-responsive {
  height: 100%;
}

#previewTable {
  border-collapse: collapse;
  width: 100%;
  table-layout: auto;
}

#previewTable th {
  position: sticky;
  top: 0;
  background-color: #f8f9fa;
  z-index: 10;
  font-weight: bold;
  border-bottom: 2px solid #dee2e6;
}

#previewTable th, #previewTable td {
  padding: 0.75rem;
  border: 1px solid #dee2e6;
  text-overflow: ellipsis;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
  min-width: 150px;
  max-width: 500px;
  vertical-align: top;
}

/* 分页控件样式 */
#pageInfo {
  min-width: 120px;
  text-align: center;
  background-color: #f8f9fa;
  cursor: default;
}

#prevPageBtn, #nextPageBtn {
  min-width: 90px;
}

#prevPageBtn:disabled, #nextPageBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 搜索高亮样式 */
.highlight {
  background-color: #fff3cd;
  padding: 2px;
  border-radius: 2px;
}

/* 表格行鼠标悬停效果 */
#previewTable tbody tr:hover {
  background-color: rgba(0, 123, 255, 0.1);
}

/* 详细结果显示样式 */
.toggle-details {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
}

pre {
  max-height: 300px;
  overflow-y: auto;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  padding: 0.5rem;
  font-size: 0.85rem;
}

/* 认证页面特殊布局 */
body.auth-page {
  background: linear-gradient(180deg, #fdf2f8 0%, #ffffff 100%);
  overflow: hidden;
  height: 100vh;
}

body.auth-page .app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

body.auth-page .sidebar {
  display: none;
}

body.auth-page .main-content {
  margin-left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: hidden;
}

body.auth-page .main-content .container-fluid {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 2rem;
  width: 100%;
}

/* 登录和注册页面样式 */
.login-container, .register-container {
  width: 32vw;
  max-width: 650px;
  min-width: 400px;
  margin: 0;
}

.form-signin, .form-register {
  width: 100%;
  height: auto;
  padding: 3rem 2.5rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 40px;
  box-shadow: 0 2rem 4rem rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
}

.auth-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.auth-header h1 {
  color: #2d3748;
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.form-floating {
  position: relative;
  margin-bottom: 1.5rem;
}

.form-floating .form-control {
  height: 3.5rem;
  padding: 1rem 1rem 1rem 3rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
}

.form-floating .form-control:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  outline: none;
}

.form-floating label {
  padding: 1rem 1rem 1rem 3rem;
  color: #a0aec0;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  z-index: 5;
  font-size: 1.1rem;
}

.form-floating .password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  cursor: pointer;
  z-index: 5;
  font-size: 1.1rem;
  transition: color 0.2s ease;
}

.form-floating .password-toggle:hover {
  color: #667eea;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check-input {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 0.25rem;
  border: 1px solid #e2e8f0;
}

.form-check-input:checked {
  background-color: #667eea;
  border-color: #667eea;
}

.form-check-label {
  color: #4a5568;
  margin: 0;
}

.forgot-password {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

.forgot-password:hover {
  color: #764ba2;
  text-decoration: underline;
}

.btn-auth {
  width: 100%;
  height: 3.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 0.75rem;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.2s ease;
  margin-bottom: 2rem;
}

.btn-auth:hover {
  transform: translateY(-1px);
  box-shadow: 0 1rem 2rem rgba(102, 126, 234, 0.3);
}

.btn-auth:active {
  transform: translateY(0);
}

#errorMessage {
  display: none;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 0.75rem;
  font-size: 0.9rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  padding-top: 2rem;
  border-top: 1px solid #e2e8f0;
}

.auth-switch p {
  color: #718096;
  margin: 0;
}

.auth-switch a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* 预览按钮样式 */
.preview-btn {
  margin-bottom: 10px;
}

/* 通用工具类 */
.hidden {
  display: none;
}

/* Toast 通知样式增强 */
.toast {
  min-width: 300px;
}

.toast.bg-success .toast-header {
  background-color: rgba(25, 135, 84, 0.9);
  color: white;
  border-bottom: none;
}

.toast.bg-danger .toast-header {
  background-color: rgba(220, 53, 69, 0.9);
  color: white;
  border-bottom: none;
}

.toast.bg-warning .toast-header {
  background-color: rgba(255, 193, 7, 0.9);
  color: black;
  border-bottom: none;
}

.toast.bg-primary .toast-header {
  background-color: rgba(13, 110, 253, 0.9);
  color: white;
  border-bottom: none;
}

/* 卡片阴影增强 */
.card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  border: 1px solid rgba(0, 0, 0, 0.125);
}

.card.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.15);
}

/* 按钮样式增强 */
.btn {
  border-radius: 0.375rem;
  font-weight: 500;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* 表格样式增强 */
.table {
  border-radius: 0.5rem;
  overflow: hidden;
}

.table thead th {
  border-bottom: 2px solid #dee2e6;
  background-color: #f8f9fa;
  font-weight: 600;
}

/* 进度条样式 */
.progress {
  border-radius: 0.5rem;
  height: 1.5rem;
}

.progress-bar {
  border-radius: 0.5rem;
}

/* 徽章样式增强 */
.badge {
  font-size: 0.875em;
  font-weight: 500;
}

/* 确保状态徽章文字颜色正确 */
.badge {
  color: #000;
}

.badge.badge-success-gradient {
  color: white !important;
}

.badge.badge-danger-gradient {
  color: white !important;
}

.badge.badge-primary-gradient {
  color: white !important;
}

.badge.badge-secondary-gradient {
  color: white !important;
}

.badge.badge-warning-gradient {
  color: #212529 !important;
}

/* 渐变徽章样式 */
.badge.badge-success-gradient {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
}

.badge.badge-danger-gradient {
  background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
  color: white;
  border: none;
}

.badge.badge-primary-gradient {
  background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
  color: white;
  border: none;
}

.badge.badge-secondary-gradient {
  background: linear-gradient(135deg, #6c757d 0%, #adb5bd 100%);
  color: white;
  border: none;
}

.badge.badge-warning-gradient {
  background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
  color: #212529;
  border: none;
}

/* 模态框样式增强 */
.modal-content {
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
  border-bottom: 1px solid #dee2e6;
  border-radius: 0.5rem 0.5rem 0 0;
}

.modal-footer {
  border-top: 1px solid #dee2e6;
  border-radius: 0 0 0.5rem 0.5rem;
}

/* 富文本编辑器样式 */
.note-editor {
  margin-bottom: 1rem;
  border-radius: 0.5rem;
}

/* 状态指示器 */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-indicator.online {
  background-color: #28a745;
}

.status-indicator.offline {
  background-color: #dc3545;
}

.status-indicator.pending {
  background-color: #ffc107;
}

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

/* 加载动画 */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

/* 空状态样式 */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #6c757d;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* 代码块样式 */
code {
  color: #e83e8c;
  background-color: #f8f9fa;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

/* 响应式设计 */
@media (max-width: 1200px) and (min-width: 769px) {
  .login-container, .register-container {
    width: 45vw;
    max-width: 500px;
    min-width: 400px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  
  #previewTable th, #previewTable td {
    min-width: 120px;
  }
  
  .login-container, .register-container {
    width: 90vw;
    max-width: 400px;
    min-width: 320px;
    padding: 1rem;
  }
  
  .form-signin, .form-register {
    height: auto;
    padding: 2rem 1.5rem;
    border-radius: 20px;
  }
  
  body.auth-page .main-content .container-fluid {
    padding: 1rem;
  }
  
  /* 移动端侧边栏切换按钮 */
  .mobile-toggle {
    display: block;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: rgba(102, 126, 234, 0.9);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 0.5rem;
  }
  
  /* 移动端用户下拉菜单调整 */
  .user-dropdown-menu {
    width: 260px;
    margin-top: 0.25rem;
  }
  
  .user-info-header {
    padding: 1rem;
  }
  
  .user-avatar-btn {
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .user-avatar img {
    width: 32px;
    height: 32px;
  }
  
  .user-basic-info .username {
    font-size: 0.8rem;
  }
  
  .user-basic-info .user-status {
    font-size: 0.7rem;
  }
  
  .user-avatar-large img {
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 769px) {
  .mobile-toggle {
    display: none;
  }
} 