/* Chrome Browser Modal Styles */

.browser-modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  display: none;
}

.browser-modal-overlay.active { display: block; }

.chrome-window {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  animation: chromeOpen 0.2s cubic-bezier(0.05, 0.7, 0.1, 1);
  overflow: hidden;
}

@keyframes chromeOpen {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.chrome-titlebar {
  background: #e8eaed;
  display: flex; flex-direction: column;
  flex-shrink: 0; user-select: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.chrome-header-top {
  display: flex; align-items: stretch;
  justify-content: space-between;
  height: 40px; background: #e8eaed;
  padding-left: 8px;
}

.chrome-tabs-container {
  display: flex; align-items: flex-end;
  flex: 1; gap: 0; height: 100%;
}

.chrome-tab-dropdown-btn,
.chrome-new-tab-btn {
  display: flex; align-items: center;
  justify-content: center; width: 28px;
  height: 28px; background: transparent;
  border: none; cursor: pointer;
  transition: background 0.15s;
  align-self: center; border-radius: 50%;
  margin: 0 2px;
}

.chrome-tab-dropdown-btn svg,
.chrome-new-tab-btn svg {
  width: 14px; height: 14px;
}

.chrome-tab-dropdown-btn:hover,
.chrome-new-tab-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.chrome-tab-active {
  display: flex; align-items: center;
  padding: 0 10px 0 16px; gap: 8px;
  height: 36px; min-width: 220px; max-width: 240px;
  background: #ffffff;
  border-radius: 8px 8px 0 0;
  position: relative; margin-top: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chrome-tab-icon {
  width: 16px; height: 16px;
  flex-shrink: 0; border-radius: 2px;
}

.chrome-tab-title {
  font-size: 12px;
  font-weight: 400;
  color: #202124;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: 0;
}

.chrome-tab-close {
  width: 18px; height: 18px;
  display: flex; align-items: center;
  justify-content: center; cursor: pointer;
  border-radius: 50%; flex-shrink: 0;
  transition: background 0.15s;
  margin-right: -2px;
}

.chrome-tab-close svg {
  width: 9px; height: 9px;
}

.chrome-tab-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.chrome-window-controls {
  display: flex; height: 40px;
  align-items: stretch; flex-shrink: 0;
}

.chrome-control-btn {
  display: flex; align-items: center;
  justify-content: center; width: 46px;
  height: 100%; cursor: pointer;
  transition: background 0.15s;
  border: none; background: transparent;
}

.chrome-control-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.chrome-close-btn:hover {
  background: #e81123 !important;
}

.chrome-close-btn:hover svg path {
  stroke: #ffffff !important;
}

.chrome-toolbar {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  height: 44px;
  background: #ffffff;
  box-sizing: border-box;
  gap: 8px;
}

.chrome-nav-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.chrome-nav-btn {
  width: 32px; height: 32px;
  padding: 0; border: none;
  background: transparent;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.chrome-nav-btn:not(.chrome-nav-btn-disabled):hover {
  background: rgba(0, 0, 0, 0.05);
}

.chrome-nav-btn svg {
  width: 18px;
  height: 18px;
  stroke: #5f6368;
}

.chrome-nav-btn-disabled {
  cursor: default; opacity: 0.4;
}

.chrome-nav-btn[data-action="reload"].spinning svg {
  animation: spinReload 0.6s linear;
}

@keyframes spinReload {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.chrome-search-bar {
  display: flex; align-items: center;
  padding: 0 14px; gap: 8px; flex: 1;
  height: 34px; background: #f1f3f4;
  border: 1px solid transparent;
  border-radius: 18px;
  box-sizing: border-box; min-width: 0;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.chrome-search-bar:hover {
  background: #e8eaed;
  border-color: rgba(0, 0, 0, 0.06);
}

.chrome-lock-icon,
.chrome-star-icon,
.chrome-share-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
}

.chrome-url-text {
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: #202124;
  cursor: text;
  letter-spacing: 0;
}

.chrome-url-dim { color: #202124; }
.chrome-url-path { color: #202124; }

.chrome-search-icons {
  display: flex; align-items: center;
  gap: 4px; flex-shrink: 0;
}

.chrome-star-icon,
.chrome-share-icon {
  width: 20px; height: 20px;
  cursor: pointer; transition: opacity 0.15s;
  padding: 2px; border-radius: 50%;
}

.chrome-star-icon:hover,
.chrome-share-icon:hover {
  background: rgba(0, 0, 0, 0.05);
}

.chrome-right-icons {
  display: flex; align-items: center;
  gap: 2px; flex-shrink: 0;
  margin-left: 4px;
}

.chrome-icon-btn {
  width: 32px; height: 32px;
  padding: 0; border: none;
  background: transparent;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.chrome-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.chrome-icon-btn svg {
  width: 20px; height: 20px;
}

.chrome-profile-btn svg {
  width: 28px; height: 28px;
}

.browser-content {
  flex-grow: 1; background: #ffffff;
  display: flex; flex-direction: column;
  min-height: 0; position: relative;
  overflow: hidden;
}

.browser-content iframe {
  flex-grow: 1; width: 100%;
  height: 100%; border: none;
  display: block; background: #ffffff;
}

.chrome-loading-bar {
  position: absolute; top: 0;
  left: 0; height: 2px;
  background: linear-gradient(90deg, #1a73e8 0%, #1a73e8 70%, transparent 100%);
  width: 0%; z-index: 10;
  display: none;
}

.chrome-loading-bar.loading {
  display: block;
  animation: loadingProgress 1.5s ease-out;
}

@keyframes loadingProgress {
  0% { width: 0%; opacity: 1; }
  70% { width: 80%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

.fake-context-menu {
  position: fixed; background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 4px 0; min-width: 200px;
  z-index: 100000;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
}

.context-item {
  padding: 8px 20px 8px 16px;
  color: #202124; cursor: pointer;
  transition: background 0.1s;
}

.context-item:hover:not(.disabled) {
  background: #f1f3f4;
}

.context-item.disabled {
  color: #5f6368; cursor: default;
}

.context-separator {
  height: 1px; background: #e0e0e0;
  margin: 4px 8px;
}

/* Dark mode via system preference */
/* Realistic tooltips */
.chrome-tooltip {
  position: fixed;
  background: #616161;
  color: white;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100001;
  opacity: 0;
  transition: opacity 0.15s;
  font-family: 'Segoe UI', system-ui, sans-serif;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chrome-tooltip.show {
  opacity: 1;
}

/* SSL verified pulse */
@keyframes ssl-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(0.95); }
}

.chrome-lock-icon.verified {
  animation: ssl-pulse 0.4s ease-out;
}

/* Address bar selection effect */
.chrome-url-text.selected {
  background: #0078d4;
  color: white !important;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 2px;
}

.chrome-url-text.selected * {
  color: white !important;
}

/* Loading shimmer on page change */
.browser-content.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(26, 115, 232, 0.5), transparent);
  animation: page-shimmer 1.5s ease-in-out infinite;
  z-index: 5;
}

@keyframes page-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Bookmark star animation */
.chrome-star-icon.bookmarked path {
  fill: #fbbc04;
  stroke: #fbbc04;
  animation: star-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes star-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Profile button realistic hover */
.chrome-profile-btn {
  border-radius: 50%;
  position: relative;
  overflow: visible;
}

.chrome-profile-btn:hover {
  transform: scale(1.05);
}

/* Tab close button realistic interaction */
.chrome-tab-close:active {
  background: rgba(0, 0, 0, 0.15);
  transform: scale(0.95);
}

@media (prefers-color-scheme: dark) {
  .chrome-window { background: #202124; }
  
  .chrome-titlebar {
    background: #202124;
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
  
  .chrome-header-top { background: #202124; }
  
  .chrome-tab-active {
    background: #292a2d;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  
  .chrome-tab-title { color: #e8eaed; }
  
  .chrome-toolbar { background: #292a2d; }
  
  .chrome-search-bar {
    background: #3c4043;
    border-color: transparent;
  }
  
  .chrome-search-bar:hover {
    background: #414447;
    border-color: rgba(255, 255, 255, 0.06);
  }
  
  .chrome-search-bar:focus-within {
    background: #494c50;
    border-color: rgba(138, 180, 248, 0.4);
    box-shadow: 0 0 0 2px rgba(138, 180, 248, 0.15);
  }
  
  .chrome-url-text { color: #e8eaed; }
  .chrome-url-dim { color: #e8eaed; }
  .chrome-url-path { color: #e8eaed; }
  
  .chrome-tab-close svg path { stroke: #9aa0a6; }
  .chrome-tab-close:hover { background: rgba(255, 255, 255, 0.12); }
  .chrome-tab-close:hover svg path { stroke: #e8eaed; }
  
  .chrome-nav-btn svg path { stroke: #9aa0a6; }
  .chrome-nav-btn:not(.chrome-nav-btn-disabled):hover { background: rgba(255, 255, 255, 0.08); }
  .chrome-nav-btn:not(.chrome-nav-btn-disabled):hover svg path { stroke: #e8eaed; }
  
  .chrome-lock-icon path,
  .chrome-star-icon path,
  .chrome-share-icon path { stroke: #9aa0a6; }
  
  .chrome-icon-btn svg path { fill: #9aa0a6; }
  .chrome-icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
  
  .chrome-control-btn svg path,
  .chrome-control-btn svg line,
  .chrome-control-btn svg rect { stroke: #9aa0a6; }
  
  .chrome-control-btn:hover { background: rgba(255, 255, 255, 0.1); }
  .chrome-control-btn:hover svg path,
  .chrome-control-btn:hover svg line,
  .chrome-control-btn:hover svg rect { stroke: #e8eaed; }
  
  .chrome-new-tab-btn svg path,
  .chrome-tab-dropdown-btn svg path { stroke: #9aa0a6; }
  
  .chrome-tab-dropdown-btn:hover,
  .chrome-new-tab-btn:hover { background: rgba(255, 255, 255, 0.1); }
  
  .chrome-profile-btn svg circle:first-child { fill: #5f6368; }
  .chrome-profile-btn svg circle:nth-child(2),
  .chrome-profile-btn svg path { fill: #202124; }
  
  .fake-context-menu {
    background: #2d2e30;
    border-color: rgba(255, 255, 255, 0.12);
  }
  
  .context-item { color: #e8eaed; }
  .context-item:hover:not(.disabled) { background: rgba(255, 255, 255, 0.08); }
  .context-item.disabled { color: #5f6368; }
  .context-separator { background: rgba(255, 255, 255, 0.08); }
  
  .browser-content { background: #202124; }
  .browser-content iframe { background: #ffffff; }
  
  .chrome-star-icon:hover,
  .chrome-share-icon:hover { background: rgba(255, 255, 255, 0.08); }
  
  .chrome-tooltip {
    background: #737373;
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .chrome-header-top {
    height: 36px;
  }
  
  .chrome-tabs-container {
    gap: 0;
  }
  
  .chrome-tab-active {
    min-width: 140px;
    max-width: 180px;
    height: 32px;
    padding: 0 8px 0 12px;
  }
  
  .chrome-tab-title {
    font-size: 11px;
  }
  
  .chrome-tab-icon {
    width: 14px;
    height: 14px;
  }
  
  .chrome-tab-dropdown-btn,
  .chrome-new-tab-btn {
    width: 24px;
    height: 24px;
  }
  
  .chrome-toolbar {
    padding: 6px 8px;
    height: 40px;
    gap: 6px;
  }
  
  .chrome-nav-buttons {
    gap: 0;
  }
  
  .chrome-nav-btn {
    width: 28px;
    height: 28px;
  }
  
  .chrome-nav-btn svg {
    width: 16px;
    height: 16px;
  }
  
  .chrome-search-bar {
    height: 30px;
    padding: 0 10px;
    gap: 6px;
  }
  
  .chrome-url-text {
    font-size: 12px;
  }
  
  .chrome-lock-icon {
    width: 14px;
    height: 14px;
  }
  
  .chrome-search-icons {
    display: none;
  }
  
  .chrome-right-icons {
    gap: 0;
  }
  
  .chrome-icon-btn {
    width: 28px;
    height: 28px;
  }
  
  .chrome-icon-btn svg {
    width: 18px;
    height: 18px;
  }
  
  .chrome-profile-btn svg {
    width: 24px;
    height: 24px;
  }
  
  .chrome-control-btn {
    width: 40px;
  }
}

@media (max-width: 480px) {
  .chrome-tab-active {
    min-width: 100px;
    max-width: 140px;
  }
  
  .chrome-tab-title {
    font-size: 10px;
  }
  
  .chrome-right-icons button:not(.chrome-profile-btn) {
    display: none;
  }
  
  .chrome-url-text {
    font-size: 11px;
  }
}

/* Light mode profile icon */
@media (prefers-color-scheme: light) {
  .chrome-profile-btn svg circle:first-child {
    fill: #dadce0;
  }
  
  .chrome-profile-btn svg circle:nth-child(2),
  .chrome-profile-btn svg path {
    fill: #5f6368;
  }
}
