﻿/* -------------------------
   全局布局与基础样式
-------------------------- */
body {
  padding-top: 56px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;
  background-color: #f8f9fa;
}

#app {
  flex: 1;
  padding: 20px 0;
}

/* -------------------------
   导航栏与页脚
-------------------------- */
.navbar-brand {
  font-weight: bold;
}

.footer {
  margin-top: auto;
  padding: 15px 0;
  background-color: #f8f9fa;
  text-align: center;
  font-size: 14px;
  color: #6c757d;
  border-top: 1px solid #dee2e6;
}

/* -------------------------
   登录与模块卡片
-------------------------- */
.login-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  background-color: #fff;
}

.module-card {
  height: 100%;
  transition: transform 0.2s, box-shadow 0.2s;
  background-color: #fff;
  border-radius: 8px;
}

.module-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.module-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: #0d6efd;
}

/* -------------------------
   内容区块样式
-------------------------- */
.alert-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  max-width: 350px;
}

.table-container,
.form-container,
.search-bar,
.result-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  padding: 15px;
  margin-bottom: 20px;
}

.result-card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

/* -------------------------
   上传缩略图
-------------------------- */
.upload-area {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background-color: #f9f9f9;
}

.upload-area:hover {
  border-color: #0d6efd;
  background-color: #f0f7ff;
}

.thumbnail-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 15px;
}

.thumbnail, .small-thumbnail {
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid #dee2e6;
  transition: all 0.2s;
}

.thumbnail {
  width: 100px;
  height: 100px;
}

.thumbnail:hover {
  transform: scale(1.05);
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
}

.small-thumbnail {
  width: 60px;
  height: 60px;
}

/* -------------------------
   表格、表单、分页
-------------------------- */
.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.required-field::after {
  content: "*";
  color: #dc3545;
  margin-left: 4px;
}

.pagination-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.dynamic-form-row {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 6px;
  background-color: #f8f9fa;
}

/* -------------------------
   图片浏览器
-------------------------- */
#imageCarousel .carousel-item,
.custom-image-viewer .image-container {
  height: 500px;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#imageCarousel .carousel-item img,
.custom-image-viewer .preview-image {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.custom-image-viewer .controls-container {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.custom-image-viewer .counter {
  color: white;
  font-weight: bold;
}

/* -------------------------
   按钮样式
-------------------------- */
.action-buttons {
  display: flex;
  gap: 8px;
}

.icon-button {
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* -------------------------
   状态标签
-------------------------- */
.status-badge {
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge-success { background-color: #d1e7dd; color: #0f5132; }
.status-badge-warning { background-color: #fff3cd; color: #856404; }
.status-badge-danger  { background-color: #f8d7da; color: #842029; }
.status-badge-info    { background-color: #cff4fc; color: #055160; }

/* -------------------------
   无数据提示
-------------------------- */
.no-data-container {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.no-data-icon {
  font-size: 4rem;
  margin-bottom: 10px;
  opacity: 0.3;
}

/* -------------------------
   特殊容器高度
-------------------------- */
#recentBillsContainer {
  max-height: 422px;
  overflow-y: auto;
}

/* -------------------------
   月份导出按钮
-------------------------- */
#monthDropdown {
  min-width: 250px;
  width: 100%;
}

#customMonth {
  width: 120px;
}

.export-month-btn {
  padding: 0.375rem 1rem;
}

.export-month-btn:hover {
  background-color: #f8f9fa;
}

/* -------------------------
   响应式样式
-------------------------- */
@media (max-width: 768px) {
  .custom-image-viewer .image-container {
    height: 300px;
  }

  .d-flex.flex-wrap.gap-2 {
    flex-direction: column;
    align-items: stretch;
  }

  .d-flex.flex-wrap.gap-2 > button,
  .d-flex.flex-wrap.gap-2 > div {
    margin-bottom: 0.5rem;
  }
}

/* -------------------------
   打印优化
-------------------------- */
@media print {
  body {
    padding-top: 0;
  }

  .navbar, .footer, .no-print {
    display: none !important;
  }

  .container, .container-fluid {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  .table {
    border-collapse: collapse !important;
    width: 100% !important;
  }

  .table td, .table th {
    background-color: #fff !important;
    color: #000 !important;
  }

  .table-bordered td, .table-bordered th {
    border: 1px solid #dee2e6 !important;
  }

  .fw-bold, h1, h2, h3, h4, h5, h6,
  th, .font-weight-bold, .table-secondary td,
  .card-header, b, strong {
    font-weight: bold !important;
  }

  thead th {
    font-weight: bold !important;
    background-color: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6 !important;
  }

  .table-secondary {
    background-color: #f8f9fa !important;
  }

  .status-badge {
    border: 1px solid #dee2e6 !important;
    padding: 2px 5px !important;
    font-weight: bold !important;
    display: inline-block !important;
  }

  .table td:nth-child(6) { min-width: 160px !important; }
  .table td:nth-child(4) { min-width: 110px !important; }

  * {
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  .card {
    break-inside: avoid;
  }

  .table-striped tr:nth-child(odd) td {
    background-color: #f2f2f2 !important;
  }

  tr.table-secondary {
    font-weight: bold !important;
  }
}

/* 上传区域焦点样式 */
.upload-dropzone:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,123,255,.25);
}

.upload-dropzone.dragover {
  background-color: rgba(0,123,255,.1);
  border-color: #007bff;
}

/* 粘贴提示动画 */
.paste-hint {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}