/* ==========================================================================
   Google Keyboard (Gboard) Authentic Styling for Sindhi & English Keyboard
   ========================================================================== */

.sindhi-vk-container.gboard-style {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  background: #eceff1;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 -3px 18px rgba(0, 0, 0, 0.16);
  padding: 0.25rem 0.25rem max(0.35rem, env(safe-area-inset-bottom)) 0.25rem;
  transition: transform 0.2s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.18s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  max-width: 680px;
  margin: 0 auto;
}

[data-bs-theme="dark"] .sindhi-vk-container.gboard-style {
  background: #1e1e24;
  border-top: 1px solid #33333d;
  box-shadow: 0 -3px 20px rgba(0, 0, 0, 0.4);
}

.sindhi-vk-container.hidden {
  transform: translateY(105%);
  opacity: 0;
  pointer-events: none;
}

/* Keyboard Action Header */
.sindhi-vk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.15rem 0.4rem 0.25rem 0.4rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .sindhi-vk-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sindhi-vk-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: #1a73e8;
  display: flex;
  align-items: center;
  font-family: var(--font-ui), var(--font-sindhi);
}

[data-bs-theme="dark"] .sindhi-vk-title {
  color: #8ab4f8;
}

.sindhi-vk-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.sindhi-vk-btn-action {
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text-main);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
}

[data-bs-theme="dark"] .sindhi-vk-btn-action {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e8eaed;
}

.sindhi-vk-btn-action:hover {
  background: #1a73e8;
  color: #ffffff;
  border-color: #1a73e8;
}

/* Upward Layout Picker Popup */
.sindhi-vk-layout-picker {
  position: relative;
}

.sindhi-vk-layout-popup {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.22);
  z-index: 1099;
  min-width: 220px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  animation: layoutPopupSlide 0.15s ease-out;
}

[data-bs-theme="dark"] .sindhi-vk-layout-popup {
  background: #23242b;
  border-color: #3e404d;
  box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.5);
}

@keyframes layoutPopupSlide {
  0% { transform: translateY(6px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.sindhi-vk-layout-popup.hidden {
  display: none !important;
}

.sindhi-vk-layout-popup-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: #70757a;
  padding: 0.25rem 0.6rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  text-align: right;
  font-family: var(--font-ui), var(--font-sindhi);
}

[data-bs-theme="dark"] .sindhi-vk-layout-popup-header {
  color: #9aa0a6;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.sindhi-vk-layout-item {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  text-align: right;
  color: #202124;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  transition: all 0.12s ease;
  font-family: var(--font-ui), var(--font-sindhi);
}

[data-bs-theme="dark"] .sindhi-vk-layout-item {
  color: #e8eaed;
}

.sindhi-vk-layout-item .layout-check {
  display: none;
  font-size: 1rem;
}

.sindhi-vk-layout-item.active {
  background: #1a73e8 !important;
  color: #ffffff !important;
  font-weight: 700;
}

.sindhi-vk-layout-item.active .layout-check {
  display: inline-block;
}

.sindhi-vk-layout-item:hover:not(.active) {
  background: rgba(0, 0, 0, 0.06);
}

[data-bs-theme="dark"] .sindhi-vk-layout-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
}

.sindhi-vk-layout-popup-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 0.15rem 0;
}

[data-bs-theme="dark"] .sindhi-vk-layout-popup-divider {
  background: rgba(255, 255, 255, 0.08);
}

.sindhi-vk-btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.15rem 0.35rem;
  border-radius: 50%;
  cursor: pointer;
}

.sindhi-vk-btn-close:hover {
  color: #dc3545;
}

/* Keyboard Body & Rows */
.sindhi-vk-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 100%;
}

.sindhi-vk-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
}

/* Gboard Keycaps */
.sindhi-vk-key {
  position: relative;
  flex: 1 1 0;
  height: 42px;
  min-width: 0;
  background: #ffffff;
  color: #202124;
  border: none;
  border-radius: 5px;
  font-family: var(--font-sindhi), var(--font-ui), sans-serif;
  font-size: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  transition: background-color 0.06s ease, transform 0.06s ease;
  padding: 0;
  margin: 0;
  line-height: 1;
}

[data-bs-theme="dark"] .sindhi-vk-key {
  background: #2d2e38;
  color: #f1f3f4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.sindhi-vk-key .key-main {
  font-weight: 600;
  font-size: 1.2rem;
}

.sindhi-vk-key .key-sub {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 0.55rem;
  color: #70757a;
  opacity: 0.7;
}

