/* ===== 可复用样式 ===== */
/* 工具类 */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-primary {
  color: var(--primary-color);
}

.text-danger {
  color: var(--danger-color);
}

.text-success {
  color: var(--success-color);
}

.text-warning {
  color: var(--warning-color);
}

.text-light {
  color: var(--light-text);
}

.text-lighter {
  color: var(--lighter-text);
}

.font-bold {
  font-weight: 600;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.pointer {
  cursor: pointer;
}

.transition {
  transition: var(--transition);
}

.transition-fast {
  transition: var(--transition-fast);
}

/* 工具类 */
.icon {
  width: 1.25em;
  height: 1.25em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}

/* ======================
 * Toast通知模块
 * ====================== */
.toast-container {
  position: fixed;
  bottom: 55px;
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0 20px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  background-color: var(--white);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transform: translateY(20px);
  opacity: 0;
  transition: var(--transition);
  max-width: 100%;
  width: auto;
  min-width: 200px;
  pointer-events: auto;
  word-break: break-word;
  text-align: left;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.toast-success .toast-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
}

.toast-error .toast-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z'/%3E%3C/svg%3E");
}

.toast-warning .toast-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z'/%3E%3C/svg%3E");
}

.toast-info .toast-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}

.toast-success {
  background-color: rgba(76, 175, 80, 0.9);
  color: white;
}

.toast-error {
  background-color: rgba(244, 67, 54, 0.9);
  color: white;
}

.toast-warning {
  background-color: rgba(255, 165, 2, 0.9);
  color: white;
}

.toast-info {
  background-color: rgba(33, 150, 243, 0.9);
  color: white;
}

.toast-message {
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.4;
  min-width: 0;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  margin-left: 8px;
  opacity: 0.7;
  flex-shrink: 0;
  line-height: 1;
  transition: var(--transition-fast);
}

.toast-close:hover {
  opacity: 1;
}

/* ======================
 * 确认对话框模块
 * ====================== */
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.confirm-box {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  width: 80%;
  max-width: 300px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  animation: confirm-fadein 0.3s;
}

.confirm-box h3 {
  margin: 0 0 10px;
  color: #333;
  font-size: 18px;
}

.confirm-box p {
  margin: 0 0 20px;
  color: #666;
}

.confirm-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.confirm-cancel,
.confirm-ok {
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 80px;
  text-align: center;
  border: 1px solid transparent;
}

.confirm-cancel {
  background: #f5f5f5;
  color: #595959;
  border-color: #d9d9d9;
}

.confirm-cancel:hover {
  background: #e8e8e8;
  border-color: #bfbfbf;
  color: #262626;
}

.confirm-cancel:active {
  background: #d9d9d9;
}

.confirm-ok {
  background: #1890ff;
  color: white;
  border-color: #1890ff;
}

.confirm-ok:hover {
  background: #40a9ff;
  border-color: #40a9ff;
}

.confirm-ok:active {
  background: #096dd9;
  border-color: #096dd9;
}

.confirm-ok.is-danger {
  background: #ff4d4f;
  border-color: #ff4d4f;
}

.confirm-ok.is-danger:hover {
  background: #ff7875;
  border-color: #ff7875;
}

.confirm-ok.is-danger:active {
  background: #d9363e;
  border-color: #d9363e;
}

/* ======================
 * 工具提示模块
 * ====================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  margin-bottom: 5px;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}