/* =========================================================
   永慶查詢閘道共用樣式
   檔案：D:\mywebsite\html\yc\css\yc.css
   ========================================================= */

:root {
  --yc-red: #d71920;
  --yc-red-dark: #a90000;
  --yc-gold: #f3c64e;
  --yc-green: #16833b;
  --yc-text: #222222;
  --yc-muted: #666666;
  --yc-border: #dddddd;
  --yc-bg: #f3f5f6;
  --yc-white: #ffffff;
  --yc-shadow: 0 15px 45px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "Microsoft JhengHei",
    "Noto Sans TC",
    Arial,
    sans-serif;
  color: var(--yc-text);
  background:
    radial-gradient(
      circle at top,
      rgba(243, 198, 78, 0.18),
      transparent 35%
    ),
    linear-gradient(145deg, #eef1f2, #dfe4e6);
}

button,
a {
  font: inherit;
}

.yc-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.yc-card {
  width: min(100%, 540px);
  padding: 38px 30px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  box-shadow: var(--yc-shadow);
  text-align: center;
}

.yc-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  min-height: 54px;
  margin-bottom: 22px;
  padding: 10px 22px;
  border-radius: 12px;
  color: #111111;
  background: var(--yc-gold);
  font-size: 25px;
  font-weight: 900;
  letter-spacing: 2px;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.12);
}

.yc-title {
  margin: 0 0 12px;
  font-size: clamp(28px, 6vw, 38px);
  line-height: 1.3;
}

.yc-description {
  margin: 0;
  color: var(--yc-muted);
  font-size: 17px;
  line-height: 1.8;
}

.yc-status {
  margin: 28px 0 20px;
  padding: 15px;
  border-radius: 12px;
  background: #f3f3f3;
  font-size: 19px;
  font-weight: 800;
}

.yc-status.is-loading {
  color: #555555;
}

.yc-status.is-available {
  color: var(--yc-green);
  background: rgba(22, 131, 59, 0.1);
}

.yc-status.is-busy,
.yc-status.is-error {
  color: var(--yc-red-dark);
  background: rgba(215, 25, 32, 0.1);
}

.yc-button {
  display: inline-flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 13px;
  padding: 14px 20px;
  color: var(--yc-white);
  background: linear-gradient(
    180deg,
    var(--yc-red),
    var(--yc-red-dark)
  );
  font-size: 19px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(169, 0, 0, 0.25);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
}

.yc-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 11px 22px rgba(169, 0, 0, 0.3);
}

.yc-button:active {
  transform: translateY(1px);
}

.yc-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.yc-button-secondary {
  margin-top: 13px;
  color: #333333;
  background: #eeeeee;
  box-shadow: none;
}

.yc-button-secondary:hover {
  background: #e3e3e3;
  box-shadow: none;
}

.yc-message {
  margin: 22px 0;
  color: var(--yc-muted);
  font-size: 17px;
  line-height: 1.8;
}

.yc-busy-title {
  margin: 0 0 15px;
  color: var(--yc-red-dark);
  font-size: clamp(38px, 9vw, 58px);
}

.yc-spinner {
  width: 42px;
  height: 42px;
  margin: 20px auto;
  border: 5px solid #e2e2e2;
  border-top-color: var(--yc-red);
  border-radius: 50%;
  animation: yc-spin 0.8s linear infinite;
}

@keyframes yc-spin {
  to {
    transform: rotate(360deg);
  }
}

.yc-home-link {
  display: inline-block;
  margin-top: 20px;
  color: #555555;
  font-weight: 700;
  text-decoration: none;
}

.yc-home-link:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .yc-page {
    padding: 16px;
  }

  .yc-card {
    padding: 30px 20px;
    border-radius: 18px;
  }

  .yc-logo {
    min-width: 150px;
    font-size: 22px;
  }

}

/* =========================================================
   YC Remote Browser Viewer
   ========================================================= */

[hidden] {
  display: none !important;
}

.yc-viewer-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  overflow-x: hidden;
  flex-direction: column;
  background: #eceff1;
}

.yc-viewer-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 15px;
  min-height: clamp(60px, 8vh, 76px);
  padding:
    clamp(10px, 1.5vw, 16px)
    clamp(14px, 2.5vw, 28px);
  background: var(--yc-white);
  border-bottom: 1px solid var(--yc-border);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08);
}

.yc-viewer-header strong {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.25;
}

.yc-viewer-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--yc-muted);
  font-size: clamp(12px, 1.2vw, 14px);
  line-height: 1.4;
}

.yc-finish-button {
  width: auto;
  min-width: 112px;
  min-height: 44px;
  flex: 0 0 auto;
  padding: 10px 18px;
  font-size: 16px;
}

.yc-viewer-main {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  padding: clamp(10px, 2vw, 22px);
}

