body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: #f0f0f0;
  color: #333;
}

h1 {
  font-size: 28px; /* 較大的字體，吸引注意 */
  color: #1a1a1a; /* Darker text for headers */
  margin: 0; /* 移除預設邊距 */
  font-weight: bold; /* 粗體，強調重要性 */
  line-height: 1.2; /*行高，確保可讀性*/
  display: flex;
  justify-content: center;
}

/* 確保在移動設備上適應 */
@media (max-width: 768px) {
  h1 {
      font-size: 22px; /* 縮小字體以適應小型螢幕 */
  }
}

h2 {
  font-size: 22px; /* 比 <h1> (28px) 小，但比段落文字大 */
  color: #1a1a1a; /* Darker text for headers */
  margin: 20px 0 10px 0; /* 上邊距 20px，下邊距 10px，與內容保持適當間距 */
  font-weight: 600; /* 中等粗體，確保清晰但不過於突出 */
  line-height: 1.4; /* 增加行高，提升可讀性 */
  font-family: sans-serif; /* 與 body 和 h1 保持一致 */
  text-align: center; /* 水平居中，與 h1 一致（可根據需求調整） */
}

/* 確保在移動設備上適應 */
@media (max-width: 768px) {
  h2 {
      font-size: 18px; /* 縮小字體以適應小型螢幕 */
      margin: 15px 0 8px 0; /* 縮減間距 */
  }
}

/* 可選：添加陰影或背景效果，提升視覺吸引力 */
h2:hover {
  text-decoration: underline; /* 懸停時加下劃線，增加互動性 */
  /* 或添加輕微陰影 */
  /* text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); */
}

#left-panel {
  width: 12%; /* Reduced width */
   /* Reduced padding */
  overflow-y: auto;
  height: 100vh; /* Make right panel take full height */
  position: fixed; /* Fix the position */
  top: 0;
  left: 0;
  background-color: #f0f0f0; /* Match body background */
}

#mid-panel {
  width: 70%;
  text-align: center;
  margin: 0 auto;
  padding: 10px;
  overflow-y: auto;
  height: 100vh; /* Make right panel take full height */  
  display: flex;
  flex-direction: column;
  align-items: center; /* Center canvas horizontally */
}

#right-panel {
  width: 10%; /* Reduced width */
  padding-left: 10px; /* Reduced padding */
  overflow-y: auto;
  height: 100vh; /* Make right panel take full height */
  position: fixed; /* Fix the position */
  top: 0;
  right: 0;
  background-color: #f0f0f0; /* Match body background */
}

#pdf-canvas {
  position: relative;
  border: 1px solid #ccc;
  margin-bottom: 10px;
  width: auto; /* Changed from 100% to auto */
  height: auto;
  max-width: 100%; /* Add max-width to prevent overflow */
  transition: all 0.3s ease; /* Smooth transition for zoom */
}

#pdf-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  color: #4a4a4a; /* Darker text instead of #666 */
  font-family: sans-serif;
  text-align: center;
  padding: 40px;
  border: 2px dashed #666666; /* Darker border */
  border-radius: 8px;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 60%;
  height: 60%;
  max-width: 800px; /* Limit width for smaller screens */
  max-height: 800px; /* Limit height for smaller screens */ 
}

.placeholder-content {
  position: relative;
  width: 100%;
  text-align: center;
}

#pdf-placeholder::after {
  content: 'Drag PDF here';
  display: block;
  font-size: 24px;
  margin-top: 20px;
  color: #666;
}

#pdf-placeholder::after {
  content: 'Drag PDF here';
  display: block;
  font-size: 16px;
  margin-top: 10px;
  color: #999;
}

#pdf-placeholder.drag-hover {
  border-color: #007bff;
  background-color: rgba(0, 123, 255, 0.1);
}

/* Remove or modify the old #pdf-upload style */
#pdf-upload {
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    position: absolute;
    top: 0;
    left: 0;
    /* Limit to parent container */
    position: relative;
}

#navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#navigation button {
  padding: 5px 10px;
  cursor: pointer;
}

#total-pages {
  font-size: 16px; /* 與 pageNumInput 保持一致的字體大小 */
  color: #333333; /* Darker text instead of #666 */
  margin-left: 5px; /* 與 pageNumInput 保持適當間距 */
  font-family: sans-serif; /* 與 body 保持一致 */
}

#page-num {
  width: 50px; /* 固定寬度，確保輸入框大小一致 */
  text-align: center;
  margin: 0 auto;
  font-size: 16px; /* 確保與 total-pages 一致 */
  color: #333333; /* Darker text instead of #666 */
}

.thumbnail {
    width: 75%;
    border: 1px solid #ccc;
    margin-bottom: 5px;
    cursor: pointer;
}

.thumbnail:hover {
    background-color: #f0f0f0;
}

#drawing-controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

#drawing-controls button {
  padding: 5px 10px;
  margin: 0 5px;
  cursor: pointer;
}

#drawing-controls button.active {
  background-color: #007bff;
  color: white;
}



#fullscreen-controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
  display: none;
}

#fullscreen-controls button {
  padding: 5px 10px;
  margin: 0 5px;
  cursor: pointer;
  display: none;
}

