/* 
  ABANGADEKGANTENG - webview.css
  Dedicated styles for Language WebView Shell Pages
*/

:root {
  --webview-toolbar-h: 60px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg-main, #070913);
  color: var(--text-primary, #f8fafc);
  font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.webview-page-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-main, #070913);
}

/* Toolbar Header */
.webview-header-toolbar {
  height: var(--webview-toolbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: rgba(13, 17, 30, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  z-index: 50;
  position: relative;
  gap: 0.5rem;
  direction: ltr !important; /* Keep back on visual left */
}

.webview-nav-group-left,
.webview-nav-group-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.webview-title-container {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-align: center;
  padding: 0 0.5rem;
}

.webview-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  font-size: var(--fs-sm, 0.875rem);
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.webview-title-badge .flag-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.webview-title-badge .lang-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Action Buttons */
.webview-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  min-height: 40px;
  min-width: 40px;
  font-size: var(--fs-sm, 0.875rem);
  font-weight: 600;
  color: var(--text-primary, #f8fafc);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.webview-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.webview-btn:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.15);
}

.webview-btn-primary {
  background: var(--accent-gradient, linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%));
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.webview-btn-primary:hover {
  background: linear-gradient(135deg, #9d74f7 0%, #7578f3 100%);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.45);
}

.webview-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
  flex-shrink: 0;
}

/* Tooltip for Mobile Long-press & Hover */
.webview-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #0f172a;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 100;
}

.webview-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-bottom-color: #0f172a;
}

.webview-btn.show-tooltip .webview-tooltip,
.webview-btn:hover .webview-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Frame Body */
.webview-content-area {
  flex: 1 1 auto;
  position: relative;
  width: 100%;
  height: calc(100% - var(--webview-toolbar-h));
  overflow: hidden;
  background: #070913;
}

.webview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #ffffff;
}

/* Loader */
.webview-loader-overlay {
  position: absolute;
  inset: 0;
  background: #070913;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 20;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.webview-loader-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.webview-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent-primary, #8b5cf6);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.webview-loader-text {
  font-size: var(--fs-sm, 0.875rem);
  color: var(--text-secondary, #94a3b8);
  font-weight: 600;
}

/* Fallback Container if embedding is blocked */
.webview-fallback-container {
  position: absolute;
  inset: 0;
  background: #070913;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  z-index: 30;
  gap: 1.25rem;
}

.webview-fallback-container.active {
  display: flex;
}

.webview-fallback-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--accent-primary, #8b5cf6);
}

.webview-fallback-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  margin: 0;
}

.webview-fallback-desc {
  font-size: 0.9rem;
  color: var(--text-secondary, #94a3b8);
  max-width: 480px;
  line-height: 1.5;
  margin: 0;
}

/* Responsive Behavior */
@media (min-width: 641px) {
  .webview-btn-label {
    display: inline-block;
  }
}

@media (max-width: 640px) {
  .webview-btn-label {
    display: none !important;
  }
  .webview-header-toolbar {
    padding: 0 0.5rem;
  }
  .webview-title-badge {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }
  .webview-btn {
    padding: 0.45rem;
  }
}