.yc-viewer-panel {
  width: min(100%, 1480px);
  min-height: calc(100vh - 110px);
  min-height: calc(100dvh - 110px);
  display: flex;
  margin: 0 auto;
  flex-direction: column;
  padding: clamp(10px, 1.5vw, 20px);
  background: var(--yc-white);
  border-radius: 14px;
  box-shadow: var(--yc-shadow);
}

.yc-session-info {
  flex: 0 0 auto;
  margin: 0 0 clamp(10px, 1.5vw, 14px);
  padding: 10px 14px;
  border-radius: 10px;
  color: #555555;
  background: #f3f3f3;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}

.yc-screen-shell {
  position: relative;
  min-width: 0;
  min-height: clamp(280px, 62vh, 860px);
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
}

.yc-screen-stage {
  position: relative;
  min-width: 0;
  min-height: clamp(280px, 62vh, 860px);
  display: block;
  flex: 1 1 auto;
  overflow: auto;
  cursor: default;
  border: 1px solid #c8cdd0;
  border-radius: 10px;
  background: #1d2023;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.yc-remote-scrollbar {
  position: relative;
  width: 14px;
  min-width: 14px;
  height: 100%;
  flex: 0 0 14px;
  border-top: 1px solid #c8cdd0;
  border-right: 1px solid #c8cdd0;
  border-bottom: 1px solid #c8cdd0;
  background: #f1f1f1;
  cursor: default;
  touch-action: none;
  user-select: none;
}

.yc-remote-scrollbar[hidden] {
  display: none !important;
}

.yc-remote-scrollbar-thumb {
  position: absolute;
  top: 0;
  right: 2px;
  left: 2px;
  min-height: 32px;
  border: 1px solid #8b8b8b;
  border-radius: 8px;
  background: #b8b8b8;
  cursor: pointer;
}

.yc-remote-scrollbar:hover .yc-remote-scrollbar-thumb,
.yc-remote-scrollbar:focus-visible .yc-remote-scrollbar-thumb,
.yc-remote-scrollbar.is-dragging .yc-remote-scrollbar-thumb {
  background: #969696;
}

.yc-viewer-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 24px;
  color: #ffffff;
  cursor: default;
  text-align: center;
}

.yc-viewer-loading .yc-spinner {
  margin: 0 auto 8px;
  animation: yc-spin 0.8s linear infinite;
}

.yc-screen-wrap {
  width: max-content;
  min-width: 100%;
  height: max-content;
  min-height: clamp(280px, 62vh, 860px);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  overflow: visible;
  cursor: default;
  line-height: 0;
  background: #111111;
}

