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

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a, #1e293b);
  /* The browser UI frame color */
  --browser-bg: rgba(15, 23, 42, 0.85);
  /* The main website background color */
  --viewport-bg: #1e293b;

  --tab-bg: rgba(255, 255, 255, 0.05);
  /* Active tab is identical to viewport/address bar to blend seamlessly */
  --tab-active-bg: var(--viewport-bg);
  --tab-hover-bg: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --accent: #38bdf8;
}

body {
  font-family: 'Helvetica', 'Arial', sans-serif;
  background-color: #0f172a;
  color: var(--text-main);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.desktop-bg-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: 'Helvetica';
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.desktop-bg-text h1 {
  background: none;
  -webkit-text-fill-color: #fff;
  color: white;
}

.browser-app {
  width: 100%;
  height: 100%;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.browser-window {
  width: 100%;
  max-width: 1200px;
  height: 85vh;
  background: transparent;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  /* for dragging + scoping overlays */
  transition: width 0.3s, height 0.3s, border-radius 0.3s;
}

.browser-window.fullscreen {
  max-width: 100vw;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
}

/* Title Bar / Tab Bar */
.title-bar {
  display: flex;
  align-items: flex-end;
  background: var(--browser-bg);
  padding: 0.5rem 1rem 0;
  gap: 1.5rem;
  cursor: grab;
}

.title-bar:active {
  cursor: grabbing;
}

.window-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding-left: 4px;
}

.control {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
}

.close {
  background: #ff5f56;
}

.minimize {
  background: #ffbd2e;
}

.maximize {
  background: #27c93f;
}

.tabs-container {
  display: flex;
  flex-grow: 1;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-container::-webkit-scrollbar {
  display: none;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  max-width: 200px;
  flex: 1;
  padding: 10px 14px;
  background: var(--tab-bg);
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  position: relative;
  transition: background 0.2s, max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease, margin 0.4s ease, transform 0.3s ease;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.tab:hover:not(.active) {
  background: var(--tab-hover-bg);
}

/* Blending effect for active tabs */
.tab.active {
  background: var(--tab-active-bg);
  color: var(--text-main);
  z-index: 10;
}

.tab.selected {
  /* Multi selection highlight */
  border-bottom: 2px solid var(--accent);
  background: rgba(56, 189, 248, 0.1);
  color: var(--text-main);
}

.tab.active.selected {
  border-bottom: none;
  box-shadow: inset 0 2px 5px rgba(56, 189, 248, 0.4);
}

.tab-title {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 2px;
}

.tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: inherit;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
}

.tab:hover .tab-close,
.tab.active .tab-close,
.tab.selected .tab-close {
  opacity: 1;
}

.tab-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Beautiful smooth animation constraint */
.tab.removing {
  opacity: 0 !important;
  transform: translateY(10px);
  max-width: 0 !important;
  padding-left: 0;
  padding-right: 0;
  margin: 0;
  border: none;
  overflow: hidden;
}

/* Address Bar perfectly blending into active tab and viewport */
.address-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--viewport-bg);
  /* No bottom border to seamlessly flow into viewport */
}

.nav-buttons {
  display: flex;
  gap: 8px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.url-input {
  flex-grow: 1;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.url-text {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-size: 0.9rem;
  width: 100%;
}

.desktop-icons {
  position: absolute;
  top: 40px;
  left: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 1;
}

.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  font-size: 0.9rem;
  transition: transform 0.2s;
  padding: 8px;
  border-radius: 8px;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-img {
  font-size: 2.5rem;
}

/* Game of life window */
.gol-window {
  position: absolute;
  top: 15vh;
  left: 10vw;
  width: 400px;
  height: 440px;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gol-title-bar {
  background: var(--browser-bg);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  cursor: grab;
}

.gol-title {
  margin-left: auto;
  margin-right: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Viewport */
.viewport {
  flex-grow: 1;
  background: var(--viewport-bg);
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease forwards;
  transform-origin: center center;
}

.content-wrapper {
  padding: 3rem;
  max-width: 800px;
  margin: 0;
  margin-left: 2rem;
  transition: filter 0.5s;
  transform-origin: center;
  text-align: left;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typography styling for Markdown Renderings */
h1 {
  font-family: 'Helvetica';
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #38bdf8;
}

h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 2rem 0 1rem;
  color: #e2e8f0;
}

p {
  line-height: 1.6;
  margin-bottom: 1rem;
  color: #cbd5e1;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

ul,
ol {
  padding-left: 20px;
  color: #cbd5e1;
  margin-bottom: 1rem;
}

li {
  padding: 4px 0;
}

blockquote {
  font-size: 1.25rem;
  font-style: italic;
  border-left: 3px solid var(--accent);
  padding: 10px 20px;
  margin: 1.5rem 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 8px 8px 0;
}

/* Media scroll */
.horizontal-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.horizontal-scroll::-webkit-scrollbar {
  height: 8px;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.media-card {
  min-width: 160px;
  height: 240px;
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

/* Modals */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.modal {
  background: #1e293b;
  padding: 24px;
  border-radius: 12px;
  max-width: 400px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal h2 {
  margin-top: 0;
  color: #fff;
}

.modal p {
  margin-bottom: 24px;
  color: #cbd5e1;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.modal-actions button#cancel-close {
  background: #334155;
  color: white;
  transition: background 0.2s;
}

.modal-actions button#cancel-close:hover {
  background: #475569;
}

.modal-actions button#confirm-close {
  background: #ef4444;
  color: white;
  transition: background 0.2s;
}

.modal-actions button#confirm-close:hover {
  background: #dc2626;
}

/* Empty Void */
.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
}

.silly-blur {
  filter: blur(4px);
  transition: filter 0.5s;
}