*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #111827;
  background: #0f172a;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1200px;
  max-height: 100vh;
  background: linear-gradient(145deg, #0f172a, #020617);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.8);
  border-radius: 18px;
  margin: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: radial-gradient(circle at top left, #1f2937, #020617);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-weight: 600;
  font-size: 16px;
  color: #e5e7eb;
}

.brand-subtitle {
  font-size: 12px;
  color: #9ca3af;
}

.upload-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    background 0.2s ease;
}

.file-label:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.65);
  background: linear-gradient(135deg, #1d4ed8, #4338ca);
}

.file-label:active {
  transform: translateY(0);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4);
}

.file-label input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ghost-button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease,
    color 0.12s ease, transform 0.08s ease;
}

.ghost-button:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(209, 213, 219, 0.9);
  transform: translateY(-0.5px);
}

.ghost-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.ghost-link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease,
    color 0.12s ease, transform 0.08s ease;
}

.ghost-link:hover {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(209, 213, 219, 0.9);
  transform: translateY(-0.5px);
}

.content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: radial-gradient(circle at top, #111827, #020617 60%);
}

.chrome-collapsed .top-bar {
  display: none;
}

.chrome-collapsed .helper-text {
  display: none;
}

.helper-text {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.95);
}

.helper-text.is-hidden {
  display: none;
}

.helper-text p {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}

.tabs-bar {
  display: none;
  padding: 6px 14px 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.96);
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.tabs-bar.hidden {
  display: none;
}

.tab-pill {
  flex: 0 0 auto;
  max-width: 180px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  transition: background 0.12s ease, border-color 0.12s ease,
    transform 0.08s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.tab-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.tab-pill:hover {
  background: rgba(17, 24, 39, 0.95);
  border-color: rgba(156, 163, 175, 0.9);
  transform: translateY(-0.5px);
}

.tab-pill.active {
  background: radial-gradient(circle at top left, #2563eb, #1d4ed8);
  border-color: rgba(191, 219, 254, 0.9);
  color: #eff6ff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
  animation: tab-pill-activate 0.18s ease-out;
}

.tab-pill.active span {
  opacity: 1;
  transform: translateY(-1px);
}

@keyframes tab-pill-activate {
  0% {
    transform: translateY(0) scale(0.96);
  }
  70% {
    transform: translateY(-1px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

.tab-close {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: inherit;
  cursor: pointer;
  opacity: 0.75;
}

.tab-close:hover {
  opacity: 1;
}

.viewer-wrapper {
  flex: 1;
  min-height: 0;
  padding: 10px 10px 14px;
  position: relative;
}

.viewer-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  background: #111827;
  box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.5);
}

.floating-full-button {
  position: absolute;
  right: 22px;
  bottom: 22px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: #e5e7eb;
  font-size: 0; /* hide any text, icon only */
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(14px) saturate(140%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    background 0.12s ease, opacity 0.12s ease;
}

.floating-full-button::before {
  /* Enter fullscreen icon */
  content: "⛶";
  font-size: 18px;
  line-height: 1;
  display: block;
}

.floating-full-button.is-fullscreen::before {
  /* Exit fullscreen icon */
  content: "🗗";
}

.floating-full-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.95);
  background: rgba(15, 23, 42, 0.75);
}

.floating-full-button:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
}

.floating-chrome-button {
  position: absolute;
  right: 70px;
  bottom: 22px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #e5e7eb;
  font-size: 0;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(14px) saturate(140%);
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    background 0.12s ease, opacity 0.12s ease;
}

@media (min-width: 1024px) {
  .floating-chrome-button {
    display: inline-flex;
  }
}

.floating-chrome-button::before {
  /* Hide header icon (collapse) */
  content: "▤";
  font-size: 16px;
  line-height: 1;
  display: block;
}

.chrome-collapsed .floating-chrome-button::before {
  /* Show header icon (expand) */
  content: "▢";
}

.floating-chrome-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 46px rgba(15, 23, 42, 0.95);
  background: rgba(15, 23, 42, 0.75);
}

.library-wrapper {
  flex: 1;
  min-height: 0;
  padding: 10px 10px 14px;
  overflow: auto;
}

.library-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-empty {
  padding: 20px;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.6);
  color: #9ca3af;
  font-size: 14px;
}

.library-item {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.library-title {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.library-title:hover {
  text-decoration: underline;
}

.library-meta {
  font-size: 12px;
  color: #9ca3af;
}

.library-actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
}

.library-action-button {
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
  background: rgba(37, 99, 235, 0.12);
  color: #e5e7eb;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}

.library-action-button:hover {
  background: rgba(37, 99, 235, 0.25);
  transform: translateY(-0.5px);
}

.library-action-button.danger {
  background: rgba(220, 38, 38, 0.1);
}

.library-action-button.danger:hover {
  background: rgba(220, 38, 38, 0.25);
}

.name-input {
  min-width: 140px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.7);
  color: #e5e7eb;
  font-size: 13px;
}

.name-input::placeholder {
  color: #6b7280;
}

@media (max-width: 768px) {
  .app-shell {
    margin: 8px;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .upload-form {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .upload-form > * {
    flex: 0 1 auto;
  }
}


