/* Modern CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b;
  --accent-color: #f59e0b;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --transition: all 0.2s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
}

/* License Activation Page Styles */
.license-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.license-card {
  background: var(--surface-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  margin: 1rem;
}

.license-header {
  text-align: center;
  margin-bottom: 2rem;
}

.license-header h1 {
  color: var(--text-primary);
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.license-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.license-form {
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: var(--transition);
  background-color: var(--surface-color);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.form-input::placeholder {
  color: var(--text-secondary);
}

.button-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  min-height: 44px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
  flex: 1;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  flex: 1;
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.trial-info {
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  border: 1px solid #f59e0b;
  border-radius: var(--border-radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.trial-info h3 {
  color: #92400e;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.trial-info p {
  color: #92400e;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.trial-link {
  color: var(--primary-color);
  text-decoration: underline;
  font-weight: 600;
}

.trial-link:hover {
  color: var(--primary-hover);
}

/* Main Application Styles */
.app-container {
  display: none;
  min-height: 100vh;
  flex-direction: column;
}

.app-container.active {
  display: flex;
}

.app-header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.license-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background: var(--background-color);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--success-color);
  flex-shrink: 0;
}

.container {
  display: flex;
  flex: 1;
  font-family: inherit;
}

.sidebar {
  width: 320px;
  background: var(--surface-color);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1rem;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
}

.action-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.files {
  background: var(--surface-color);
}

.files h3 {
  background: transparent;
  color: var(--text-primary);
  padding: 0;
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.file-list li:hover {
  background: #f1f5f9;
  border-color: var(--primary-color);
}

.file-info {
  flex: 1;
}

.title-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.page-number {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.file-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-color);
  cursor: pointer;
}

.main {
  flex: 1;
  padding: 1.5rem;
  background: var(--background-color);
  overflow-y: auto;
}

.doc {
  background: var(--surface-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  overflow: hidden;
}

.doc-title {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.doc-title .title-name {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.doc-buttons {
  display: flex;
  gap: 0.75rem;
}

.doc-buttons button {
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.doc-buttons button:first-child {
  background: var(--success-color);
  color: white;
}

.doc-buttons button:first-child:hover {
  background: #059669;
}

.doc-buttons button:last-child {
  background: var(--error-color);
  color: white;
}

.doc-buttons button:last-child:hover {
  background: #dc2626;
}

.ds-imagebox {
  width: 100%;
  min-height: 240px;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1rem;
  gap: 0.5rem;
  background: var(--background-color);
  align-items: flex-start;
}

.ds-image-wrapper {
  cursor: grab;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  transition: var(--transition);
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--surface-color);
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
  width: 150px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.ds-image-wrapper:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.ds-image-wrapper:active {
  cursor: grabbing;
}

.ds-image-wrapper img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  object-fit: contain;
}

.selectedImage {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px rgb(245 158 11 / 0.2) !important;
}

.ds-imagebox.drag-over {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border: 2px dashed var(--primary-color);
}

/* Context Menu Styles */
.ds-context-menu {
  position: absolute;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 100;
}

.ds-context-menu ul {
  list-style: none;
  padding: 0.5rem 0;
  margin: 0;
}

.ds-context-menu li {
  padding: 0.75rem 1rem;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition);
}

.ds-context-menu li:hover {
  background: var(--background-color);
  color: var(--primary-color);
}

/* Utility Classes */
.ds-hidden {
  display: none !important;
}

.initial-hidden {
  display: none !important;
}

.mt10 {
  margin-top: 0.625rem;
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.trial-info.features {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border-color: #10b981;
}

.trial-info.features h3 {
  color: #065f46;
}

.trial-info.features p {
  color: #065f46;
  margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .license-card {
    margin: 0.5rem;
    padding: 1.5rem;
  }

  .button-group {
    flex-direction: column;
  }

  .doc-title {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .ds-imagebox {
    padding: 1rem;
  }

  .ds-image-wrapper {
    width: 120px;
    height: 160px;
  }
}

/* DWT Container Styles */
.dwt-container {
  width: 580px;
  height: 380px;
}

.h600 {
  height: 600px;
}

/* Accessibility Styles */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}