@import url('/shared/css/shared-styles.css');

/* ═══════════════════════════════════════════════════
   Browser Beekeeper — Styles
   Dark theme with glassmorphism, matching Virtastic-Web aesthetic
   ═══════════════════════════════════════════════════ */

/* ── Reset & Base ───────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111119;
  --bg-card: rgb(20, 20, 32, 0.85);
  --bg-glass: rgb(18, 18, 28, 0.75);
  --bg-input: rgb(30, 30, 48, 0.9);
  --bg-hover: rgb(99, 102, 241, 0.1);
  --text-primary: #e4e4ef;
  --text-secondary: #8b8ba0;
  --text-muted: #5a5a72;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-dim: rgb(99, 102, 241, 0.15);
  --accent-glow: rgb(99, 102, 241, 0.25);
  --danger: #ef4444;
  --danger-hover: #f87171;
  --success: #22c55e;
  --warning: #f59e0b;
  --border: rgb(255, 255, 255, 0.06);
  --border-accent: rgb(99, 102, 241, 0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --font: 'Inter', -apple-system, blinkmacsystemfont, 'Segoe UI', sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 8px 32px rgb(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgb(0, 0, 0, 0.6);
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ── Login View ────────────────────────────────── */
.view {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, var(--accent-dim) 0%, transparent 50%), var(--bg-primary);
  z-index: 500;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 4px 24px rgb(0, 0, 0, 0.4),
    0 0 40px var(--accent-dim);
  backdrop-filter: blur(20px);
}

/* ── Login Logo ────────────────────────────────── */
.login-logo {
  margin-bottom: 0.5rem;
}

.login-logo img {
  width: 120px;
  height: 120px;
  filter: drop-shadow(0 0 16px var(--accent-glow));
}

.login-logo svg {
  width: 48px;
  height: 48px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.login-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.login-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  color: #1f1f1f;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.login-provider-btn:hover {
  background: #f8f9fa;
  border-color: #c0c4c9;
  box-shadow: 0 1px 3px rgb(0, 0, 0, 0.1);
}

/* ── Header ─────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-center {
  flex: 1;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.header-btn svg {
  width: 16px;
  height: 16px;
}

.header-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-accent);
}

.header-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--border-accent);
}

.header-btn-danger:hover {
  color: var(--danger);
  border-color: rgb(239, 68, 68, 0.3);
  background: rgb(239, 68, 68, 0.08);
}

.header-btn-warning:hover {
  color: var(--warning);
  border-color: rgb(245, 158, 11, 0.3);
  background: rgb(245, 158, 11, 0.08);
}

/* ── Main Content ───────────────────────────────── */
main {
  height: calc(100vh - 52px);
  position: relative;
}

/* ── VNC Viewport ────────────────────────────────── */
.vnc-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
  overflow: hidden;
}

.vnc-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.vnc-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 10;
}

.vnc-loading p {
  color: var(--text-secondary);
  margin-top: 16px;
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Connection failed screen ────────────────────── */
.connection-failed {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, var(--accent-dim) 0%, transparent 60%), var(--bg-primary);
  z-index: 11;
  text-align: center;
  padding: 40px;
  animation: cf-fade-in 0.4s ease;
}

@keyframes cf-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.connection-failed.hidden {
  display: none;
}

.cf-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 4px 24px rgb(0, 0, 0, 0.4),
    0 0 40px var(--accent-dim);
  backdrop-filter: blur(20px);
}

.cf-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 12px;
  animation: cf-pulse 2.5s ease-in-out infinite;
}

@keyframes cf-pulse {
  0%,
  100% {
    opacity: 0.7;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.cf-title {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cf-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
  max-width: 280px;
}

.cf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgb(99, 102, 241, 0.35);
}

.cf-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgb(99, 102, 241, 0.45);
}

.cf-btn:active {
  transform: translateY(0);
}

.cf-btn svg {
  flex-shrink: 0;
}

.cf-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  margin-top: 8px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ── Context Menu ────────────────────────────────── */
.context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
}

.context-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  border-radius: var(--radius-xs);
  text-align: left;
  transition: background var(--transition);
}

.context-menu button:hover {
  background: var(--bg-hover);
}

.context-menu button svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ── Upload Dialog ───────────────────────────────── */
.upload-dialog {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 300;
}

.upload-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.upload-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text-secondary);
}

.upload-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  background: var(--bg-input);
}

.upload-status.success {
  color: var(--success);
}

.upload-status.error {
  color: var(--danger);
}

.btn-secondary {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-accent);
}

/* ── Notifications ───────────────────────────────── */
.notification-container {
  position: fixed;
  top: 64px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.notification {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.notification.show {
  transform: translateX(0);
}

.notification.error {
  border-color: rgb(239, 68, 68, 0.3);
}

.notification.success {
  border-color: rgb(34, 197, 94, 0.3);
}

/* ── Responsive ──────────────────────────────────── */
@media (width <= 768px) {
  header {
    padding: 0 12px;
  }

  .header-btn span {
    display: none;
  }
}

/* ── Fullscreen Mode ────────────────────────────── */
header {
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.fullscreen-mode #app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

body.fullscreen-mode main {
  height: 100vh;
}

body.fullscreen-mode #app-header.header-peek {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  z-index: 150;
}

.fullscreen-reveal-tab {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 5px;
  background: rgb(99, 102, 241, 0.5);
  border-radius: 0 0 6px 6px;
  cursor: pointer;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    height 0.2s ease,
    background 0.2s ease;
}

body.fullscreen-mode .fullscreen-reveal-tab {
  opacity: 1;
  pointer-events: auto;
}

.fullscreen-reveal-tab:hover {
  height: 8px;
  background: rgb(99, 102, 241, 0.8);
}

/* ── Header Icon (img support) ──────────────────── */
.header-icon {
  object-fit: contain;
  border-radius: 4px;
}

/* ── Login SSO Buttons ──────────────────────────── */
.google-button,
.microsoft-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font);
  color: #3c4043;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.google-button:hover,
.microsoft-button:hover {
  background: #f8f9fa;
  border-color: #c0c4c9;
  box-shadow: 0 1px 3px rgb(0, 0, 0, 0.1);
}

.google-icon,
.microsoft-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
