/* Common shared styles */

* {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

/* Global scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}

body.dark ::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
}

.directory-header {
  font-family: "Domine", serif;
  font-size: 5rem;
  text-align: center;
  margin-bottom: 40px;
  color: #66b2ff;
  text-shadow:
    2px 2px 0 #1e1e1e,
    4px 4px 0 #0d0d0d,
    5px 5px 0 #000;
  font-weight: 600;
  letter-spacing: 0.1em;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.directory-header.is-frozen {
  position: fixed;
  margin: 0;
}

@media (max-width: 480px) {
  .directory-header {
    font-size: 2.6rem;
    margin: 20px 0 16px;
  }
}

.footer {
  margin-top: 30px;
  font-size: 0.85em;
  color: #999;
  text-align: center;
  font-family: "Courier New", Courier, monospace;
  opacity: 0.8;
}

body.dark .footer {
  color: #aaa;
}

.glass-button {
  position: relative;
  overflow: hidden;
  padding: 8px 16px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  z-index: 0;
  background-color: inherit;
}

.glass-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: transparent;
  z-index: 0;
}

.glass-button > * {
  position: relative;
  z-index: 2;
}

.glass-button:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

/* Input fields styled like glass */
.glass-input {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 8px;
  color: #000;
}

.glass-input::placeholder {
  color: rgba(0, 0, 0, 0.6);
}

body.dark .glass-input {
  background: rgba(30, 30, 30, 0.4);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark .glass-input::placeholder {
  color: #bbb;
}

/* ===== LOADING SPINNER ===== */
#loadingSpinner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#loadingSpinner.show {
  opacity: 1;
  pointer-events: auto;
}

.spinner-glass {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  box-shadow:
    inset 0 0 10px rgba(255, 255, 255, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.2);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

body.dark #loadingSpinner {
  background: rgba(30, 30, 30, 0.45);
}

body.dark .spinner-glass {
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.6);
  background: rgba(30, 30, 30, 0.6);
}

/* ===== LIQUID GLASS ===== */
.liquid-glass {
  width: 100%;
  max-width: 420px;
  height: 200px;
  border-radius: 56.00000000000001px;
  position: relative;
  isolation: isolate;
  box-shadow: 0px 6px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  border: none;
  background: none;
  padding: 20px 0;
  margin: 0;
  text-decoration: none;
  animation: fadeInCenter 0.5s ease-out both;
}

.liquid-glass:focus {
  outline: none;
}

.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 56.00000000000001px;
  box-shadow: inset 0 0 15px -5px #000000;
  background-color: rgba(255, 255, 255, 0);
}

.liquid-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 56.00000000000001px;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  filter: url(#glass-distortion);
  -webkit-filter: url(#glass-distortion);
}

.glass-text {
  position: relative;
  color: #ffffff;
  font-size: 24px;
  font-weight: 400;
  text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
  opacity: 1;
  transform: translate(0px, 0px);
  font-family: "Georgia", "Microsoft YaHei", "微软雅黑", serif;
}

/* Apply consistent rounding across all buttons */
button:not(.btn-close) {
  border-radius: 28px;
}

/* Add pointer on hover for all buttons */
button:hover {
  cursor: pointer;
}

/* Style icons in the liquid glass dock */
liquid-glass-dock i {
  color: rgba(255, 255, 255, 0.85);
}

/* Smaller liquid dock */
.compact .dock {
  padding: 0.4rem;
  gap: 6px;
}

.compact .button {
  padding: 1rem 1.6rem;
}

.compact .liquidGlass-text {
  font-size: 1.4rem;
}

/* Keep the liquid dock above all page elements */
liquid-glass-dock #glassContainer {
  position: relative;
  z-index: 10000;
}

#glassContainer.dragging {
  position: fixed;
  margin: 0;
  transition: none;
}

#glassContainer.dragging * {
  transition: none;
}

/* Position the settings button in the bottom left */
#settingsButton {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
}

#settingsButton i {
  font-size: 1.2rem;
  color: white;
}

#settingsButton .liquidGlass-text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#settingsButton.button {
  width: 3rem;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
}

#settingsButton.button:hover {
  transform: scale(1.05);
}

.hidden {
  display: none !important;
}

/* Settings popup */
#settingsPopup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12000;
}

#settingsPopup.hidden {
  display: none;
}

/* Ensure popup width stays consistent */
#settingsPopup .liquidGlass-wrapper.dock {
  box-sizing: border-box;
  width: 90%;
  max-width: 600px;
}

.settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

/* First-time dock tour */
#tourOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 13000;
}

#tourOverlay.hidden {
  display: none;
}

.tour-modal .liquidGlass-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: center;
  color: white;
  padding: 1rem 1rem 0;
  justify-content: center;
}

.tour-title {
  margin: 0;
}

.tour-description {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
  font-weight: 400;
}

.tour-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  font-size: 1rem;
  font-weight: 400;
}

.tour-list i {
  margin-right: 0.5rem;
  font-size: 1.2rem;
}

#tourDismiss.button {
  padding: 0.6rem 1.2rem;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

#tourDismiss.button:hover {
  padding: 0.8rem 1.4rem;
}

#tourDismiss .liquidGlass-text {
  font-size: 1rem;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
  height: 100%;
}

.settings-modal {
  position: relative;
  display: flex;
  max-width: 700px;
  width: 90%;
  z-index: 1;
}

/* Arrange sidebar and content horizontally */
.settings-modal .liquidGlass-text {
  display: flex;
  color: white;
}

.settings-modal label {
  color: white;
}

/* Smaller label text for settings inputs */
.small-label {
  font-size: 0.9rem;
}

.settings-sidebar {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-menu-item {
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  color: white;
  cursor: pointer;
}

.settings-menu-item:hover,
.settings-menu-item.active {
  background: rgba(255, 255, 255, 0.2);
}

.settings-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0.5rem 0;
  align-self: stretch;
}

.settings-content {
  flex: 1;
  padding: 1rem;
}

.settings-actions {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
}

.settings-actions .glass-button {
  padding: 0.4rem 1rem;
}

.settings-section.hidden {
  display: none;
}

/* Keep modal width consistent when switching tabs */
.settings-modal .dock {
  width: 100%;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
}
