/**
 * Buyer Leo - UI Components Styles
 * 提供Toast和Modal组件的样式
 */

/* 颜色变量 */
:root {
  --toast-success-bg: #4caf50;
  --toast-error-bg: #f44336;
  --toast-warning-bg: #ff9800;
  --toast-info-bg: #2196f3;
  --toast-default-bg: #333333;
  
  --toast-text-color: #ffffff;
  --toast-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
  
  --modal-overlay-bg: rgba(0, 0, 0, 0.5);
  --modal-bg: #ffffff;
  --modal-border-radius: 8px;
  --modal-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  --modal-header-border: 1px solid #f0f0f0;
  --modal-footer-border: 1px solid #f0f0f0;
}

/* ==========================================
   Toast 通知样式
   ========================================== */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
  width: calc(100% - 40px);
}

.toast {
  background-color: var(--toast-default-bg);
  color: var(--toast-text-color);
  border-radius: 4px;
  padding: 0;
  box-shadow: var(--toast-shadow);
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.3s ease;
  overflow: hidden;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  background-color: var(--toast-success-bg);
}

.toast.error {
  background-color: var(--toast-error-bg);
}

.toast.warning {
  background-color: var(--toast-warning-bg);
}

.toast.info {
  background-color: var(--toast-info-bg);
}

.toast-content {
  display: flex;
  align-items: center;
  padding: 12px 15px;
}

.toast-content i {
  margin-right: 10px;
  font-size: 18px;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--toast-text-color);
  opacity: 0.7;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  margin-left: 10px;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover {
  opacity: 1;
}

.toast-progress {
  height: 3px;
  background-color: rgba(255, 255, 255, 0.3);
  width: 100%;
  transition: width linear;
}

/* 移动端适配 */
@media (max-width: 480px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    width: calc(100% - 20px);
  }
}

/* ==========================================
   Modal 对话框样式
   ========================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--modal-overlay-bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

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

.modal {
  background-color: var(--modal-bg);
  border-radius: var(--modal-border-radius);
  box-shadow: var(--modal-shadow);
  max-width: 100%;
  width: 500px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

/* Modal 尺寸 */
.modal-overlay.small .modal {
  width: 400px;
}

.modal-overlay.large .modal {
  width: 700px;
}

.modal-overlay.xlarge .modal {
  width: 900px;
}

/* Modal 组件 */
.modal-header {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--modal-header-border);
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  max-height: calc(80vh - 130px);
}

.modal-footer {
  padding: 15px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: var(--modal-footer-border);
}

/* 移动端适配 */
@media (max-width: 480px) {
  .modal-overlay {
    padding: 10px;
  }
  
  .modal-overlay.small .modal,
  .modal-overlay.medium .modal,
  .modal-overlay.large .modal,
  .modal-overlay.xlarge .modal {
    width: 100%;
  }
  
  .modal-body {
    max-height: calc(80vh - 100px);
  }
}

/* ==========================================
   语言切换按钮
   ========================================== */
.lang-selector {
  display: flex;
  background-color: #f5f5f5;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  height: 36px;
  min-width: 120px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.lang-selector-option {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50%;
  height: 100%;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color 0.3s;
  color: #666;
}

.lang-selector-option.active {
  color: #fff;
}

.lang-selector:before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 4px);
  height: calc(100% - 4px);
  background-color: var(--primary-blue);
  border-radius: 16px;
  transition: transform 0.3s ease;
  z-index: 0;
}

.lang-selector.zh-active:before {
  transform: translateX(calc(100% + 4px));
} 