/**
 * Reusable Components
 * Buttons, cards, badges, modals, forms, and other shared UI elements
 *
 * Font size adjustments: slightly increased for better readability on all devices.
 */

/* ===== Buttons ===== */
.btn,
button {
  font-family: inherit;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-primary,
.btn-secondary,
.btn-outline,
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 40px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: #b30707;
  color: white;
  padding: 10px 28px;
  font-size: 1.1rem; /* 原0.9 +0.2 */
  box-shadow: 0 4px 12px rgba(179, 7, 7, 0.25);
}

.btn-primary:hover {
  background: #8f0505;
  box-shadow: 0 6px 20px rgba(179, 7, 7, 0.35);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: #eef2f8;
  color: #2c4a66;
  padding: 10px 28px;
  font-size: 1.1rem; /* 原0.9 +0.2 */
}

.btn-secondary:hover {
  background: #dce4ed;
}

.btn-outline {
  background: transparent;
  border: 1px solid #b30707;
  color: #b30707;
  padding: 10px 28px;
  font-size: 1.1rem; /* 原0.9 +0.2 */
}

.btn-outline:hover {
  background: #fef0f0;
}

.btn-sm {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.95rem; /* 原0.75 +0.2 */
  border: none;
}

.btn-sm.btn-edit {
  background: #e6f0fa;
  color: #1f6390;
}

.btn-sm.btn-delete {
  background: #fde8e8;
  color: #b33c3c;
}

.btn-sm.btn-view {
  background: #e0f0e6;
  color: #1f7a5a;
}

/* ===== Cards ===== */
.card {
  background: white;
  border-radius: 16px;
  border: 1px solid #eef2f8;
  padding: 24px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
  transform: translateY(-4px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem; /* 原1.1 +0.2 */
  font-weight: 700;
  color: #1a2c3e;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f4fa;
}

.card-header i {
  color: #b30707;
  font-size: 1.4rem; /* 原1.2 +0.2 */
  width: 28px;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 30px;
  font-size: 0.9rem; /* 原0.7 +0.2 */
  font-weight: 700;
}

.badge-blue {
  background: #eef3fc;
  color: #1f6390;
}

.badge-green {
  background: #e0f0e6;
  color: #1f7a5a;
}

.badge-orange {
  background: #fef0e0;
  color: #b87a1f;
}

.badge-red {
  background: #fde8e8;
  color: #b33c3c;
}

.badge-purple {
  background: #ede0f5;
  color: #6b3fa0;
}

/* ===== Status Badges ===== */
.status-badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 30px;
  font-size: 0.9rem; /* 原0.7 +0.2 */
  font-weight: 600;
}

.status-badge.in-progress {
  background: #e6f0fa;
  color: #1f6390;
}

.status-badge.in-review {
  background: #fef0e0;
  color: #b87a1f;
}

.status-badge.completed {
  background: #e0f0e6;
  color: #1f7a5a;
}

.status-badge.rejected {
  background: #fde8e8;
  color: #b33c3c;
}

.status-badge.pending {
  background: #f5f0e0;
  color: #8a7a1f;
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-weight: 500;
  color: #4a6f8a;
  font-size: 1.05rem; /* 原0.85 +0.2 */
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group label i {
  color: #b30707;
  font-size: 1.0rem; /* 原0.8 +0.2 */
  width: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 16px;
  border: 1px solid #dce6ef;
  border-radius: 12px;
  font-size: 1.1rem; /* 原0.9 +0.2 */
  outline: none;
  background: #fafcfe;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #b30707;
  box-shadow: 0 0 0 3px rgba(179, 7, 7, 0.08);
  background: white;
}

.form-group input::placeholder {
  color: #b0c4d8;
}

.form-group input[readonly] {
  background: #f4f7fc;
  cursor: not-allowed;
}

/* ===== Tables ===== */
.table-wrapper {
  background: white;
  border-radius: 20px;
  border: 1px solid #eef2f8;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 20px 4px;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 1.05rem; /* 原0.85 +0.2 */
}

th {
  text-align: left;
  padding: 14px 10px;
  font-weight: 600;
  color: #4a6f8a;
  border-bottom: 2px solid #eef2f8;
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid #f0f4fa;
}

tr:hover {
  background: #f8fbfe;
}

/* ===== Modals ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: white;
  border-radius: 32px;
  padding: 30px 35px;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 2.0rem; /* 原1.8 +0.2 */
  cursor: pointer;
  color: #6f8ea3;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #b30707;
}