[data-bs-theme="dark"] .sindhi-vk-key .key-sub {
  color: #9aa0a6;
}

.sindhi-vk-key .key-hint-en {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  font-family: var(--font-ui), system-ui, sans-serif;
  color: #70757a;
  opacity: 0.75;
  text-transform: uppercase;
  pointer-events: none;
}

[data-bs-theme="dark"] .sindhi-vk-key .key-hint-en {
  color: #9aa0a6;
}

.sindhi-vk-key .key-hint-shift {
  position: absolute;
  top: 0px;
  right: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #0d6efd;
  opacity: 0.85;
  font-family: var(--font-sindhi);
  pointer-events: none;
}

[data-bs-theme="dark"] .sindhi-vk-key .key-hint-shift {
  color: #6ea8fe;
}

/* Key Active / Pressed Feedback */
.sindhi-vk-key:active,
.sindhi-vk-key.key-pressed {
  background: #1a73e8 !important;
  color: #ffffff !important;
  transform: translateY(1.5px);
  box-shadow: none;
}

.sindhi-vk-key.key-pressed-hardware {
  background: #1a73e8 !important;
  color: #ffffff !important;
  transform: translateY(2px) scale(0.96);
  box-shadow: 0 0 10px rgba(26, 115, 232, 0.7) !important;
  border-color: #1a73e8 !important;
  transition: all 0.05s ease;
}

.sindhi-vk-key:active .key-sub,
.sindhi-vk-key.key-pressed .key-sub,
.sindhi-vk-key.key-pressed-hardware .key-sub {
  color: rgba(255, 255, 255, 0.8) !important;
}

/* Function Keys in Gboard (Shift, Backspace, Enter, Globe, Space) */
.sindhi-vk-key.key-func {
  background: #dcdfe3;
  color: #3c4043;
  font-size: 0.95rem;
  flex: 1.35 1 0;
}

[data-bs-theme="dark"] .sindhi-vk-key.key-func {
  background: #23242b;
  color: #e8eaed;
}

.sindhi-vk-key.key-shift.active-shift {
  background: #1a73e8 !important;
  color: #ffffff !important;
}

.sindhi-vk-key.key-globe {
  flex: 1.1 1 0;
  font-size: 0.78rem;
  display: flex;
  flex-direction: row;
  gap: 0.2rem;
  font-weight: 600;
}

.sindhi-vk-key.key-space {
  flex: 4 1 0;
  font-size: 0.82rem;
  color: #5f6368;
  font-family: var(--font-ui), var(--font-sindhi);
}

[data-bs-theme="dark"] .sindhi-vk-key.key-space {
  color: #bdc1c6;
}

.sindhi-vk-key.key-enter {
  background: #1a73e8;
  color: #ffffff;
  flex: 1.4 1 0;
}

.sindhi-vk-key.key-enter:hover {
  background: #1557b0;
}

/* Floating Long Press Popup */
.sindhi-vk-popup {
  position: fixed;
  z-index: 1099;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
  display: flex;
  gap: 0.2rem;
  padding: 0.25rem;
  animation: gboardPopup 0.1s ease-out;
  max-width: calc(100vw - 16px);
  overflow-x: auto;
}

[data-bs-theme="dark"] .sindhi-vk-popup {
  background: #2d2e38;
  border-color: #444452;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.6);
}

@keyframes gboardPopup {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.sindhi-vk-popup-item {
  min-width: 36px;
  height: 38px;
  background: #f1f3f4;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 5px;
  font-family: var(--font-sindhi);
  font-size: 1.25rem;
  color: #202124;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0 0.35rem;
  transition: all 0.08s ease;
  user-select: none;
}

[data-bs-theme="dark"] .sindhi-vk-popup-item {
  background: #1e1e24;
  border-color: #383944;
  color: #f1f3f4;
}

.sindhi-vk-popup-item:hover,
.sindhi-vk-popup-item:active,
.sindhi-vk-popup-item.active {
  background: #1a73e8 !important;
  color: #ffffff !important;
  border-color: #1a73e8 !important;
  transform: scale(1.08);
}

/* Page Push Up on Active Virtual Keyboard */
body.sindhi-vk-active {
  padding-bottom: 240px !important;
}

body.sindhi-vk-active main {
  padding-bottom: 245px !important;
}

body.sindhi-vk-active .editor-sync-box {
  height: calc(100dvh - 435px) !important;
  min-height: 180px !important;
}

body.sindhi-vk-active .mobile-bottom-bar {
  display: none !important;
}
