/* 
  全域共用樣式 (common.css)
  包含字體、變數、GitHub Corner 與回到頂端按鈕 
*/

:root {
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --text: #424242;
  --text-light: #757575;
  --border: #e0e0e0;
  --weekend: #fafafa;
  --holiday: #c62828;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --header-bg: #ffffff;
  --calendar-bg: #ffffff;
  --day-bg: #ffffff;
  --day-hover: #f5f5f5;
  --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --primary: #8ab4f8;
  --primary-hover: #aecbfa;
  --text: #e8eaed;
  --text-light: #9aa0a6;
  --border: #3c4043;
  --weekend: #2d2e30;
  --holiday: #f28b82;
  --bg: #202124;
  --card-bg: #292a2d;
  --header-bg: #292a2d;
  --calendar-bg: #292a2d;
  --day-bg: #2d2e30;
  --day-hover: #3c4043;
  --shadow: rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Google Sans", "Microsoft JhengHei", Arial, sans-serif;
  color: var(--text);
  line-height: 1.5;
  background: var(--bg);
  transition: background 0.3s ease, color 0.3s ease;
}

/* 回到頂端按鈕 */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
  border: none;
  outline: none;
}

#backToTop.show {
  opacity: 1;
  visibility: visible;
}

#backToTop:hover {
  background: var(--primary-hover);
  transform: translateY(-5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

#backToTop svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* GitHub Corner */
.github-corner:hover .octo-arm {
  animation: octocat-wave 560ms ease-in-out;
}

@keyframes octocat-wave {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-25deg); }
  40%, 80% { transform: rotate(10deg); }
}

@media (max-width: 500px) {
  .github-corner:hover .octo-arm { animation: none; }
  .github-corner .octo-arm { animation: octocat-wave 560ms ease-in-out; }
}
