/* Layout del shell principal */
body {
  font-family: var(--font);
  font-size: var(--font-size-base);
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ────────────────────────────────────────────────────────────── */
.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  height: 48px;
}

.logo {
  font-size: var(--font-size-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.theme-toggle-btn img {
  opacity: 0.35;
  transition: opacity var(--duration) var(--ease);
}

.theme-toggle-btn:hover img {
  opacity: 0.7;
}

[data-theme="dark"] .theme-toggle-btn img {
  filter: invert(1);
}

.section-sign {
  color: var(--accent);
  font-weight: 700;
}

.version {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--muted);
  vertical-align: super;
  margin-left: 2px;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ── Dropdown ─────────────────────────────────────────────────────────── */
.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: var(--space-xs);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  padding: var(--space-xs) 0;
}

.dropdown.open .dropdown-menu,
.dropdown-menu.open {
  display: block;
}

/* ── User profile dropdown ────────────────────────────────────────────── */
.user-avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  transition: opacity var(--duration);
}

.user-avatar-btn:hover {
  opacity: 0.8;
}

.user-profile-menu {
  padding: var(--space-md) !important;
  min-width: 260px;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.profile-label {
  font-size: 0.6875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-xs);
}

.profile-label:first-child {
  margin-top: 0;
}

.profile-input {
  font-family: var(--font);
  font-size: var(--font-size-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  width: 100%;
}

.profile-input:focus {
  outline: none;
  border-color: var(--accent);
}

.profile-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-sm);
}

.btn-logout-sm {
  color: var(--muted);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.btn-logout-sm:hover {
  color: var(--ink);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  font-size: var(--font-size-sm);
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
}

.dropdown-item:hover {
  background: var(--surface-alt);
}

.status-msg {
  font-size: var(--font-size-sm);
  color: var(--muted);
  transition: opacity var(--duration) var(--ease);
}

/* ── Tabs bar ──────────────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-btn {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all var(--duration) var(--ease);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.tab-btn:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Tab icons ─────────────────────────────────────────────────────────── */
.tab-icon {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
  opacity: 0.5;
  filter: var(--icon-filter, none);
}

.tab-btn.active .tab-icon {
  opacity: 1;
}

/* ── Título del texto activo en la tab bar ────────────────────────────── */
.tab-source-title {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  margin-left: var(--space-xl);
  flex: 1;
  min-width: 0;
  color: var(--accent);
  font-size: 1.125rem;
  font-weight: 600;
  font-family: var(--font-reading);
  line-height: 1;
}

.tab-source-title.visible {
  display: flex;
}

.tab-source-title #readerTitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 3-state marks switch (all / mine / none) */
.marks-switch {
  display: flex;
  align-items: center;
  position: relative;
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 2px;
  gap: 0;
  flex-shrink: 0;
}

.marks-switch-btn {
  position: relative;
  z-index: 1;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color var(--duration) var(--ease);
  white-space: nowrap;
  line-height: 1.4;
}

.marks-switch-btn.active {
  color: var(--ink);
}

.marks-switch-btn:hover:not(.active) {
  color: var(--ink);
}

.marks-switch-indicator {
  position: absolute;
  top: 2px;
  left: 2px;
  height: calc(100% - 4px);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform var(--duration) var(--ease), width var(--duration) var(--ease);
  pointer-events: none;
}

/* ── SVG icon inside buttons ─────────────────────────────────────────── */
.btn-svg-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  filter: var(--icon-filter, none);
}

/* ── Tab panels ────────────────────────────────────────────────────────── */
.tab-panels {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  display: none;
  position: absolute;
  inset: 0;
}

.tab-panel.active {
  display: flex;
}

/* ── Split view ────────────────────────────────────────────────────────── */
.split-view {
  display: flex;
  width: 100%;
  height: 100%;
}

.split-left {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.split-right {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.split-handle {
  width: 5px;
  background: var(--border);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background var(--duration) var(--ease);
  position: relative;
}

.split-handle:hover,
.split-handle.dragging {
  background: var(--accent);
}

/* ── Panel internos ────────────────────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  min-height: 40px;
}

.panel-header h2 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: var(--space-md);
  background: var(--bg);
}

.placeholder {
  color: var(--muted);
  font-family: var(--mono);
  font-style: italic;
  font-size: 0.8125rem;
  text-align: center;
  padding: var(--space-xl);
  /* center vertically when inside a flex container */
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
