// 对账管理页面样式

// 定义主题颜色
$primary-color: #007bff;
$primary-hover: #0056b3;
$secondary-color: #6c757d;
$success-color: #28a745;
$warning-color: #ffc107;
$danger-color: #dc3545;
$info-color: #17a2b8;

$background-light: #f8fafc;
$background-white: #ffffff;
$border-color: #e2e8f0;
$text-primary: #1e293b;
$text-secondary: #64748b;
$text-muted: #94a3b8;

.reconciliation-container {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  background-color: $background-light;

  // 页面标题和操作按钮
    .page-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 28px;
      padding-bottom: 20px;
      border-bottom: 2px solid $border-color;
      background-color: $background-white;
      padding: 24px;
      border-radius: 12px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);

      .header-top {
        margin-bottom: 0;
      }

      h2 {
        font-size: 28px;
        font-weight: 700;
        color: $text-primary;
        margin: 0;
        letter-spacing: -0.5px;
      }

      .header-actions {
        button {
          padding: 10px 24px;
          font-size: 14px;
          font-weight: 500;
          border-radius: 8px;
          transition: all 0.3s ease;
          box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
          &:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
          }
        }
      }

      .back-to-dashboard-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        background-color: $background-white;
        color: $primary-color;
        border: 1px solid $border-color;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s ease;
        text-decoration: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);

        &:hover {
          background-color: $primary-color;
          border-color: $primary-color;
          color: white;
          transform: translateY(-1px);
          box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
        }

        &:active {
          transform: translateY(0);
        }
      }
    }

  // 过滤区域
    .filter-section {
      display: flex;
      flex-wrap: wrap;
      gap: 20px;
      margin-bottom: 28px;
      padding: 24px;
      background-color: $background-white;
      border-radius: 12px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);

      .filter-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-width: 220px;

        label {
          font-size: 13px;
          font-weight: 600;
          color: $text-secondary;
          text-transform: uppercase;
          letter-spacing: 0.5px;
        }

        select,
        .form-control {
          padding: 12px 16px;
          border: 1px solid $border-color;
          border-radius: 8px;
          font-size: 14px;
          transition: all 0.3s ease;
          background-color: $background-white;

          &:focus {
            outline: none;
            border-color: $primary-color;
            box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
          }
        }

        .date-range {
          display: flex;
          align-items: center;
          gap: 12px;

          .date-input {
            flex: 1;
          }

          span {
            font-size: 14px;
            color: $text-muted;
            font-weight: 500;
          }
        }
      }
    }

    // 卡片样式
    .section-card {
      background-color: $background-white;
      border-radius: 12px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
      margin-bottom: 28px;
      overflow: hidden;
      transition: transform 0.3s ease, box-shadow 0.3s ease;

      &:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
      }

      .section-header {
        padding: 20px 24px;
        border-bottom: 1px solid $border-color;
        background-color: #fafbfc;

        h3 {
          font-size: 20px;
          font-weight: 600;
          color: $text-primary;
          margin: 0;
          display: flex;
          align-items: center;
          gap: 8px;
        }
      }
    }

  // 表格样式
    .table-responsive {
      overflow-x: auto;
      border-radius: 8px;
      margin: 0;
      background-color: $background-white;

      .table {
        width: 100%;
        border-collapse: collapse;
        border-spacing: 0;
        margin-bottom: 0;

        thead {
          background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

          th {
            padding: 16px;
            text-align: left;
            font-size: 13px;
            font-weight: 600;
            color: white;
            white-space: nowrap;
            letter-spacing: 0.5px;
            text-transform: uppercase;
            border-bottom: none;
          }
        }

        tbody {
          tr {
            border-bottom: 1px solid $border-color;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;

            &:hover {
              background-color: #f8fafc;
              transform: translateX(2px);
            }

            &:last-child {
              border-bottom: none;
            }

            td {
              padding: 16px;
              font-size: 14px;
              color: $text-primary;
              vertical-align: middle;
              font-weight: 500;
              transition: all 0.3s ease;

              .btn {
                padding: 6px 16px;
                font-size: 13px;
                border-radius: 6px;
                transition: all 0.3s ease;
                font-weight: 500;

                &:hover {
                  transform: translateY(-1px);
                  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
                }
              }

              .btn-view {
                background-color: $info-color;
                color: white;
                border: none;

                &:hover {
                  background-color: #138496;
                }
              }
            }
          }

          .no-data {
            text-align: center;
            padding: 60px 16px !important;
            color: $text-muted;
            font-style: normal;
            font-size: 15px;
            font-weight: 500;
          }
        }
      }

      // 小表格样式
      .table-small {
        thead th,
        tbody td {
          padding: 12px;
          font-size: 13px;
        }

        thead {
          background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
        }
      }
    }

  // 状态标签样式
    .status-badge {
      padding: 6px 12px;
      border-radius: 50px;
      font-size: 12px;
      font-weight: 600;
      text-align: center;
      min-width: 80px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      transition: all 0.3s ease;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

      &:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
      }

      &.status-pending {
        background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
        color: #c7794c;
      }

      &.status-partial {
        background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
        color: #5e4b8b;
      }

      &.status-completed {
        background: linear-gradient(135deg, #c1fcd3 0%, #02b875 100%);
        color: white;
      }

      &.status-discrepancy {
        background: linear-gradient(135deg, #ffc6ff 0%, #b967ff 100%);
        color: white;
      }
    }

    // 交易类型标签样式
    .transaction-type {
      padding: 6px 12px;
      border-radius: 50px;
      font-size: 12px;
      font-weight: 600;
      text-align: center;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      transition: all 0.3s ease;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

      &:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
      }

      &.transaction-payment {
        background: linear-gradient(135deg, #c1fcd3 0%, #02b875 100%);
        color: white;
      }

      &.transaction-expense {
        background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
        color: #c74a50;
      }

      &.transaction-refund {
        background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
        color: #c7794c;
      }
    }

  // 按钮样式
    .btn {
      padding: 10px 20px;
      border: none;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.3s ease;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

      &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none !important;
        box-shadow: none;
      }

      &.btn-primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;

        &:hover:not(:disabled) {
          transform: translateY(-2px);
          box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
        }
      }

      &.btn-secondary {
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
        color: $text-primary;
        border: 1px solid $border-color;

        &:hover:not(:disabled) {
          transform: translateY(-2px);
          box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
          background: linear-gradient(135deg, #e6e9f0 0%, #d1d8e0 100%);
        }
      }

      &.btn-sm {
        padding: 6px 16px;
        font-size: 13px;
        text-transform: none;
        letter-spacing: normal;
      }

      // 成功状态按钮
      &.btn-success {
        background: linear-gradient(135deg, #c1fcd3 0%, #02b875 100%);
        color: white;

        &:hover:not(:disabled) {
          transform: translateY(-2px);
          box-shadow: 0 6px 16px rgba(2, 184, 117, 0.4);
        }
      }

      // 危险状态按钮
      &.btn-danger {
        background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
        color: #c74a50;

        &:hover:not(:disabled) {
          transform: translateY(-2px);
          box-shadow: 0 6px 16px rgba(255, 154, 158, 0.4);
        }
      }
    }

  // 模态框样式
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(0, 0, 0, 0.6);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      backdrop-filter: blur(4px);
      animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    .modal-content {
      background-color: $background-white;
      border-radius: 16px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
      width: 90%;
      max-width: 800px;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      animation: slideIn 0.3s ease;
      border: 1px solid $border-color;
    }

    @keyframes slideIn {
      from { 
        opacity: 0;
        transform: translateY(-20px);
      }
      to { 
        opacity: 1;
        transform: translateY(0);
      }
    }

    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 24px 32px;
      border-bottom: 1px solid $border-color;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;

      h3 {
        font-size: 22px;
        font-weight: 600;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 10px;
      }

      .modal-close {
        background: rgba(255, 255, 255, 0.2);
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: white;
        padding: 0;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.3s ease;

        &:hover {
          background: rgba(255, 255, 255, 0.3);
          transform: rotate(90deg);
        }
      }
    }

    .modal-body {
      padding: 32px;
      overflow-y: auto;
      flex: 1;

      // 详情网格样式
      .detail-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
        margin-bottom: 32px;

        .detail-item {
          display: flex;
          flex-direction: column;
          gap: 8px;
          padding: 16px;
          background-color: #f8fafc;
          border-radius: 12px;
          border: 1px solid $border-color;
          transition: all 0.3s ease;

          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
          }

          &.full-width {
            grid-column: 1 / -1;
          }

          label {
            font-size: 13px;
            font-weight: 600;
            color: $text-secondary;
            text-transform: uppercase;
            letter-spacing: 0.5px;
          }

          span {
            font-size: 16px;
            font-weight: 500;
            color: $text-primary;
          }
        }
      }

      // 交易记录区域
      .transactions-section {
        margin-top: 32px;

        h4 {
          font-size: 18px;
          font-weight: 600;
          color: $text-primary;
          margin-bottom: 20px;
          display: flex;
          align-items: center;
          gap: 8px;
        }
      }

      // 表单样式
      .form-group {
        margin-bottom: 24px;

        label {
          display: block;
          font-size: 14px;
          font-weight: 600;
          color: $text-secondary;
          margin-bottom: 8px;
          text-transform: uppercase;
          letter-spacing: 0.5px;
        }

        .form-control {
          width: 100%;
          padding: 12px 16px;
          border: 1px solid $border-color;
          border-radius: 8px;
          font-size: 14px;
          transition: all 0.3s ease;
          background-color: $background-white;

          &:focus {
            outline: none;
            border-color: $primary-color;
            box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
          }
        }

        textarea {
          resize: vertical;
          min-height: 100px;
        }
      }

      // 对账预览
      .reconciliation-preview {
        margin-top: 32px;
        padding-top: 24px;
        border-top: 1px solid $border-color;

        h4 {
          font-size: 18px;
          font-weight: 600;
          color: $text-primary;
          margin-bottom: 20px;
          display: flex;
          align-items: center;
          gap: 8px;
        }
      }
    }

    .modal-footer {
      display: flex;
      justify-content: flex-end;
      gap: 16px;
      padding: 24px 32px;
      border-top: 1px solid $border-color;
      background-color: #f8fafc;
    }

    // 对账模态框特定样式
    .reconcile-modal {
      max-width: 900px;
    }

  // 响应式设计
    @media (max-width: 768px) {
      padding: 16px;

      .page-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
        padding: 16px;

        h2 {
          font-size: 24px;
          text-align: center;
        }

        .header-actions {
          text-align: center;
          order: 3;
        }

        .back-to-dashboard-btn {
          justify-content: center;
          order: 1;
        }
      }

      .filter-section {
        flex-direction: column;
        padding: 16px;

        .filter-group {
          min-width: auto;
          width: 100%;
        }
      }

      .section-card {
        margin-bottom: 20px;

        .section-header {
          padding: 16px;

          h3 {
            font-size: 18px;
          }
        }
      }

      .table-responsive {
        .table {
          thead {
            display: none;
          }

          tbody tr {
            display: block;
            margin-bottom: 16px;
            border-radius: 8px;
            border: 1px solid $border-color;
            overflow: hidden;
          }

          tbody td {
            display: flex;
            justify-content: space-between;
            padding: 12px 16px;
            border-bottom: 1px solid $border-color;
            text-align: right;

            &:before {
              content: attr(data-label);
              font-weight: 600;
              color: $text-secondary;
              text-align: left;
            }

            &:last-child {
              border-bottom: none;
            }

            .btn {
              padding: 4px 12px;
              font-size: 12px;
              margin-left: auto;
            }

            .status-badge,
            .transaction-type {
              margin-left: auto;
            }
          }
        }
      }

      .modal-content {
        width: 95%;
        margin: 10px;
        border-radius: 12px;

        .modal-header {
          padding: 16px 20px;

          h3 {
            font-size: 18px;
          }
        }

        .modal-body {
          padding: 16px;

          .detail-grid {
            grid-template-columns: 1fr;
            gap: 12px;

            .detail-item {
              padding: 12px;
            }
          }

          .form-group {
            margin-bottom: 16px;
          }

          .transactions-section,
          .reconciliation-preview {
            margin-top: 20px;

            h4 {
              font-size: 16px;
            }
          }
        }

        .modal-footer {
          padding: 16px 20px;
          flex-direction: column;
        }
      }
    }

    // 超小屏幕适配
    @media (max-width: 480px) {
      .page-header {
        padding: 12px;
      }

      .filter-section {
        padding: 12px;
      }

      .table-responsive {
        .table {
          tbody td {
            padding: 8px 12px;
            font-size: 13px;
          }
        }
      }

      .modal-content {
        .modal-header {
          padding: 12px 16px;

          h3 {
            font-size: 16px;
          }
        }

        .modal-body {
          padding: 12px;
        }

        .modal-footer {
          padding: 12px 16px;
        }
      }
    }
}