/* ==========================================================================
   Unlock PDF Tool Styles - safepdfkit.com
   Polished UI with dedicated action bar & clear download buttons
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Left and Right Sidebar Ads Layout Preservation
   -------------------------------------------------------------------------- */
.appscms-sidebar-left,
.appscms-sidebar-right,
.appscms-left-sidebar,
.appscms-right-sidebar {
  z-index: 100000 !important;
}

@media (min-width: 1200px) {
  #unlock-workspace-section,
  .unlock-wrapper {
    padding-left: 230px !important;
    padding-right: 230px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    transition: padding 0.2s ease;
  }

  .appscms-left-sidebar,
  .appscms-sidebar-left {
    display: block !important;
    position: fixed !important;
    left: 20px !important;
    width: 200px !important;
    top: 180px !important;
  }

  .appscms-right-sidebar,
  .appscms-sidebar-right {
    display: block !important;
    position: fixed !important;
    right: 20px !important;
    width: 200px !important;
    top: 180px !important;
  }
}

@media (max-width: 1199px) {
  #unlock-workspace-section,
  .unlock-wrapper {
    padding-left: 15px !important;
    padding-right: 15px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .appscms-sidebar-left,
  .appscms-sidebar-right,
  .appscms-left-sidebar,
  .appscms-right-sidebar {
    display: none !important;
  }
}

.unlock-wrapper {
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1e293b;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   2. Password Input Card (When encrypted PDF is uploaded)
   -------------------------------------------------------------------------- */
.unlock-card {
  max-width: 600px;
  margin: 24px auto 40px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(27, 47, 231, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.unlock-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.unlock-file-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.unlock-file-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff4ff;
  border-radius: 10px;
  flex-shrink: 0;
}

.unlock-file-details {
  min-width: 0;
}

.unlock-file-name {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

.unlock-file-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
  font-size: 12px;
  color: #64748b;
}

.unlock-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.unlock-status-pill.locked {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.unlock-status-pill.unlocked {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.unlock-btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
}

.unlock-btn-close:hover {
  background: #e2e8f0;
  color: #334155;
}

.unlock-card-body {
  padding: 30px 28px 34px;
}

.unlock-prompt-intro {
  text-align: center;
  margin-bottom: 22px;
}

.unlock-shield-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #eff4ff;
  color: #1b2fe7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.unlock-prompt-intro h3 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
}

.unlock-prompt-intro p {
  font-size: 13.5px;
  color: #64748b;
  margin: 0 auto;
  max-width: 440px;
  line-height: 1.5;
}

.unlock-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unlock-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unlock-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.unlock-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.unlock-input-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 16px;
  pointer-events: none;
}

.unlock-input {
  width: 100%;
  padding: 12px 44px 12px 40px;
  font-size: 15px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.unlock-input:focus {
  border-color: #1b2fe7;
  box-shadow: 0 0 0 3px rgba(27, 47, 231, 0.12);
}

.unlock-input.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
  animation: unlockShake 0.4s ease;
}

@keyframes unlockShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

.unlock-eye-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.unlock-eye-btn:hover {
  color: #1b2fe7;
}

.unlock-error-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}

.unlock-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

/* Primary Unlock & Download Action */
.btn-unlock-primary {
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-unlock-primary:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.38);
}

.btn-unlock-primary:active {
  transform: translateY(1px);
}

.btn-unlock-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Secondary Unlock & Read Action */
.btn-unlock-read {
  width: 100%;
  padding: 12px 20px;
  background: #eff4ff;
  color: #1b2fe7;
  border: 1.5px solid #c7d7fe;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-unlock-read:hover {
  background: #e0eaff;
  border-color: #1b2fe7;
  color: #1423b8;
}

.btn-unlock-secondary {
  width: 100%;
  padding: 10px 20px;
  background: transparent;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-unlock-secondary:hover {
  background: #f1f5f9;
  color: #334155;
  border-color: #94a3b8;
}

/* --------------------------------------------------------------------------
   3. Unlocked PDF Action Banner (Always 100% visible right above reader)
   -------------------------------------------------------------------------- */
.unlock-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  gap: 16px;
  flex-wrap: wrap;
}