.yc-browser-screen {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

.yc-viewer-controls {
  flex: 0 0 auto;
  margin-top: clamp(10px, 1.5vw, 16px);
  padding: clamp(12px, 1.5vw, 16px);
  border: 1px solid var(--yc-border);
  border-radius: 10px;
  background: #f7f8f8;
}

.yc-control-label {
  display: block;
  margin-bottom: 8px;
  color: #444444;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
}

.yc-text-control {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.yc-text-input {
  min-width: 0;
  min-height: 44px;
  flex: 1 1 auto;
  padding: 9px 12px;
  border: 1px solid #b8bec2;
  border-radius: 8px;
  background: #ffffff;
  font: inherit;
  line-height: 1.4;
}

.yc-text-input:focus {
  border-color: var(--yc-red);
  outline: 3px solid rgba(215, 25, 32, 0.14);
}

.yc-key-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.yc-control-button {
  min-height: 44px;
  border: 1px solid #aeb4b8;
  border-radius: 8px;
  padding: 8px 16px;
  color: #222222;
  background: #ffffff;
  font-weight: 800;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.yc-control-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.yc-control-button-primary {
  border-color: var(--yc-red-dark);
  color: #ffffff;
  background: var(--yc-red);
}

.yc-control-button:hover:not(:disabled) {
  border-color: #92999e;
  background: #e9ecee;
}

.yc-control-button-primary:hover:not(:disabled) {
  border-color: var(--yc-red-dark);
  background: var(--yc-red-dark);
}

.yc-finish-button:active:not(:disabled),
.yc-control-button:active:not(:disabled) {
  transform: translateY(1px);
}

.yc-finish-button:focus-visible,
.yc-control-button:focus-visible,
.yc-text-input:focus-visible {
  outline: 3px solid rgba(215, 25, 32, 0.22);
  outline-offset: 2px;
}

.yc-viewer-hint {
  margin: 10px 0 0;
  color: var(--yc-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Desktop */
@media (min-width: 1024px) {
  .yc-viewer-panel {
    min-height: calc(100vh - 112px);
    min-height: calc(100dvh - 112px);
  }

  .yc-text-control {
    flex-direction: row;
  }

  .yc-control-button {
    min-width: 96px;
  }
}

/* YC Viewer fullscreen layout */
html,
.yc-viewer-body {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.yc-viewer-body {
  min-height: 0;
  background: #111111;
}

.yc-viewer-header {
  min-height: 52px;
  gap: 12px;
  padding: 6px 12px;
  box-shadow: none;
}

.yc-viewer-header strong {
  font-size: clamp(15px, 1.8vw, 20px);
}

.yc-viewer-subtitle {
  display: none;
}

.yc-viewer-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.yc-session-info {
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yc-home-button,
.yc-finish-button {
  width: auto;
  min-width: 88px;
  min-height: 38px;
  padding: 7px 12px;
  font-size: 14px;
}

.yc-viewer-main,
.yc-viewer-panel,
.yc-screen-stage,
.yc-screen-wrap {
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.yc-viewer-main {
  height: 100%;
  padding: 0;
  overflow: hidden;
}

.yc-viewer-panel {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
}

.yc-screen-stage {
  height: 100%;
  border: 0;
  border-radius: 0;
  overflow: auto;
  background: #ffffff;
}

.yc-screen-wrap {
  width: max-content;
  min-width: 100%;
  height: max-content;
  min-height: 100%;
  overflow: visible;
  background: #ffffff;
}

.yc-browser-screen {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  flex-shrink: 0;
  image-rendering: auto;
}

.yc-viewer-controls,
.yc-viewer-debug,
[data-viewer-debug] {
  display: none !important;
}

@media (max-width: 600px) {
  .yc-viewer-header {
    min-height: 48px;
    align-items: center;
    flex-direction: row;
    gap: 6px;
    padding: 5px 6px;
  }

  .yc-viewer-header > div:first-child {
    display: none;
  }

  .yc-viewer-actions {
    width: 100%;
  }

  .yc-session-info {
    flex: 1 1 auto;
    font-size: 11px;
  }

  .yc-viewer-header .yc-button,
  .yc-home-button,
  .yc-finish-button {
    width: auto;
    min-width: 76px;
    min-height: 36px;
    padding: 6px 8px;
    font-size: 12px;
  }
}

/* Tablet */
@media (min-width: 601px) and (max-width: 1023px) {
  .yc-viewer-main {
    padding: 14px;
  }

  .yc-viewer-panel {
    min-height: calc(100vh - 100px);
    min-height: calc(100dvh - 100px);
  }

  .yc-screen-shell,
  .yc-screen-stage,
  .yc-screen-wrap {
    min-height: clamp(300px, 58vh, 700px);
  }

}

/* Mobile */
@media (max-width: 600px) {
  .yc-viewer-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
  }

  .yc-viewer-header .yc-button {
    width: 100%;
  }

  .yc-finish-button {
    width: 100%;
    min-height: 44px;
  }

  .yc-viewer-main {
    padding: 8px;
  }

  .yc-viewer-panel {
    min-height: calc(100vh - 126px);
    min-height: calc(100dvh - 126px);
    padding: 8px;
    border-radius: 10px;
  }

  .yc-session-info {
    margin-bottom: 8px;
    font-size: 13px;
  }

  .yc-screen-shell,
  .yc-screen-stage,
  .yc-screen-wrap {
    min-height: clamp(220px, 48vh, 520px);
  }


  .yc-viewer-controls {
    margin-top: 8px;
    padding: 10px;
  }

  .yc-text-control {
    flex-direction: column;
  }

  .yc-text-input,
  .yc-control-button {
    width: 100%;
    min-height: 44px;
  }

  .yc-key-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .yc-viewer-hint {
    font-size: 12px;
  }
}

/* Viewer resize-safe height chain */
.yc-viewer-header {
  flex-shrink: 0;
}

.yc-viewer-main {
  height: auto;
  min-height: 0;
  flex: 1 1 0;
}

.yc-viewer-panel,
.yc-screen-shell,
.yc-screen-stage {
  height: 100%;
  min-height: 0;
}

@media (hover: none) and (pointer: coarse) {
  .yc-remote-scrollbar {
    display: none !important;
  }
}

/* Desktop: keep only the remote screen's horizontal scrollbar. */
@media (hover: hover) and (pointer: fine) {
  .yc-screen-stage {
    overflow-x: auto;
    overflow-y: hidden;
  }
}

/* Navigation is handled by the browser's Back button. */
.yc-viewer-header {
  display: none !important;
}

.yc-text-context-menu {
  position: fixed;
  z-index: 2147483647;
  min-width: 132px;
  padding: 6px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.yc-text-context-menu[hidden] {
  display: none !important;
}

.yc-text-context-menu button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #111827;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.yc-text-context-menu button:hover,
.yc-text-context-menu button:focus-visible {
  background: #f3f4f6;
}
