* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5em;
}

h3 {
    color: #34495e;
    margin: 20px 0 10px;
    font-size: 1.2em;
}

input, button {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 5px;
    border: 1px solid #ddd;
    font-size: 1em;
}

button {
    background: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #2980b9;
}

.hidden {
    display: none !important; /* 使用 !important 確保隱藏 */
}

#login-error {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 10px;
}

#history-log {
    list-style: none;
    background: #fafafa;
    padding: 10px;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
}

#history-log li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

#history-log li:last-child {
    border-bottom: none;
}

.history-timestamp {
    color: #7f8c8d;
    font-size: 0.8em;
}

.history-user {
    font-weight: 600;
    color: #2c3e50;
}

.history-action {
    color: #95a5a6;
    font-style: italic;
}

@media (min-width: 768px) {
    .container {
        max-width: 400px;
    }
}

/* Modal Overlay */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* 半透明黑色背景 */
    z-index: 1000; /* 確保在其他內容之上 */
    display: flex; /* 使用 Flexbox 居中 Modal */
    justify-content: center; /* 水平居中 */
    align-items: center; /* 垂直居中 */
}

/* Loading Modal */
#loading-modal {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001; /* 確保在遮罩之上 */
    text-align: center;
    max-width: 80%; /* 避免在小螢幕上過寬 */
}

#loading-modal p {
    margin-top: 15px; /* 載入動畫下方文字的上邊距 */
    font-size: 1.1em;
    color: #555;
}

/* Loader CSS */
.loader {
  position: relative; /* Adjusted for modal context */
  width: 2.5em;
  height: 2.5em;
  transform: rotate(165deg);
  margin: 0 auto; /* Center the loader within the modal content */
}

.loader:before, .loader:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 0.5em;
  height: 0.5em;
  border-radius: 0.25em;
  transform: translate(-50%, -50%);
}

.loader:before {
  animation: before8 2s infinite;
}

.loader:after {
  animation: after6 2s infinite;
}

@keyframes before8 {
  0% {
  width: 0.5em;
  box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75), -1em 0.5em rgba(111, 202, 220, 0.75);
  }

  35% {
  width: 2.5em;
  box-shadow: 0 -0.5em rgba(225, 20, 98, 0.75), 0 0.5em rgba(111, 202, 220, 0.75);
  }

  70% {
  width: 0.5em;
  box-shadow: -1em -0.5em rgba(225, 20, 98, 0.75), 1em 0.5em rgba(111, 202, 220, 0.75);
  }

  100% {
  box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75), -1em 0.5em rgba(111, 202, 220, 0.75);
  }
}

@keyframes after6 {
  0% {
  height: 0.5em;
  box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75), -0.5em -1em rgba(233, 169, 32, 0.75);
  }

  35% {
  height: 2.5em;
  box-shadow: 0.5em 0 rgba(61, 184, 143, 0.75), -0.5em 0 rgba(233, 169, 32, 0.75);
  }

  70% {
  height: 0.5em;
  box-shadow: 0.5em -1em rgba(61, 184, 143, 0.75), -0.5em 1em rgba(233, 169, 32, 0.75);
  }

  100% {
  box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75), -0.5em -1em rgba(233, 169, 32, 0.75);
  }
}