#fullscreen-controls button.active {
  background-color: #28a745;
  color: white;
}

/* Fullscreen Styles */
:fullscreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #fff; /* Ensure background is white */
    width: 100%;
    height: 100%;
    margin: 0; /* Remove margins */
    padding: 0; /* Remove padding */
}

:fullscreen #mid-panel {
    width: 100%;
    height: auto;
}

:fullscreen #right-panel {
    display: none; /* Hide the thumbnails in fullscreen */
}

:fullscreen #pdf-canvas {
    max-width: 100%;
    max-height: 80vh; /* Limit canvas height */
    width: auto;
    height: auto;
}

:fullscreen #navigation {
    position: relative;
    z-index: 2;
}

:fullscreen #drawing-controls {
    position: relative;
    z-index: 2;
}

:fullscreen #fullscreen-controls {
    display: none;
}

/* Ensure buttons are visible in fullscreen */
:fullscreen button {
    z-index: 3;
}

/* Make sure the input is visible */
:fullscreen #page-num {
    z-index: 3;
}

:fullscreen #right-panel {
  /* display: none;  Hide the thumbnails in fullscreen */
  display: block; /* Make sure it's visible */
  width: 25%; /* Or whatever width you want */
}

#left-panel-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

#pdf-upload-container {
    margin-bottom: 10px;
}

#left-panel button {
    width: 100%;
    padding: 8px;
    margin: 2px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #ffffff;
    color: #333333; /* 深色文字 */
    cursor: pointer;
    font-weight: 500; /* 適中的字體粗細 */
}

#left-panel button:hover {
    background-color: #f0f0f0;
    color: #000000;
}

#left-panel button.active {
    background-color: #007bff;
    color: #ffffff; /* 確保啟用狀態的文字是白色 */
    border-color: #0056b3;
}

#left-panel button:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #dee2e6;
}

#search-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 10px 0;
  width: 100%;
}

#search-input {
  width: 93%;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#search-button {
  width: 100%;
  padding: 5px;
  background-color: #0056b3; /* Darker blue */
  color: rgb(10, 10, 10);
  border: 1px solid #004085;
  border-radius: 4px;
  cursor: pointer;
}

#search-button:hover {
  background-color: #004085;
}

#search-nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
  gap: 5px;
}

#search-nav-container button {
  padding: 5px 10px;
  background-color: #ffffff;
  color: #333333;
  border: 1px solid #cccccc;
  border-radius: 4px;
  cursor: pointer;
}

#search-nav-container button:disabled {
  background-color: #6c757d; /* Accessible gray */
  color: #ffffff;
}

#search-count {
  font-size: 14px;
  color: #333333; /* Darker text instead of #666 */
}

#search-nav-container button:hover:not(:disabled) {
  background-color: #004085;
}

#left-panel-upload {
    position: relative; /* Add this to contain absolute positioned children */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border: 2px dashed #ccc;
    border-radius: 4px;
    margin: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    /* Add a specific height if needed */
    height: 30px;
}

/* Rest of the styles remain the same */
#left-panel-upload:hover {
    border-color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

#left-panel-upload-text {
    font-size: 14px;
    color: #333333; /* Darker text instead of #666 */
    text-align: center;
    margin-bottom: 5px;
}

#left-panel-upload input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 24px;
    color: #333333; /* Darker text instead of #666 */
    margin-bottom: 5px;
}

#clean-drawing {
    width: 100%;
    padding: 8px;
    margin: 2px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

#clean-drawing:hover {
    background-color: #f0f0f0;
}

#enable-text {
    width: 100%;
    padding: 8px;
    margin: 2px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
}

#enable-text:hover {
    background-color: #f0f0f0;
}

#enable-text.active {
    background-color: #007bff;
    color: white;
}

#font-size-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    gap: 5px;
}

#font-size-controls button {
    flex: 1;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    font-size: 12px;
}

#font-size-controls button:hover {
    background-color: #f0f0f0;
}

#font-size-controls button.active {
    background-color: #007bff;
    color: white;
}

#small-font {
    font-size: 12px;
}

#medium-font {
    font-size: 16px;
}

#large-font {
    font-size: 24px;
}

#zoom-controls {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    margin: 10px 0;
}

#zoom-controls button {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
    cursor: pointer;
    font-size: 14px;
}

#zoom-controls button:hover {
    background-color: #f0f0f0;
}

#zoom-reset {
    min-width: 60px;
    text-align: center;
}

/* Button styles with better contrast */
button {
    background-color: #0056b3; /* Darker blue */
    color: #ffffff;
    border: 1px solid #004085;
}

button:hover {
    background-color: #004085;
}

button:disabled {
    background-color: #6c757d; /* Accessible gray */
    color: #ffffff;
}

/* Active state with better contrast */
button.active {
    background-color: #003366; /* Darker blue for active state */
    color: #ffffff;
}

#drawing-controls button,
#search-nav-container button {
    background-color: #ffffff;
    color: #333333;
    border: 1px solid #cccccc;
}

.tool-description {
    color: #333;
    font-size: 1.2rem;
    margin: 1rem 0;
    line-height: 1.5;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.feature-list li {
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-instructions {
    background: #fff;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tool-instructions ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.tool-instructions li {
    margin: 0.5rem 0;
    color: #555;
}