@import "./theme.css";

/* 通用图标按钮样式 */
.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0);
  color: var(--text-light);
  transition: var(--transition-fast);
}

.icon-button:hover {
  background: var(--hover-bg);
}


/* APP容器 */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* background-color: var(--bg-overlay); */
  overflow-x: auto;
}

/* 头部 */
header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  padding: 15px 20px;
  height: var(--header-height);
}

header nav {
  display: flex;
  gap: 15px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 顶部按钮样式 */
.top-button {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
}

main {
  width: 100%;
  flex: 1;
  display: flex;
  gap: 30px;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  margin-top: 16vh;
  transition: var(--transition-normal);
}

.time-container {
  display: flex;
  gap: 0.63rem;
  align-items: center;
  flex-direction: column;
}

.time-display {
  color: var(--text-light);
  font-size: var(--time-font-size);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  font-weight: 600;
  letter-spacing: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform, opacity;
}

.time-display.blurred {
  transform: scale(0.95);
  opacity: 0.9;
}

.time-container p {
  color: var(--text-light);
  font-size: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  font-weight: 500;
  letter-spacing: 2px;
  transition: var(--transition-normal);
}

.search-container {
  width: 100%;
  max-width: 37.5rem;
  text-align: center;
}

/* 搜索框容器 */
.search-wrapper {
  display: flex;
  width: 100%;
  height: var(--search-box-height);
  flex-direction: row;
  justify-content: center;
  border-radius: 30px;
  background-color: var(--bg-overlay);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
}

/* 搜索框 */
.search-box {
  width: 100%;
  height: var(--search-box-height);
  border: none;
  font-size: 0.9rem;
  outline: 0;
  transition: background-color 0.3s ease, text-align 0.3s ease, letter-spacing 0.3s ease;
  background: rgba(255, 255, 255, 0);
  text-align: center;
  color: var(--text-light);
  padding-left: 3px;
}

.search-box:focus {
  color: var(--text-light);
  text-align: left;
  letter-spacing: 1px;
}

.search-box::placeholder {
  color: var(--text-light);
  letter-spacing: 1px;
  font-size: 0.9rem;
}

/* 搜索引擎图标样式 */
.engines-icon {
  width: 3.75rem;
  height: var(--search-box-height);
  border-radius: 30px 0 0 30px;
  padding-left: 3px;
}

/* 搜索图标样式 */
.search-icon {
  width: 3.75rem;
  height: var(--search-box-height);
  border-radius: 0 30px 30px 0;
  padding-right: 3px;
}

/* 搜索引擎列表容器 */
.glass-container {
  background: var(--glass-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  
  @supports not (backdrop-filter: blur(10px)) {
    background: rgba(255, 255, 255, 0.3);
  }
}

.engine-list {
  display: none;
  margin-top: 8px;
  width: 150px;
  z-index: 2;
}

.engine-list.show {
  display: block;
}

.engine-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: var(--transition-normal);
  color: var(--text-light);
}

.engine-item.highlighted,
.engine-item:hover {
  background: var(--hover-bg);
}

.engine-item-icon {
  margin-right: 12px;
  width: 20px;
  text-align: center;
  color: var(--text-light);
}

.suggestions-list {
  margin-top: 8px;
  width: 100%;
  z-index: 2;
  display: none;
  max-height: 300px;
  font-size: 0.9rem;
  overflow: auto;
}

.suggestions-list.show {
  display: block;
}

.suggestion-item {
  padding: 12px 20px;
  cursor: pointer;
  transition: var(--transition-normal);
  color: var(--text-light);
  text-align: left;
}

.suggestion-item.highlighted,
.suggestion-item:hover {
  background: var(--hover-bg);
}

aside {
  position: fixed;
  top: 0;
  right: calc(var(--sidebar-width) * -1);
  width: var(--sidebar-width);
  height: 100%;
  background: var(--glass-bg);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--glass-border);
  transition: var(--transition-slow);
  z-index: 3;
  padding: 20px;
  color: var(--text-light);
  overflow: auto;
}

