/**
 * PDF Web 通用样式
 * 使用设计系统变量 - 参考 iLovePDF 简洁风格
 */

/* ========================================
 * 页面布局
 * ======================================== */
#page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f8fafc;
}

#content-wrap {
  flex: 1;
  padding-bottom: 0;
}

#footer {
  bottom: 0;
  width: 100%;
  margin-top: auto;
}

/* ========================================
 * 导航栏
 * ======================================== */
.navbar {
  height: auto;
  white-space: nowrap;
  background-color: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  box-shadow: var(--shadow-sm);
}

.bg-light {
  background-color: var(--bg-primary) !important;
}

/* ========================================
 * 功能页面容器 - iLovePDF 风格
 * ======================================== */
.container {
  max-width: 1200px;
}

/* 功能页面主内容区 */
#dropContainer {
  padding: 0;
}

#dropContainer .row {
  margin: 0;
  min-height: calc(100vh - 140px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 40px;
}

/* 功能页面内容卡片 - 简洁白色卡片 */
#dropContainer .col-md-6 {
  background: #ffffff;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid #e5e7eb;
  max-width: 600px;
  width: 100%;
}

/* 功能页面标题 - 突出但不夸张 */
#dropContainer h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 28px 0;
  padding: 0;
  border-bottom: none;
  text-align: center;
}

/* 功能页面小标题（如有） */
#dropContainer h3,
#dropContainer h4 {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
}

/* ========================================
 * 表单元素 - 简洁风格
 * ======================================== */
.form-control {
  height: 48px;
  padding: 12px 16px;
  font-size: 15px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background-color: #ffffff;
  color: #1f2937;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-control::placeholder {
  color: #9ca3af;
}

/* 文件选择区域 - 大型拖放区 */
.custom-file-chooser {
  margin-bottom: 20px;
}

