/* Sidebar Drawer Component Styles */
.sidebar-drawer {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 1050;
  font-family: inherit;
  /* 确保不会影响页面布局 */
  pointer-events: none;
}

/* Floating Tab */
.drawer-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
  color: white;
  padding: 14px;
  border-radius: 12px 0 0 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -4px 4px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.3s ease;
  width: 36px;
  height: 64px;
  min-width: 36px;
  z-index: 1051;
  /* 确保标签可以点击 */
  pointer-events: auto;
}

.drawer-tab:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-50%) translateX(-3px);
  box-shadow: -6px 6px 25px rgba(59, 130, 246, 0.6);
}

.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.tab-icon i {
  font-size: 16px;
  transition: all 0.3s ease;
  font-weight: 600;
}

.sidebar-drawer.open .tab-icon .open-icon {
  display: none;
  opacity: 0;
  transform: translateX(-10px);
}

.sidebar-drawer:not(.open) .tab-icon .close-icon {
  display: none;
  opacity: 0;
  transform: translateX(10px);
}

.sidebar-drawer.open .tab-icon .close-icon {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

.sidebar-drawer:not(.open) .tab-icon .open-icon {
  display: block;
  opacity: 1;
  transform: translateX(0);
}

/* 当drawer打开时，标签应该随面板一起移动 */
.sidebar-drawer.open .drawer-tab {
  transform: translateY(-50%) translateX(-300px);
}

/* Drawer Panel */
.drawer-panel {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translate(100%, -50%);
  width: 300px;
  height: 80vh;
  max-height: 640px;
  background: white;
  border-radius: 12px 0 0 12px;
  box-shadow: -8px 8px 30px rgba(0, 0, 0, 0.15);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1050;
  /* 确保面板可以交互 */
  pointer-events: auto;
}

.sidebar-drawer.open .drawer-panel {
  transform: translate(0, -50%);
}

.drawer-header {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  padding: 20px;
  border-bottom: 1px solid #3b82f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.drawer-title {
  color: #1e40af;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

/* Drawer Content */
.drawer-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

.drawer-section {
  border-bottom: 1px solid #f1f5f9;
}

.drawer-section:last-child {
  border-bottom: none;
}

.section-header {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 16px 20px;
  border-bottom: 2px solid #0ea5e9;
  position: relative;
  transition: all 0.2s ease;
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6 0%, #0ea5e9 100%);
  transition: width 0.3s ease;
}

.section-header:hover::after {
  width: 100%;
}

.section-bold {
  color: #075985;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.section-bold i {
  color: #0ea5e9;
}

.section-content {
  padding: 12px 0;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Drawer Links */
.drawer-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  color: #4a5568;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
}

.drawer-link:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, rgba(14, 165, 233, 0.1) 100%);
  color: #2563eb;
}

.drawer-link span {
  font-weight: 500;
}

.drawer-link i {
  font-size: 12px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.drawer-link:hover i {
  opacity: 1;
}

/* Contact Information */
.contact-info {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #f7fafc;
}

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

.contact-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.contact-icon i {
  font-size: 14px;
}

.contact-details {
  flex: 1;
}

.contact-label {
  font-size: 12px;
  color: #718096;
  margin-bottom: 2px;
  font-weight: 500;
}

.contact-value {
  font-size: 14px;
  color: #2d3748;
  font-weight: 600;
  text-decoration: none;
  word-break: break-word;
}

.contact-value:hover {
  color: #2563eb;
  text-decoration: underline;
}

/* Overlay */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1040;
  /* 确保遮罩层可以点击 */
  pointer-events: auto;
}

.sidebar-drawer.open .drawer-overlay {
  opacity: 1;
  visibility: visible;
}

/* Responsive Design */
@media (max-width: 768px) {
  .drawer-panel {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    transform: translateX(100%);
  }

  .sidebar-drawer.open .drawer-panel {
    transform: translateX(0);
  }

  .drawer-tab {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 12px;
  }

  .sidebar-drawer {
    top: auto;
    bottom: 20px;
    transform: none;
  }

  .drawer-tab {
    top: 0;
    transform: none;
  }

  .sidebar-drawer.open .drawer-tab {
    transform: translateX(-100%);
  }
}

@media (max-width: 480px) {
  .drawer-header {
    padding: 16px;
  }

  .drawer-title {
    font-size: 16px;
  }

  .section-header {
    padding: 12px 16px;
  }

  .section-bold {
    font-size: 14px;
  }

  .drawer-link {
    padding: 10px 16px;
  }

  .contact-info {
    padding: 10px 16px;
  }
}

/* Animation Classes */
.drawer-slide-in {
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-slide-out {
  animation: slideOut 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

/* Focus Styles for Accessibility */
.drawer-tab:focus,
.drawer-link:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .sidebar-drawer {
    display: none !important;
  }
}
