/* Global Styles */
  body {
      margin: 0;
      padding: 0;
      overflow-x: hidden;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      font-family: 'Noto Sans TC', sans-serif;
  }

  /* Layout */
  #content {
      flex: 1;
      margin-top: var(--header-height);
      width: 100%;
      position: relative;
      transition: opacity 0.3s ease;
  }

  .page-transition {
      opacity: 1;
      transition: opacity 0.3s ease;
  }

  .page-transition.fade-out {
      opacity: 0;
  }

  .page-transition.fade-in {
      opacity: 1;
  }

  /* Header Styles */
  .fixed-header {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      z-index: 1000;
      background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
      height: var(--header-height);
      display: flex;
      align-items: center;
      padding: 0 1rem;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      transition: transform 0.3s ease-in-out;
  }

  .header-hidden {
      transform: translateY(-100%);
  }

  #contentFrame {
      width: 100%;
      height: calc(100vh - var(--header-height));
      border: none;
      position: fixed;
      left: 0;
      top: var(--header-height);
      transition: all 0.3s ease-in-out;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
  }

  #contentFrame.full-screen {
      transform: translateY(calc(-1 * var(--header-height)));
  }

  .loading-indicator {
      position: fixed;
      z-index: 2000;
  }

  .header-logo-title {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 1rem;
      padding-right: 2rem;
      border-right: 2px solid rgba(255, 255, 255, 0.3);
      margin-right: 2rem;
      width: 300px;
      position: relative;
  }

  .header-logo {
      height: 50px;
      margin: 0;
  }

  .header-title {
      color: white;
      margin: 0;
      font-size: 1.8rem;
      font-weight: 600;
      white-space: nowrap;
      text-align: center;
  }

  /* Navigation Button Styles */
  .view-switch {
      display: flex;
      justify-content: space-between;
      /* 改為space-between */
      align-items: center;
      flex: 1;
      margin-left: 0;
      /* 移除原有的 auto */
      padding: 0 1rem;
  }

  .nav-buttons-group {
      display: flex;
      gap: 1rem;
  }


  .nav-switch-btn {
      padding: 0.5rem 1rem;
      border: 2px solid white;
      background: transparent;
      color: white;
      border-radius: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      text-decoration: none;
      transition: all 0.3s ease;
      white-space: nowrap;
  }

  .nav-switch-btn:hover,
  .nav-switch-btn.active {
      background: white;
      color: var(--primary-color);
  }

  /* User Menu Styles */
  .user-menu-container {
      margin-left: auto;
      /* 確保選單靠右 */
  }

  .menu-btn {
      padding: 0.5rem 1rem;
      border: 2px solid rgba(255, 255, 255, 0.8);
      background: transparent;
      color: white;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.4rem;
      font-size: 0.9rem;
      transition: all 0.3s ease;
      white-space: nowrap;
  }

  .menu-btn:hover {
      background: rgba(255, 255, 255, 0.1);
      border-color: white;
  }

  /* Dropdown Menu Styles */
  .menu-dropdown {
      position: absolute;
      top: calc(100% + 0.5rem);
      right: 0;
      background: white;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
      min-width: 200px;
      display: none;
      z-index: 1001;
  }

  .menu-dropdown.show {
      display: block;
  }

  .menu-item {
      padding: 0.8rem 1rem;
      display: flex;
      align-items: center;
      gap: 0.8rem;
      color: var(--text-color);
      text-decoration: none;
      transition: background-color 0.2s ease;
  }

  .menu-item:hover {
      background-color: rgba(0, 0, 0, 0.05);
  }

  .menu-divider {
      height: 1px;
      background-color: rgba(0, 0, 0, 0.1);
      margin: 0.5rem 0;
  }

  .text-danger {
      color: #dc3545 !important;
  }

  /* Logout Button Styles */
  .logout-container {
      position: absolute;
      top: 50%;
      right: 1rem;
      transform: translateY(-50%);
  }

  .logout-btn {
      padding: 0.5rem 1rem;
      border: 2px solid rgba(255, 255, 255, 0.8);
      background: transparent;
      color: white;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.4rem;
      font-size: 0.9rem;
      transition: all 0.3s ease;
      white-space: nowrap;
  }

  .logout-btn:hover {
      background: rgba(255, 255, 255, 0.1);
      border-color: white;
  }

  .logout-btn .logout-text {
      display: inline;
  }

  /* Loading Indicator */
  .loading-indicator {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: rgba(255, 255, 255, 0.9);
      padding: 20px;
      border-radius: 10px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
      display: none;
      z-index: 1000;
  }

  .loading-indicator.show {
      display: block;
  }

  .spinner {
      width: 40px;
      height: 40px;
      border: 4px solid #f3f3f3;
      border-top: 4px solid var(--primary-color);
      border-radius: 50%;
      animation: spin 1s linear infinite;
  }

  /* Animations */
  @keyframes spin {
      0% {
          transform: rotate(0deg);
      }

      100% {
          transform: rotate(360deg);
      }
  }

  /* Mobile Styles */
  @media (max-width: 768px) {
      :root {
          --header-height-mobile: 120px;
      }

      .fixed-header {
          height: var(--header-height-mobile);
          flex-direction: column;
          justify-content: center;
          padding: 0.75rem;
          gap: 0.75rem;
      }

      .header-logo-title {
          width: 100%;
          justify-content: center;
          border-right: none;
          /*           padding-right: 0; */
          margin-right: 0;
          margin-bottom: 0.5rem;
          gap: 0;
      }

      .header-logo {
          height: 35px;
      }

      .header-title {
          font-size: 1.4rem;
      }

      .user-menu-container {
          order: -1;
          position: absolute;
          top: 0.5rem;
          right: 0.5rem;
          margin: 0;
      }

      .menu-btn {
          padding: 0.4rem;
      }

      .menu-text,
      .menu-btn .bi-chevron-down {
          display: none;
      }

      .menu-dropdown {
          right: 0;
      }

      #contentFrame {
          top: var(--header-height-mobile);
      }

      #contentFrame.full-screen {
          transform: translateY(calc(-1 * var(--header-height-mobile)));
      }

      .view-switch {
          flex-direction: column;
          padding: 0;
          width: 100%;
      }

      .nav-buttons-group {
          width: 100%;
          justify-content: center;
          gap: 0.5rem;
      }

      .nav-switch-btn {
          flex: 1;
          max-width: 45%;
      }

      .logout-btn {
          padding: 0.3rem 0.6rem;
          font-size: 0.8rem;
      }

      .logout-btn .bi {
          font-size: 1.1rem;
      }

      .logout-btn .logout-text {
          display: none;
      }

      #content {
          margin-top: var(--header-height-mobile);
      }
  }

  /* Small Screen Styles */
  @media (max-width: 360px) {
      :root {
          --header-height-mobile: 160px;
      }

      .header-title {
          font-size: 1.1rem;
          padding: 0 0.5rem;
      }

      .nav-switch-btn {
          padding: 0.3rem 0.5rem;
          font-size: 0.8rem;
      }
  }

  /* 添加以下樣式 */
  .page-transition {
      transition: opacity 0.3s ease;
  }

  .fade-out {
      opacity: 0;
  }

  .fade-in {
      opacity: 1;
  }

  .update-item {
      border-bottom: 1px solid #eee;
      padding: 15px 0;
  }

  .update-item:last-child {
      border-bottom: none;
  }

  .update-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
  }

  .update-type {
      font-size: 24px;
  }

  .update-title {
      font-weight: 600;
      flex-grow: 1;
  }

  .update-date {
      color: #666;
      font-size: 0.9em;
  }

  .update-content {
      white-space: pre-wrap;
      color: #333;
  }

  .updates-list {
      max-height: 60vh;
      overflow-y: auto;
      padding: 15px;
  }

  #systemUpdateModal .modal-content {
      border-radius: 12px;
  }

  #systemUpdateModal .modal-header {
      background-color: #f8f9fa;
      border-bottom: 1px solid #dee2e6;
      border-radius: 12px 12px 0 0;
  }

  #systemUpdateModal .modal-footer {
      background-color: #f8f9fa;
      border-top: 1px solid #dee2e6;
      border-radius: 0 0 12px 12px;
  }

  #systemUpdateModal .btn-primary {
      background-color: #0d6efd;
      border-color: #0d6efd;
      padding: 8px 24px;
      font-weight: 500;
  }

  #systemUpdateModal .btn-primary:hover {
      background-color: #0b5ed7;
      border-color: #0a58ca;
  }

  /* 添加廣告底部樣式 */
  .ad-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    border-top: 1px solid #eee;
    transition: all 0.3s ease;
  }

  /* 調整iframe高度以適應廣告 */
  #contentFrame.with-ad {
    height: calc(100vh - 60px);
  }

  @media (max-width: 768px) {
      /* 移動設備上的廣告底部樣式 */
      .ad-footer {
        padding: 5px 10px;
      }
      
      #contentFrame.with-ad {
        height: calc(100vh - 45px);
      }
  }