aside.open {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.close-sidebar {
  cursor: pointer;
  font-size: var(--icon-size);
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.sidebar-item {
  padding: 10px;
  border-radius: 5px;
  transition: var(--transition-fast);
  cursor: pointer;
}

.sidebar-item:hover {
  background: var(--hover-bg);
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  list-style: none;
}

.quick-link {
  display: block;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
  color: var(--text-light);
}

.quick-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* 页脚 */
footer {
  margin-top: auto; /* 自动占据剩余空间后的底部 */
  padding: 0.6rem;
  text-align: center;
  color: var(--text-light);
  font-size: var(--footer-font-size);
}

footer.blurred {
  display: none;
}

footer a {
  color: var(--text-light);
}

.name::after {
  content: "|";
  font-size: 11px;
  margin: 0 4px;
  color: var(--text-light);
}

/* 移动设备 */
@media (max-width: 768px) {
  main {
    margin-top: 9vh;
  }
  
  .search-container {
    width: 88%;
  }
  
  .quick-links {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .quick-link {
    padding: 6px 8px;
    font-size: 1rem;
  }
  
  .form-control {
    padding: 0 15px 0 40px;
  }
}

/* 小屏幕设备 */
@media (max-width: 480px) {
  :root {
    --time-font-size: 2rem;
    --header-height: 50px;
    --sidebar-width: 100vw;
  }
  
  main {
    margin-top: 16vh;
  }
  
  .time-display {
    font-size: var(--time-font-size);
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Firefox滚动条样式 */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

/* dialog 元素样式 */
#settingsModal {
  padding: 0;
  border: none;
  background: transparent;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  margin: auto;
}

#settingsModal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* 为了兼容不支持 ::backdrop 的浏览器 */
#settingsModal + .modal-overlay {
  display: none;
}

/* dialog 内容样式 */
.modal-container {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.modal-header h4 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--text-light);
  letter-spacing: 0.5px;
}

.close-button {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  font-size: 1.3rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  cursor: pointer;
  color: var(--text-light);
  transition: var(--transition-fast);
}

.close-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
}

.setting-group {
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-group h3 {
  margin: 0 0 20px 0;
  color: var(--text-light);
  font-size: 1.25rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-group h3 i {
  font-size: 1.4rem;
  opacity: 0.8;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding: 15px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  transition: var(--transition-fast);
}

.setting-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-item label {
  color: var(--text-light);
  font-size: 1.05rem;
  margin: 0;
  font-weight: 400;
  flex: 1;
  padding-right: 15px;
}

.setting-item select,
.setting-item input[type="text"] {
  width: 200px;
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid var(--select-border);
  background: var(--select-bg);
  color: var(--text-light);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-fast);
  /* 添加下拉箭头样式 */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 40px;
}

.setting-item select:hover {
  background: var(--select-bg-hover);
}

.setting-item select:focus,
.setting-item input[type="text"]:focus {
  border-color: var(--select-border-focus);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
  background: var(--select-bg-focus);
}

/* 选项样式（在某些浏览器中有效） */
.setting-item select option {
  background: rgba(30, 30, 30, 0.9);
  color: var(--text-light);
}

.setting-item input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 26px;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-label {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: var(--transition-fast);
  border-radius: 26px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-label:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-fast);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-label {
  background-color: #4CAF50;
}

.toggle-input:checked + .toggle-label:before {
  transform: translateX(26px);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  padding: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  min-width: 100px;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #4361ee, #3a0ca3);
  color: white;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3a0ca3, #4361ee);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

/* 移动端适配 */
@media (max-width: 768px) {
  #settingsModal {
    width: 95%;
    max-height: 90vh;
    border-radius: 12px;
  }
  
  .modal-header {
    padding: 20px;
  }
  
  .modal-header h2 {
    font-size: 1.4rem;
  }
  
  .modal-body {
    padding: 20px;
  }
  
  .setting-group {
    padding: 15px;
  }
  
  .setting-group h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }
  
  .setting-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
    padding: 12px;
  }
  
  .setting-item label {
    font-size: 1rem;
  }
  
  .setting-item select,
  .setting-item input[type="text"] {
    width: 100%;
  }
  
  .modal-footer {
    flex-direction: column;
    padding: 20px;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }
  
  .setting-group {
    padding: 12px;
  }
  
  .setting-group h3 {
    font-size: 1.1rem;
  }
  
  .setting-item {
    padding: 10px;
  }
  
  .btn {
    padding: 10px 20px;
    font-size: 0.95rem;
  }
}

/* 自定义滚动条样式 */
.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
