/* FLEXIO Fx799VN — 1:1 Desktop Qt5 Replica Stylesheet */

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  margin: 0;
  padding: 16px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 12px;
  background-color: #1e2229;
  color: #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.top-Status-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #2b303b;
  border: 1px solid #3d4452;
  border-radius: 4px;
  padding: 6px 14px;
  margin-bottom: 12px;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   Multi-Tab Switcher Navigation Bar
   ========================================================================== */
#tab-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #2b303b;
  border: 1px solid #3d4452;
  border-radius: 6px;
  padding: 4px;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  user-select: none;
  -webkit-user-select: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #a0aab8;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  outline: none;
  line-height: 1.2;
}

.tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}

.tab-btn:focus-visible {
  outline: 2px solid #0078d7;
  outline-offset: 1px;
}

.tab-btn.active {
  background: #0078d7;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 120, 215, 0.4);
  border-color: #1084e3;
}

.tab-badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  color: #e0e0e0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tab-btn.active .tab-badge {
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
}

.tab-label {
  letter-spacing: 0.3px;
}

.workspace-area {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 24px;
  position: relative;
}

/* Qt5 MainWindow container (default 310x660, 2400:5112 base aspect ratio) */
.qt-window-shell {
  background: #f0f0f0;
  border: 1px solid #888;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  position: relative;
  overflow: hidden;
}

#calculator-frame {
  position: relative;
  width: 310px;
  height: 660px;
  aspect-ratio: 2400 / 5112;
  overflow: hidden;
  background: #ffffff;
  touch-action: none;
}

/* QMenuBar at QRect(0, 0, m_winWidth, 30) */
#menu-bar {
  position: absolute;
  left: 0;
  top: 0;
  width: 310px;
  height: 30px;
  background: #ffffff;
  border-bottom: none;
  display: flex;
  align-items: center;
  padding: 0 2px;
  z-index: 30;
  color: #000000;
}

.menu-item {
  position: relative;
  padding: 5px 8px;
  cursor: default;
  font-size: 12px;
  white-space: nowrap;
}

.menu-item:hover {
  background: #e5f3ff;
  outline: 1px solid #cce8ff;
}

.menu-dropdown {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 150px;
  background: #f2f2f2;
  border: 1px solid #999999;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 100;
  padding: 2px 0;
}

.menu-item:hover .menu-dropdown {
  display: block;
}

.menu-action,
.vnc-menu-action {
  padding: 5px 18px;
  color: #000000;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
}

.menu-action:hover,
.vnc-menu-action:hover {
  background: #91c9f7;
}

.menu-separator,
.vnc-menu-separator {
  height: 1px;
  background: #c8c8c8;
  margin: 3px 2px;
}

/* Skin Canvas (native 2400x5112 backing buffer, locked to 310x660 layout box) */
#skin-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 310px;
  height: 660px;
  z-index: 1;
  pointer-events: none;
  image-rendering: auto;
}

/* Main LCD QLabel Canvas (native 1823x753 backing buffer, locked to 235x97 layout box at 38, 144) */
#lcd-canvas {
  position: absolute;
  left: 38px;
  top: 144px;
  width: 235px;
  height: 97px;
  z-index: 5;
  pointer-events: none;
  image-rendering: auto;
}

/* ==========================================================================
   Tab 1 vs Tab 2 Dynamic Geometry & Layout Adaptation
   ========================================================================== */

/* Tab 1: FLEXIO Fx799VN explicit profile (310x660 window, 2400:5112 ratio) */
#calculator-frame.tab-flexio {
  width: 310px;
  height: 660px;
  aspect-ratio: 2400 / 5112;
}

#calculator-frame.tab-flexio #skin-canvas {
  width: 310px;
  height: 660px;
}

#calculator-frame.tab-flexio #lcd-canvas {
  left: 38px;
  top: 144px;
  width: 235px;
  height: 97px;
}

#calculator-frame.tab-flexio #menu-bar {
  width: 310px;
}

/* Tab 2: VINACAL VNC680EX PLUS III profile (327x660 window, 1921:3869 ratio) */
#calculator-frame.tab-vinacal {
  width: 327px;
  height: 660px;
  aspect-ratio: 1921 / 3869;
}

#calculator-frame.tab-vinacal #skin-canvas {
  width: 327px;
  height: 660px;
}

#calculator-frame.tab-vinacal #lcd-canvas {
  left: 28px;
  top: 86px;
  width: 271px;
  height: 126px;
}

#calculator-frame.tab-vinacal #menu-bar {
  width: 327px;
}

/* 50 ImageButton widgets container */
#buttons-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
}

.calc-image-button {
  position: absolute;
  cursor: pointer; /* Matches ImageButton::enterEvent Qt::PointingHandCursor */
  display: block;
  touch-action: none;
}

/* Right-click Context Menu (ShowContextMenu @ 0x004013E0) */
.qt-context-menu {
  position: fixed;
  min-width: 150px;
  background: #f2f2f2;
  border: 1px solid #999999;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 200;
  padding: 2px 0;
  color: #000000;
  font-size: 12px;
}

/* Pop-up Large LCD Dialog (lcdDialog @ 0x004069D0) */
.qt-dialog-window {
  background: #f0f0f0;
  border: 1px solid #666;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: #000;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 50;
}

.qt-dialog-titlebar {
  height: 28px;
  background: #e1e1e1;
  border-bottom: 1px solid #bbb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-weight: 600;
  color: #111;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.qt-dialog-close {
  border: none;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
  color: #333;
}

.qt-dialog-close:hover {
  background: #e81123;
  color: #fff;
}

/* Modal About Dialog (aboutDlg @ 0x00406430) */
.qt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.qt-about-box {
  width: 340px;
  background: #f0f0f0;
  color: #000;
  border: 1px solid #555;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.qt-about-body {
  padding: 18px 20px;
  white-space: pre-line;
  line-height: 1.5;
  font-size: 12px;
}

.qt-about-footer {
  padding: 8px 16px;
  background: #e5e5e5;
  text-align: right;
  border-top: 1px solid #ccc;
}

.qt-btn {
  padding: 4px 18px;
  border: 1px solid #707070;
  background: #e1e1e1;
  cursor: pointer;
  font-size: 12px;
}

.qt-btn:hover {
  background: #e5f1fb;
  border-color: #0078d7;
}

/* Toast Notification Container */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 400;
  pointer-events: none;
}

.toast-banner {
  background: #107c41;
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  font-weight: 500;
}

.hidden {
  display: none !important;
}
