/* ============================================================
   Random Website — custom styles
   Tailwind (via CDN, loaded in index.html) provides layout
   utilities; everything visually distinctive — tokens, glass
   panels, the neon logo, spinner, overlays — lives here.
   ============================================================ */

:root{
  /* ---- design tokens : dark (default) ---- */
  --bg:             #090C14;
  --surface:        rgba(255,255,255,0.055);
  --surface-strong: rgba(255,255,255,0.09);
  --border:         rgba(255,255,255,0.10);
  --text:           #E9EBF5;
  --text-muted:     #8991AC;
  --accent:         #8B6CFF;   /* violet — Random DB */
  --accent-2:       #22D3EE;   /* cyan   — status/links */
  --accent-3:       #FF8A3D;   /* amber  — Random Any   */
  --danger:         #FB7185;
}

*{ box-sizing: border-box; }

html, body{ height: 100%; margin: 0; }

body{
  background:
    radial-gradient(circle at 12% 0%, rgba(139,108,255,0.16), transparent 42%),
    radial-gradient(circle at 88% 10%, rgba(34,211,238,0.11), transparent 46%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
}

.font-display{ font-family: 'Space Grotesk', sans-serif; }

/* ---- Header / glass bar ---- */
.header-bar{
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 5px;
  gap: 12px;
}

.url-container{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.url-dot{
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.url-text{
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #666;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions{
  display: flex;
  gap: 8px;
}

/* ---- Auto Click Button ---- */
.auto-click-wrapper{
  position: relative;
}

.auto-click-menu{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  min-width: 80px;
  z-index: 50;
  overflow: hidden;
}

.auto-click-menu-item{
  padding: 8px 16px;
  font-size: 0.75rem;
  font-family: 'Space Grotesk', sans-serif;
  color: #333;
  cursor: pointer;
  transition: background 0.15s ease;
}

.auto-click-menu-item:hover{
  background: rgba(139, 108, 255, 0.1);
}

.auto-click-stop{
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  color: #ef4444;
  font-weight: 600;
}

.auto-click-stop:hover{
  background: rgba(239, 68, 68, 0.1);
}

.ctl-btn--active{
  background: rgba(139, 108, 255, 0.15) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* ---- Robot Animation ---- */
.ctl-btn--active #autoClickIcon{
  animation: robotBounce 0.6s ease-in-out infinite;
}

@keyframes robotBounce{
  0%, 100%{
    transform: translateY(0);
  }
  50%{
    transform: translateY(-3px);
  }
}

.header-controls{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px;
  gap: 5px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.control-group{
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group--nav{
  flex-shrink: 0;
}

.control-group--main{
  flex: 1;
  justify-content: center;
}

.control-group--actions{
  flex-shrink: 0;
}

/* ---- Logo: clean gradient + soft neon glow ---- */
.logo-mark{
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #5B8CFF 55%, var(--accent-2));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12) inset, 0 4px 15px -4px rgba(139,108,255,0.55);
}
.logo-text{
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: #1a1a2e;
}
.logo-text span{
  background: linear-gradient(90deg, var(--accent), #6D3CFF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status-dot{
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 10px 1px var(--accent-2);
  animation: pulseDot 2.2s ease-in-out infinite;
}
@keyframes pulseDot{ 0%,100%{ opacity:.5 } 50%{ opacity:1 } }

/* ---- Controller buttons ---- */
.ctl-btn{
  color: #333;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.8);
  transition: transform .15s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
}
.ctl-btn:hover:not(:disabled){
  background: rgba(255, 255, 255, 1);
  border-color: rgba(139,108,255,0.5);
  transform: translateY(-1px);
}
.ctl-btn:active:not(:disabled){ transform: translateY(0) scale(.96); }
.ctl-btn:disabled{ opacity: .35; cursor: not-allowed; }

.ctl-btn--favorited svg{
  color: #EF4444 !important;
  stroke: #EF4444 !important;
}

.icon-btn{
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}

.ctl-select{
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #333;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  outline: none;
  cursor: pointer;
  min-width: 100px;
}
.ctl-select option{ background: #fff; color: #333; }

/* ---- Random buttons (signature element) ----
   Two distinct gradients so the eye can tell "DB" (curated,
   controlled) from "Any" (wilder, open web) apart at a glance. */
.portal-btn{
  position: relative;
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  color: white;
  border: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .25s ease;
}
.portal-btn--db{
  background: linear-gradient(135deg, var(--accent), #6D3CFF 60%, var(--accent-2));
  box-shadow: 0 3px 12px -3px rgba(139,108,255,0.5);
}
.portal-btn--any{
  background: linear-gradient(135deg, var(--accent-3), #FF5C7A 60%, #FF3DAE);
  box-shadow: 0 3px 12px -3px rgba(255,138,61,0.45);
}
.portal-btn:hover{ transform: translateY(-1px); filter: brightness(1.08); }
.portal-btn:active{ transform: translateY(0) scale(.97); }

.btn-text{
  display: inline;
}

/* ---- Overlay panels shared by empty/loading/error states ---- */
.overlay-panel{
  position: absolute;
  inset: 0;
  display: flex;
}
.loading-overlay{
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
}
.hidden{ display: none !important; }

/* ---- Landing overlay with hero image ---- */
.landing-overlay{
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.landing-content{
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.landing-image-wrapper{
  position: relative;
  flex: 1;
  overflow: hidden;
}

.landing-image{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.landing-image-overlay{
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(9,12,20,0.3) 0%, rgba(9,12,20,0.7) 50%, var(--bg) 100%);
}

.landing-text{
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  padding: 40px 24px;
  text-align: center;
}

.landing-title{
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.landing-subtitle{
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0 0 32px 0;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.landing-cta{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 32px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #6D3CFF 60%, var(--accent-2));
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 20px -4px rgba(139,108,255,0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.landing-cta:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 28px -4px rgba(139,108,255,0.7);
  filter: brightness(1.1);
}

.landing-cta:active{
  transform: translateY(0) scale(0.98);
}

/* ---- Loading spinner ---- */
.loader-ring{
  width: 52px; height: 52px;
  border-radius: 999px;
  border: 3px solid rgba(139,108,255,0.18);
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  animation: spin 0.9s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* ---- Icon spin animation ---- */
.animate-spin{
  animation: spin 1s linear infinite;
}

/* ---- Error / blocked-embed overlay ---- */
.error-overlay{
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  padding: 24px;
}
.error-card{
  max-width: 420px;
  width: 100%;
  text-align: center;
  padding: 32px 28px;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.6);
}
.big-open-btn{
  width: 100%;
  padding: 13px 20px;
  border-radius: 12px;
  border: none;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 26px -8px rgba(139,108,255,0.6);
  transition: transform .15s ease, filter .2s ease;
}
.big-open-btn:hover{ transform: translateY(-2px); filter: brightness(1.08); }
.big-open-btn:active{ transform: translateY(0) scale(.98); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar{ width: 8px; height: 8px; }
::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-track{ background: transparent; }

/* ---- Favorites Drawer ---- */
.favorites-drawer{
  position: fixed;
  top: 0;
  right: -400px;
  width: 350px;
  height: 100vh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
  z-index: 100;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}
.favorites-drawer.open{
  right: 0;
}
.favorites-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.favorites-title{
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #1a1a2e;
  margin: 0;
}
.close-drawer-btn{
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
  transition: background 0.2s ease;
}
.close-drawer-btn:hover{
  background: rgba(0, 0, 0, 0.1);
}
.favorites-list{
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.favorite-item{
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.favorite-item:hover{
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.favorite-item-content{
  flex: 1;
  min-width: 0;
}
.favorite-item-name{
  font-weight: 600;
  font-size: 0.9rem;
  color: #1a1a2e;
  margin-bottom: 4px;
  cursor: pointer;
}
.favorite-item-name:hover{
  color: var(--accent);
}
.favorite-item-url{
  font-family: monospace;
  font-size: 0.75rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.favorite-item-actions{
  display: flex;
  gap: 8px;
}
.favorite-delete-btn{
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ef4444;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.favorite-delete-btn:hover{
  background: rgba(239, 68, 68, 0.2);
}
.empty-favorites{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: #666;
}
.empty-favorites p{
  margin: 4px 0;
}
.drawer-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
  transition: opacity 0.3s ease;
}
.drawer-overlay.hidden{
  opacity: 0;
  pointer-events: none;
}
.drawer-overlay:not(.hidden){
  opacity: 1;
  pointer-events: auto;
}

/* ---- Language Selector Overlay ---- */
.language-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.language-overlay:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

/* ---- Language Selector Popup ---- */
.language-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  max-width: 90vw;
  max-height: 75vh;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.language-popup.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.language-popup:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.language-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.language-popup-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #1a1a2e;
  margin: 0;
}

.close-language-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
  transition: background 0.2s ease;
}

.close-language-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.language-search {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.language-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  color: #333;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.language-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 108, 255, 0.15);
}

.language-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.language-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  border: 1px solid transparent;
}

.language-item:hover {
  background: rgba(139, 108, 255, 0.08);
  transform: translateX(2px);
}

.language-item.active {
  background: rgba(139, 108, 255, 0.12);
  border-color: rgba(139, 108, 255, 0.3);
}

.language-flag {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.language-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.9rem;
  color: #1a1a2e;
}

.language-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #666;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---- Google Translate Widget Styling ---- */
#google_translate_element {
  position: absolute;
  left: -9999px;
  top: -9999px;
  visibility: hidden;
}

/* Hide Google Translate banner */
.goog-te-banner-frame {
  display: none !important;
}

body {
  top: 0 !important;
}

/* ---- Language Popup Mobile ---- */
@media (max-width: 640px) {
  .language-popup {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
  }

  .language-popup-header {
    padding: 12px 16px;
  }

  .language-popup-title {
    font-size: 1rem;
  }

  .language-search {
    padding: 10px 16px;
  }

  .language-search-input {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .language-item {
    padding: 10px 12px;
  }

  .language-name {
    font-size: 0.85rem;
  }

  .language-code {
    font-size: 0.7rem;
  }
}

/* ---- Landing mobile responsive ---- */
@media (max-width: 640px) {
  .landing-title{
    font-size: 1.75rem;
  }

  .landing-subtitle{
    font-size: 0.9rem;
  }

  .landing-cta{
    padding: 14px 24px;
    font-size: 0.9rem;
  }

  .landing-text{
    padding: 32px 20px;
  }
}

/* ---- Mobile Responsive ---- */
@media (max-width: 640px) {
  .header-top{
    padding: 6px 8px;
    gap: 6px;
  }

  .logo-mark {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
  }

  .logo-text {
    display: none !important;
  }

  
  .url-container{
    padding: 4px 6px;
    gap: 3px;
  }

  .url-dot{
    width: 5px;
    height: 5px;
  }

  .url-text{
    font-size: 0.6rem;
  }

  .header-controls{
    padding: 4px 8px 6px;
    gap: 6px;
  }

  .control-group{
    gap: 4px;
  }

  .icon-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
  }

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

  .ctl-select{
    height: 24px;
    padding: 0 6px;
    font-size: 0.65rem;
    min-width: 60px;
    border-radius: 4px;
  }

  .portal-btn {
    height: 24px;
    padding: 0 8px;
    font-size: 0.65rem;
    border-radius: 4px;
    gap: 3px;
  }

  .portal-btn svg {
    width: 9px;
    height: 9px;
  }

  .btn-text {
    display: inline;
  }

  .favorites-drawer{
    width: 100%;
    right: -100%;
  }

  .header-actions{
    gap: 4px;
  }

  /* Hide [DB] tag on mobile */
  .url-text::before {
    display: none !important;
  }

  /* Extra small screens */
  @media (max-width: 360px) {
    .ctl-select{
      min-width: 50px;
      padding: 0 4px;
    }

    .portal-btn{
      padding: 0 6px;
    }

    .url-text{
      font-size: 0.55rem;
    }
  }
}

@media (prefers-reduced-motion: reduce){
  .loader-ring, .status-dot{ animation: none !important; }
}