.custom-file-chooser .form-control,
.file-selector-wrapper {
  min-height: 180px;
  padding: 32px;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.custom-file-chooser .form-control:hover,
.file-selector-wrapper:hover {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.custom-file-chooser .form-control.dragover,
.file-selector-wrapper.dragover {
  border-color: #2563eb;
  background-color: #dbeafe;
  transform: scale(1.01);
}

/* 文件上传图标（如有） */
.file-upload-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

/* 选中文件列表 */
.selected-files {
  margin-top: 16px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 14px;
  color: #6b7280;
  background: #f9fafb;
  padding: 12px;
  border-radius: 8px;
}

/* 标签文本 */
label {
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 8px;
  display: block;
}

.mb-3 {
  margin-bottom: 20px !important;
}

/* ========================================
 * 按钮样式 - iLovePDF 风格
 * ======================================== */
.btn {
  height: 44px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
}

/* 主按钮 - 蓝色 */
.btn-primary {
  background-color: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
  background-color: #1e40af;
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* 信息按钮 - 用于次要操作 */
.btn-info {
  background-color: #f3f4f6;
  border: 1.5px solid #d1d5db;
  color: #374151;
  box-shadow: none;
}

.btn-info:hover {
  background-color: #e5e7eb;
  border-color: #9ca3af;
  color: #1f2937;
}

/* 次要按钮 */
.btn-secondary {
  background-color: #f3f4f6;
  border: 1.5px solid #d1d5db;
  color: #374151;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
  border-color: #9ca3af;
}

/* 危险按钮 */
.btn-danger {
  background-color: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #b91c1c;
  border-color: #b91c1c;
}

/* 成功按钮 */
.btn-success {
  background-color: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.btn-success:hover {
  background-color: #059669;
  border-color: #059669;
}

.btn-outline-secondary {
  background-color: transparent;
  border: 1.5px solid #d1d5db;
  color: #6b7280;
}

.btn-outline-secondary:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
  color: #374151;
}

/* 按钮组布局 */
.text-center .btn {
  margin: 6px;
}

/* 提交按钮突出显示 */
#submitBtn {
  min-width: 160px;
  height: 48px;
  font-size: 15px;
}

/* ========================================
 * 列表组 - 文件列表
 * ======================================== */
.list-group {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.list-group-item {
  padding: 14px 16px;
  border-color: #e5e7eb;
  background-color: #ffffff;
  color: #374151;
  font-size: 14px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-group-item:hover {
  background-color: #f9fafb;
}

.list-group-item:first-child {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.list-group-item:last-child {
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

#selectedFiles.list-group {
  max-height: 240px;
  overflow-y: auto;
}

/* 文件项图标 */
.list-group-item .file-icon {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  opacity: 0.7;
}

/* 文件项删除按钮 */
.list-group-item .remove-btn {
  padding: 4px 8px;
  font-size: 12px;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.list-group-item:hover .remove-btn {
  opacity: 1;
}

.list-group-item .remove-btn:hover {
  background: #fecaca;
}

/* ========================================
 * 进度条 - 现代风格
 * ======================================== */
.progress {
  height: 6px;
  border-radius: 100px;
  background-color: #e5e7eb;
  overflow: hidden;
  margin-top: 16px;
}

.progress-bar {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: 100px;
  transition: width 0.3s ease;
}

/* ========================================
 * 选项卡/设置区域
 * ======================================== */
.options-section {
  background: #f9fafb;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.options-section label {
  margin-bottom: 4px;
}

.form-check {
  padding: 10px 0;
}

.form-check-input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
  cursor: pointer;
}

.form-check-label {
  margin-left: 8px;
  cursor: pointer;
}

/* 单选按钮组 */
.btn-group > label {
  border-radius: 0 !important;
  border: 1.5px solid #d1d5db;
  background: #ffffff;
  color: #374151;
}

.btn-group > label:first-of-type {
  border-top-left-radius: 8px !important;
  border-bottom-left-radius: 8px !important;
}

.btn-group > label:last-of-type {
  border-top-right-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
}

.btn-group > label.active,
.btn-group > label:has(input:checked) {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* ========================================
 * 卡片样式
 * ======================================== */
.card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-body {
  padding: 24px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 16px;
}

.card-text {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
}

/* ========================================
 * 表格样式
 * ======================================== */
table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
}

table thead {
  background-color: #f3f4f6;
}

table th,
table td {
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 14px;
}

table th {
  font-weight: 600;
  text-align: left;
  color: #1f2937;
}

table tbody tr:hover {
  background-color: #f9fafb;
}

/* ========================================
 * 分割线
 * ======================================== */
hr {
  border: none;
  height: 1px;
  background-color: #e5e7eb;
  margin: 24px 0;
}

/* ========================================
 * 提示信息
 * ======================================== */
.alert {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  border: none;
}

.alert-info {
  background-color: #dbeafe;
  color: #1e40af;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
}

.alert-warning {
  background-color: #fef3c7;
  color: #92400e;
}

.alert-danger {
  background-color: #fee2e2;
  color: #991b1b;
}

/* ========================================
 * 文本方向
 * ======================================== */
html[lang-direction=ltr] * {
  direction: ltr;
}

html[lang-direction=rtl] * {
  direction: rtl;
  text-align: right;
}

.ignore-rtl {
  direction: ltr !important;
  text-align: left !important;
}

/* ========================================
 * 定位辅助类
 * ======================================== */
.align-top {
  position: absolute;
  top: 0;
}

.align-center-right {
  position: absolute;
  right: 0;
  top: 50%;
}

.align-center-left {
  position: absolute;
  left: 0;
  top: 50%;
}

.align-bottom {
  position: absolute;
  bottom: 0;
}

.margin-auto-parent {
  width: 100%;
  display: flex;
}

.margin-center {
  margin: 0 auto;
}

/* ========================================
 * 画布和阴影
 * ======================================== */
#pdf-canvas,
.fixed-shadow-canvas {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  width: 100%;
  border-radius: 8px;
}

.shadow-canvas {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ========================================
 * 辅助类
 * ======================================== */
.hidden {
  display: none;
}

/* RTL 适配 */
html[lang-direction="rtl"] input.form-check-input {
  position: relative;
  margin-left: 0px;
}

html[lang-direction="rtl"] label.form-check-label {
  display: inline;
}

/* ========================================
 * 深色模式
 * ======================================== */
.dark-mode #page-container,
[data-theme="dark"] #page-container {
  background-color: #0f172a;
}

.dark-mode #dropContainer .col-md-6,
[data-theme="dark"] #dropContainer .col-md-6 {
  background: #1e293b;
  border-color: #334155;
}

.dark-mode #dropContainer h2,
[data-theme="dark"] #dropContainer h2 {
  color: #f1f5f9;
}

.dark-mode .form-control,
[data-theme="dark"] .form-control {
  background-color: #374151;
  border-color: #4b5563;
  color: #f1f5f9;
}

.dark-mode .form-control:focus,
[data-theme="dark"] .form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.dark-mode .custom-file-chooser .form-control,
.dark-mode .file-selector-wrapper,
[data-theme="dark"] .custom-file-chooser .form-control,
[data-theme="dark"] .file-selector-wrapper {
  background: #1e293b;
  border-color: #4b5563;
}

.dark-mode .custom-file-chooser .form-control:hover,
.dark-mode .file-selector-wrapper:hover,
[data-theme="dark"] .custom-file-chooser .form-control:hover,
[data-theme="dark"] .file-selector-wrapper:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.dark-mode .list-group,
[data-theme="dark"] .list-group {
  border-color: #334155;
}

.dark-mode .list-group-item,
[data-theme="dark"] .list-group-item {
  background-color: #1e293b;
  border-color: #334155;
  color: #e5e7eb;
}

.dark-mode .list-group-item:hover,
[data-theme="dark"] .list-group-item:hover {
  background-color: #374151;
}

.dark-mode .btn-info,
.dark-mode .btn-secondary,
[data-theme="dark"] .btn-info,
[data-theme="dark"] .btn-secondary {
  background-color: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

.dark-mode .btn-info:hover,
.dark-mode .btn-secondary:hover,
[data-theme="dark"] .btn-info:hover,
[data-theme="dark"] .btn-secondary:hover {
  background-color: #4b5563;
  border-color: #6b7280;
}

.dark-mode .options-section,
[data-theme="dark"] .options-section {
  background: #1e293b;
}

.dark-mode .progress,
[data-theme="dark"] .progress {
  background-color: #374151;
}

.dark-mode label,
[data-theme="dark"] label {
  color: #94a3b8;
}

.dark-mode .card,
[data-theme="dark"] .card {
  background-color: #1e293b;
  border-color: #334155;
}

.dark-mode .card-title,
[data-theme="dark"] .card-title {
  color: #f1f5f9;
}

.dark-mode .card-text,
[data-theme="dark"] .card-text {
  color: #94a3b8;
}

.dark-mode table thead,
[data-theme="dark"] table thead {
  background-color: #1e293b;
}

.dark-mode table th,
.dark-mode table td,
[data-theme="dark"] table th,
[data-theme="dark"] table td {
  border-color: #334155;
  color: #e5e7eb;
}

.dark-mode table tbody tr:hover,
[data-theme="dark"] table tbody tr:hover {
  background-color: #374151;
}

/* ========================================
 * 响应式设计
 * ======================================== */
@media (max-width: 768px) {
  #dropContainer .row {
    padding-top: 24px;
  }

  #dropContainer .col-md-6 {
    padding: 28px 20px;
    margin: 0 16px;
    border-radius: 14px;
  }

  #dropContainer h2 {
    font-size: 20px;
    margin-bottom: 24px;
  }

  .custom-file-chooser .form-control,
  .file-selector-wrapper {
    min-height: 140px;
    padding: 24px;
  }

  .btn {
    height: 42px;
    padding: 10px 20px;
    font-size: 14px;
  }

  .text-center .btn {
    width: 100%;
    margin: 6px 0;
  }

  #submitBtn {
    width: 100%;
    margin-top: 8px;
  }
}

@media (max-width: 480px) {
  #dropContainer .col-md-6 {
    padding: 24px 16px;
    margin: 0 12px;
  }

  .custom-file-chooser .form-control,
  .file-selector-wrapper {
    min-height: 120px;
    padding: 20px;
  }
}
