/* =========================================================
   Shared PDF viewer widget styles
   All classes are namespaced with `ic-` to avoid collisions.
   ========================================================= */

.ic-page-empty {
  background-color: transparent;
  background-image: none !important;
}

/* ----------- side nav ----------- */

.ic-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-surface-bg);
  color: var(--glass-accent);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: var(--glass-surface-blur);
  -webkit-backdrop-filter: var(--glass-surface-blur);
  opacity: 0.7;
  transition: opacity 0.18s ease, background 0.18s ease, transform 0.18s ease;
}
.ic-side-prev { left: 24px; }
.ic-side-next { right: 24px; }
.ic-side:hover {
  opacity: 1;
  background: var(--glass-surface-bg-hover);
  box-shadow: var(--glass-shadow-hover);
}
.ic-side:active {
  transform: translateY(-50%) scale(0.96);
}
.ic-side-disabled {
  opacity: 0.2 !important;
  cursor: default;
  pointer-events: none;
}

body.light-mode .ic-side {
  background: var(--glass-surface-bg);
  color: var(--glass-accent);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

body.light-mode .ic-side:hover {
  background: var(--glass-surface-bg-hover);
  box-shadow: var(--glass-shadow-hover);
}

/* ----------- toolbar ----------- */

.ic-toolbar {
  position: absolute !important;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(28, 30, 38, 0.96) 0%, rgba(20, 22, 28, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  z-index: 100 !important;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  pointer-events: auto;
  will-change: transform, opacity;
}

@media (hover: hover) and (pointer: fine) {
  .ic-toolbar {
    background: rgba(20, 22, 28, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

/* Invisible hover trigger area */
.ic-toolbar::before {
  content: '';
  position: absolute;
  top: -45px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 90px;
  background: transparent;
  z-index: -1;
  pointer-events: auto;
}

/* Bring it up on hover, focus, or when explicitly set visible */
.ic-toolbar:hover,
.ic-toolbar:focus-within,
.ic-toolbar.ic-toolbar-visible {
  transform: translateX(-50%) translateY(0) !important;
  opacity: 1 !important;
}

.ic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  color: #d8dbe2;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.ic-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.ic-btn:active:not(:disabled) {
  transform: scale(0.94);
}
.ic-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.ic-btn.ic-btn-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

body.light-mode .ic-toolbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.94) 100%) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  border-bottom: none !important;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

@media (hover: hover) and (pointer: fine) {
  body.light-mode .ic-toolbar {
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

body.light-mode .ic-btn {
  color: #0f172a;
}

body.light-mode .ic-btn:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

body.light-mode .ic-btn.ic-btn-active {
  background: rgba(15, 23, 42, 0.1);
  color: #0f172a;
}

body.light-mode .ic-page-info {
  color: #334155;
}

body.light-mode .ic-page-input {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.2);
}

body.light-mode .ic-page-input:focus {
  border-color: rgba(15, 23, 42, 0.4);
  background: rgba(15, 23, 42, 0.1);
}

body.light-mode .ic-page-total {
  color: #64748b;
}

body.light-mode .ic-divider {
  background: rgba(15, 23, 42, 0.12);
}

.ic-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 6px;
}

.ic-page-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  font-size: 13px;
  color: #cfd2d9;
  font-variant-numeric: tabular-nums;
}

.ic-page-input {
  width: 48px;
  padding: 0 4px;
  height: 34px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  text-align: center;
  -moz-appearance: textfield;
  backdrop-filter: blur(8px);
}
.ic-page-input::-webkit-outer-spin-button,
.ic-page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ic-page-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.ic-page-total {
  color: #9aa0ab;
  font-size: 13px;
}

/* ----------- loader ----------- */

.ic-loader {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 50;
}

.ic-loader-show {
  display: flex;
}

.ic-loader-error .ic-spinner {
  display: none;
}

.ic-loader-error .ic-loader-text {
  color: #ff7a7a;
}

.ic-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  animation: ic-spin 0.9s linear infinite;
}

@keyframes ic-spin {
  to { transform: rotate(360deg); }
}

.ic-loader-text {
  font-size: 14px;
  color: #b6bac3;
  letter-spacing: 0.01em;
}

/* ----------- responsive tweaks ----------- */

@media (max-width: 720px) {
  .ic-side { width: 44px; height: 44px; }
  .ic-side-prev { left: 10px; }
  .ic-side-next { right: 10px; }
  .ic-toolbar { padding: 10px 8px; gap: 2px; }
  .ic-btn { width: 32px; height: 32px; }
  .ic-page-input { width: 40px; }
}