.action-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.doc-icon {
  width: 44px;
  height: 44px;
  background: #eff4ff;
  color: #1b2fe7;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.doc-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.doc-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.doc-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.doc-subtext {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.action-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Prominent Main Download Button */
.btn-main-download {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 22px;
  background: linear-gradient(135deg, #1b2fe7 0%, #1022c7 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(27, 47, 231, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn-main-download:hover {
  background: linear-gradient(135deg, #1423b8 0%, #0d1db8 100%);
  box-shadow: 0 6px 18px rgba(27, 47, 231, 0.45);
  transform: translateY(-1px);
}

.btn-main-download:active {
  transform: translateY(1px);
}

.btn-main-download i {
  font-size: 17px;
}

.btn-main-reset {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-main-reset:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #94a3b8;
}

/* --------------------------------------------------------------------------
   4. Unlocked PDF Reader View
   -------------------------------------------------------------------------- */
.unlock-reader {
  display: flex;
  flex-direction: column;
  height: 82vh;
  min-height: 720px;
  background: #f8fafc;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  position: relative;
  margin-bottom: 40px;
}

.unlock-loading-bar {
  height: 3px;
  background: #1b2fe7;
  width: 0%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: width 0.3s ease, opacity 0.3s ease;
}

.unlock-toast {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 2500;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.unlock-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Reader Toolbar */
.unlock-toolbar {
  height: 54px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  gap: 8px;
  overflow-x: auto;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tb-btn {
  background: transparent;
  border: none;
  color: #475569;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.15s ease, color 0.15s ease;
}

.tb-btn:hover {
  background: #f1f5f9;
  color: #1b2fe7;
}

.tb-btn.active {
  background: #eef2ff;
  color: #1b2fe7;
}

.tb-btn-close:hover {
  background: #fee2e2;
  color: #ef4444;
}

.tb-divider {
  width: 1px;
  height: 22px;
  background: #e2e8f0;
  margin: 0 4px;
}

.tb-page-nav {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2px;
}

.tb-page-box {
  display: flex;
  align-items: center;
  padding: 0 6px;
}

#unlockPageInput {
  width: 44px;
  text-align: center;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 3px 2px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
}

#unlockPageInput:focus {
  border-color: #1b2fe7;
  outline: none;
}

#unlockPageTotal {
  font-size: 13px;
  color: #64748b;
  margin-left: 6px;
  white-space: nowrap;
}

.tb-zoom-group {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2px;
}

.tb-zoom-val {
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  min-width: 44px;
  text-align: center;
}

/* Toolbar Download Button */
.btn-tb-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #1b2fe7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(27, 47, 231, 0.25);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-tb-download:hover {
  background: #1423b8;
  box-shadow: 0 4px 10px rgba(27, 47, 231, 0.35);
}

/* Reader Workspace */
.unlock-reader-workspace {
  display: flex;
  flex-grow: 1;
  height: calc(100% - 54px);
  position: relative;
  overflow: hidden;
}

/* Sidebar */
.unlock-sidebar {
  width: 250px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease;
  flex-shrink: 0;
  z-index: 50;
}

.unlock-sidebar.collapsed {
  width: 0;
  border-right: none;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.sb-tab {
  flex: 1;
  padding: 10px 4px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.sb-tab:hover {
  color: #1b2fe7;
}

.sb-tab.active {
  color: #1b2fe7;
  border-bottom-color: #1b2fe7;
  background: #ffffff;
}

.sidebar-tab-content {
  flex-grow: 1;
  overflow-y: auto;
  position: relative;
}

.sb-panel {
  display: none;
  padding: 14px;
  height: 100%;
}

.sb-panel.active {
  display: block;
}

/* Thumbnails */
#unlockThumbPanel {
  padding: 14px 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}

.unlock-thumb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.unlock-thumb-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.unlock-thumb-item.active {
  border-color: #1b2fe7;
  background: #eff4ff;
}

.unlock-thumb-item canvas {
  width: 100%;
  height: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  background: #ffffff;
  border-radius: 3px;
}

.unlock-thumb-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-top: 5px;
}

/* Sidebar Search */
.sb-search-box {
  margin-bottom: 12px;
}

#unlockSearchInput {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  outline: none;
}

#unlockSearchInput:focus {
  border-color: #1b2fe7;
}

.sb-search-count {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 5px;
}

.sb-search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: calc(100% - 70px);
}

.search-item {
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-item:hover {
  border-color: #1b2fe7;
  background: #eff4ff;
}

.search-item-page {
  font-size: 11px;
  font-weight: 700;
  color: #1b2fe7;
  margin-bottom: 3px;
}

.search-item mark {
  background: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
}

/* Viewer Area */
.unlock-viewer-container {
  flex-grow: 1;
  background: #e2e8f0;
  overflow: auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 12px 60px;
}

.unlock-viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.unlock-page-wrapper {
  position: relative;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  transition: box-shadow 0.2s ease;
}

.unlock-page-wrapper canvas {
  display: block;
}

.unlock-text-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: transparent;
  line-height: 1;
  opacity: 0.25;
  pointer-events: none;
}

.unlock-text-layer.selectable {
  pointer-events: auto;
}

.unlock-text-layer.selectable span {
  color: transparent;
  cursor: text;
  position: absolute;
  transform-origin: 0% 0%;
}

.unlock-page-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.7);
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   5. Download Progress Modal
   -------------------------------------------------------------------------- */
.unlock-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.unlock-modal-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 28px 32px;
  width: 90%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.unlock-modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #eff4ff;
  color: #1b2fe7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.unlock-modal-header h4 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
}

.unlock-modal-header p {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
}

.unlock-progress-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.unlock-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1b2fe7 0%, #3b82f6 100%);
  border-radius: 10px;
  transition: width 0.2s ease;
}

.unlock-progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   6. Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
  .unlock-action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .action-bar-right {
    justify-content: space-between;
  }

  .btn-main-download {
    flex-grow: 1;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .unlock-card {
    margin: 16px auto;
  }

  .unlock-reader {
    height: 75vh;
    min-height: 550px;
  }

  .unlock-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.15);
  }
}