.modal-box h2 {
  margin: 0 0 16px;
  font-size: 1.7rem; /* 原1.5 (实际上原代码是1.5? 注释写1.4，但实际写1.5，统一按1.5+0.2=1.7) */
  color: #1a2c3e;
}

.modal-box h2 i {
  color: #7a3f9e;
  margin-right: 8px;
}

.modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
  border-top: 1px solid #f0f4fa;
  padding-top: 20px;
}

/* ===== Progress Bar ===== */
.progress-track {
  width: 100%;
  height: 10px;
  background: #d0d8e0;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: #7f0004;
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* ===== Info Row ===== */
.info-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid #f4f7fc;
  align-items: baseline;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .label {
  width: 110px;
  font-weight: 500;
  color: #6f8ea3;
  font-size: 1.05rem; /* 原0.85 +0.2 */
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.info-row .value {
  flex: 1;
  color: #1a2c3e;
  font-weight: 500;
  font-size: 1.15rem; /* 原0.95 +0.2 */
}

.info-row .value i {
  color: #b30707;
  margin-right: 6px;
  width: 18px;
}

/* ===== Responsive - Tablet (≤768px) ===== */
@media (max-width: 768px) {
  .card {
    padding: 20px;
  }

  .card-header {
    font-size: 1.2rem; /* 原1.05? 之前1.0+0.05? 统一：基础1.1，平板可设为1.2，比桌面略小 */
    margin-bottom: 14px;
  }

  .card-header i {
    font-size: 1.3rem; /* 原1.15? 同理 */
    width: 24px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-outline {
    min-height: 42px;
    padding: 8px 20px;
    font-size: 1.0rem; /* 原0.85+0.15 或直接基于0.9+0.1? 以桌面1.1为基准，平板稍小为1.0 */
  }

  .modal-box {
    padding: 20px 18px;
    border-radius: 24px;
  }

  .modal-box h2 {
    font-size: 1.5rem; /* 桌面1.7，平板1.5 */
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 1.0rem; /* 桌面1.1，平板1.0 */
    padding: 8px 12px;
  }

  .info-row {
    flex-wrap: wrap;
  }

  .info-row .label {
    width: 100%;
    margin-bottom: 2px;
    font-size: 0.95rem;
  }

  .info-row .value {
    font-size: 1.05rem;
  }

  table {
    font-size: 0.95rem; /* 桌面1.05，平板0.95 */
  }

  th,
  td {
    padding: 10px 6px;
  }
}

/* ===== Responsive - Mobile (≤480px) ===== */
@media (max-width: 480px) {
  .card {
    padding: 16px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-outline {
    width: 100%;
    padding: 8px 16px;
    font-size: 1.0rem; /* 与平板一致，可稍大但保持 */
  }

  .btn-sm {
    font-size: 0.85rem; /* 桌面0.95，移动可0.85 */
  }

  .modal-box {
    padding: 16px 14px;
    max-height: 95vh;
  }

  .modal-close {
    font-size: 1.7rem;
    top: 12px;
    right: 12px;
  }

  .form-group label {
    font-size: 0.95rem; /* 桌面1.05，移动0.95 */
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 1.0rem;
    padding: 8px 12px;
  }

  th,
  td {
    padding: 8px 6px;
  }

  table {
    font-size: 0.9rem; /* 桌面1.05，移动0.9 */
  }

  .badge,
  .status-badge {
    font-size: 0.8rem; /* 桌面0.9，移动0.8 */
  }

  .modal-box h2 {
    font-size: 1.4rem; /* 桌面1.7，移动1.4 */
  }

  .info-row .label {
    font-size: 0.9rem;
  }

  .info-row .value {
    font-size: 1.0rem;
  }
}