/* ==========================================================================
   CloudBrowser - Pure Monochrome Minimalist Theme (Black & White Aesthetics)
   ========================================================================== */

:root {
  --bg-deep: #000000;
  --bg-surface: #0a0a0a;
  --bg-card: #111111;
  --bg-input: #161616;
  --bg-hover: #1f1f1f;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-bright: rgba(255, 255, 255, 0.35);
  
  --text-pure: #ffffff;
  --text-muted: #888888;
  --text-faint: #555555;
  
  --accent-white: #ffffff;
  --accent-black: #000000;
  
  --header-height: 52px;
  --bookmarks-height: 38px;
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-pure);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: -0.01em;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. Minimalist Login Wall (Auth Interceptor)
   ========================================================================== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 30%, #111111 0%, #000000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.03);
  animation: authCardIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-badge {
  width: 52px;
  height: 52px;
  background: #141414;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: var(--text-pure);
  font-size: 24px;
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-pure);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 46px;
  transition: all var(--transition-fast);
}

.auth-input-wrapper:focus-within {
  border-color: var(--text-pure);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
  background: #1a1a1a;
}

.auth-input-icon {
  color: var(--text-muted);
  font-size: 18px;
  margin-right: 10px;
}

#auth-password {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-pure);
  font-size: 14px;
  letter-spacing: 0.05em;
  font-family: inherit;
}

#auth-password::placeholder {
  color: var(--text-faint);
  letter-spacing: normal;
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: color var(--transition-fast);
}

.btn-icon-subtle:hover {
  color: var(--text-pure);
}

.auth-error-msg {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 80, 80, 0.3);
  color: #ff6b6b;
  font-size: 12.5px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-align: left;
  line-height: 1.4;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.auth-footer {
  margin-top: 28px;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ==========================================================================
   2. Main Workspace Layout
   ========================================================================== */
.browser-layout {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-deep);
}

/* ---------------- Top Header ---------------- */
#browser-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-pure);
  user-select: none;
}

.brand-glyph {
  font-size: 18px;
  display: flex;
  align-items: center;
}

.brand-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.control-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.control-btn:hover {
  background: var(--bg-hover);
  color: var(--text-pure);
}

.control-btn:active {
  transform: scale(0.94);
}

/* ---------------- Omnibox / Address Bar ---------------- */
.header-center {
  flex: 1;
  max-width: 860px;
  min-width: 240px;
}

.omnibox-form {
  width: 100%;
}

.omnibox {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  height: 36px;
  padding: 0 4px 0 14px;
  transition: all var(--transition-fast);
}

.omnibox:focus-within {
  border-color: var(--text-pure);
  background: #141414;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.omnibox-prefix {
  display: flex;
  align-items: center;
  margin-right: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

#url-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-pure);
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
}

#url-input::placeholder {
  color: var(--text-faint);
}

.omnibox-suffix {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.btn-clear:hover {
  color: var(--text-pure);
  background: var(--bg-hover);
}

.btn-go {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-white);
  color: var(--accent-black);
  border: none;
  outline: none;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-go:hover {
  background: #e2e2e2;
}

.btn-go:active {
  transform: scale(0.96);
}

/* ---------------- Right Action Cluster ---------------- */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.action-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-pill i {
  font-size: 14px;
}

.action-pill:hover {
  background: var(--bg-hover);
  color: var(--text-pure);
  border-color: var(--border-medium);
}

.logout-btn {
  padding: 0 10px;
  color: var(--text-muted);
}

.logout-btn:hover {
  color: #ff6b6b;
  border-color: rgba(255, 80, 80, 0.4);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 11.5px;
  color: var(--text-muted);
  user-select: none;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.status-indicator.connecting .status-dot {
  background: #888;
  box-shadow: 0 0 4px #888;
}

.status-indicator.disconnected .status-dot {
  background: #555;
  box-shadow: none;
}

/* ---------------- Bookmarks Ribbon ---------------- */
#bookmarks-bar {
  height: var(--bookmarks-height);
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  font-size: 12px;
  flex-shrink: 0;
  overflow-x: auto;
}

#bookmarks-bar::-webkit-scrollbar {
  display: none;
}

.bookmarks-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.bookmarks-title {
  color: var(--text-faint);
  font-size: 11.5px;
  white-space: nowrap;
  margin-right: 2px;
}

.bookmark-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.bookmark-tag i {
  font-size: 13px;
}

.bookmark-tag:hover {
  background: var(--bg-card);
  color: var(--text-pure);
  border-color: var(--border-medium);
}

.security-ribbon-tag {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-faint);
  font-size: 11px;
  white-space: nowrap;
  margin-left: auto;
}

.security-ribbon-tag i {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------------- Viewport Stage ---------------- */
#viewport-container {
  flex: 1;
  position: relative;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#vnc-canvas-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen canvas {
  display: block;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
  max-width: 100%;
  max-height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ---------------- Loader & Overlays ---------------- */
#loading-overlay, #error-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.3s ease;
}

.minimal-loader-box {
  text-align: center;
  padding: 36px 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 380px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
}

.minimal-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--text-pure);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 18px auto;
}

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

.minimal-loader-box h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-pure);
}

.minimal-loader-box p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.error-icon {
  font-size: 38px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: inline-block;
}

.error-box button {
  margin-top: 18px;
}

/* ==========================================================================
   3. Common Buttons & Modals
   ========================================================================== */
.btn-solid-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-white);
  color: var(--accent-black);
  border: none;
  outline: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.btn-solid-white:hover {
  background: #eaeaea;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.15);
}

.btn-solid-white:active {
  transform: scale(0.98);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-pure);
  border: 1px solid var(--border-medium);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-bright);
}

/* Modal Dialog */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
}

.modal-title-group i {
  font-size: 17px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
}

.modal-close:hover {
  color: var(--text-pure);
}

.modal-body {
  padding: 20px;
}

.modal-description {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

#clipboard-text {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-pure);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12.5px;
  resize: vertical;
  margin-bottom: 14px;
  outline: none;
  line-height: 1.4;
}

#clipboard-text:focus {
  border-color: var(--text-pure);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-actions button {
  width: auto;
}

.clipboard-status-hint {
  margin-top: 10px;
  font-size: 12px;
  min-height: 16px;
  text-align: right;
  color: #a3a3a3;
}
