/**
 * Sixty Kmph - Secure View-Only Document Viewer Modal Styles
 * Provides an executive, in-app canvas-rendered PDF viewer with anti-download protection
 */

/* 1. Modal Overlay Container */
.doc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  background: rgba(10, 15, 29, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.doc-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 2. Modal Top Header */
.doc-modal-header {
  flex-shrink: 0;
  background: #0b1120;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  z-index: 10;
}

.doc-modal-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.doc-modal-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.doc-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-view-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.doc-modal-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 3. Toolbar Controls */
.doc-modal-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.doc-tool-group {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 2px 4px;
}

.doc-tool-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-tool-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.doc-tool-btn.active {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.doc-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.doc-zoom-label {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
  padding: 0 6px;
  min-width: 44px;
  text-align: center;
}

.doc-close-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  margin-left: 6px;
}

.doc-close-btn:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  transform: scale(1.05);
}

/* 4. Scrollable Document Viewport */
.doc-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px 20px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  min-height: 0;
  width: 100%;
}

/* 5. Page Container & Protection Shields */
.doc-page-wrapper {
  position: relative;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  flex-shrink: 0 !important; /* CRITICAL: Never let flexbox squeeze pages! */
  flex-grow: 0 !important;
  max-width: 100%;
  margin: 0 auto;
  transition: width 0.15s ease, height 0.15s ease;
}

.doc-page-canvas {
  display: block;
  max-width: 100%;
  pointer-events: none;
}

/* Transparent Click Shield Over Canvas */
.doc-page-shield {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: transparent;
  cursor: default;
  pointer-events: auto;
}

/* Subtle Watermark Layer */
.doc-page-watermark {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.doc-watermark-text {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.06);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transform: rotate(-32deg);
  white-space: nowrap;
  user-select: none;
}

/* 6. Floating Pagination Bar for Multi-Page Docs */
.doc-page-nav {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 20;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
}

.doc-nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.doc-nav-btn:hover:not(:disabled) {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

.doc-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.doc-nav-indicator {
  font-size: 12px;
  color: #94a3b8;
  min-width: 80px;
  text-align: center;
}

.doc-nav-indicator strong {
  color: #ffffff;
}

/* 7. Loading Spinner */
.doc-modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 320px;
  color: #e2e8f0;
}

.doc-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: doc-spin 0.8s linear infinite;
}

@keyframes doc-spin {
  to { transform: rotate(360deg); }
}

/* 8. Protected Action Notice Toast */
.doc-protected-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  border-left: 4px solid #10b981;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.doc-protected-toast.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.doc-protected-toast i {
  color: #10b981;
  font-size: 15px;
}

/* 9. Button Styling for Trigger Links across Pages */
.btn-doc-view {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  color: #047857 !important;
  border: 1px solid #a7f3d0;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: var(--sk-radius-full, 9999px);
  cursor: pointer;
  transition: var(--sk-transition-fast, all 0.2s ease);
  text-decoration: none !important;
  font-family: inherit;
}

.btn-doc-view:hover {
  background: #047857;
  color: #ffffff !important;
  border-color: #047857;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(4, 120, 87, 0.25);
}

button.btn-read-more {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

.btn-doc-view-link {
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .doc-modal-header {
    padding: 10px 14px;
  }
  .doc-modal-title {
    font-size: 14px;
    max-width: 180px;
  }
  .doc-modal-subtitle {
    display: none;
  }
  .doc-view-badge {
    display: none;
  }
  .doc-modal-body {
    padding: 16px 10px 80px;
  }
  .doc-page-nav {
    bottom: 16px;
    padding: 4px 10px;
  }
}
