/**
 * Resources Page Styles (resources.php)
 * Fully responsive – optimized for all screen sizes
 */

/* ===== Page Header ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #260000;
}

.page-header h1 i {
  color: #921818;
  margin-right: 8px;
}

.btn-primary {
  background: #9c061f;
  color: white;
  border: none;
  padding: 8px 22px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  background: #1a5f8a;
}

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

.btn-primary i {
  font-size: 1rem;
}

/* ===== Resource Grid ===== */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.res-card {
  background: white;
  border-radius: 18px;
  padding: 24px 20px 60px;
  border: 1px solid #edf2f7;
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  position: relative;
}

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

.res-card .icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.icon-wrap.blue {
  background: #e6f0fa;
  color: #940505;
}
.icon-wrap.green {
  background: #e0f0e6;
  color: #2a9d8f;
}
.icon-wrap.purple {
  background: #ede6f5;
  color: #7b4fa0;
}
.icon-wrap.orange {
  background: #fef0e0;
  color: #d48c2c;
}
.icon-wrap.red {
  background: #fde8e8;
  color: #b33c3c;
}

.res-card h4 {
  font-size: 1.05rem;
  margin: 0 0 4px;
  color: #260000;
  font-weight: 700;
  line-height: 1.3;
}

.res-card p {
  font-size: 0.85rem;
  color: #6f8ea3;
  margin: 0;
  line-height: 1.5;
}

.res-card .meta {
  position: absolute;
  bottom: 18px;
  right: 18px;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.res-card .meta i {
  color: #b0c8dd;
}

.res-card .badge {
  background: #eef3fc;
  color: #1f6390;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 30px;
  white-space: nowrap;
}

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

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

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

/* ===== Responsive ===== */

/* 平板 (≤1024px) */
@media (max-width: 1024px) {
  .resource-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .res-card {
    padding: 20px 16px;
  }

  .res-card .icon-wrap {
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
  }

  .res-card h4 {
    font-size: 1rem;
  }

  .res-card p {
    font-size: 0.82rem;
  }
}

/* 手机横屏 / 小平板 (≤768px) */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-header h1 {
    font-size: 1.3rem;
  }

  .btn-primary {
    align-self: flex-start;
    padding: 6px 18px;
    font-size: 0.9rem;
  }

  .resource-grid {
    gap: 16px;
  }

  .res-card {
    padding: 18px 14px;
  }

  .res-card .icon-wrap {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    margin-bottom: 12px;
  }

  .res-card h4 {
    font-size: 0.95rem;
  }

  .res-card p {
    font-size: 0.8rem;
  }

  .res-card .meta {
    margin-top: 12px;
    padding-top: 10px;
    font-size: 0.85rem;
  }

  .res-card .badge {
    font-size: 0.65rem;
    padding: 2px 12px;
  }
}

/* 手机竖屏 (≤480px) – 按钮变为圆形图标 */
@media (max-width: 480px) {
  .page-header {
    flex-direction: row;           /* 恢复为水平排列 */
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .page-header h1 {
    font-size: 1.1rem;
    flex: 1;
  }

  /* 按钮变为圆形，只显示图标 */
  .btn-primary {
    align-self: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;                /* 隐藏文字 */
    background: #9c061f;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    gap: 0;
  }

  .btn-primary i {
    font-size: 1.4rem;          /* 图标放大 */
    margin: 0;
  }

  /* 保证按钮内的文本节点完全隐藏 */
  .btn-primary span,
  .btn-primary .btn-text {
    display: none;
  }

  /* 卡片网格变为单列 */
  .resource-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .res-card {
    padding: 18px 16px 58px;
  }

  .res-card .icon-wrap {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .res-card h4 {
    font-size: 0.95rem;
  }

  .res-card p {
    font-size: 0.8rem;
  }

  .res-card .meta {
    position: absolute;
    bottom: 16px;
    right: 16px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
  }

  /* Improve tap targets and spacing on very small screens */
  .res-card {
    border-radius: 14px;
    padding: 18px 16px 58px;
    box-shadow: 0 8px 22px rgba(15,54,92,0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .res-card:active {
    transform: translateY(1px) scale(0.998);
  }

  .res-card .icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.2rem;
  }

  .res-card h4 { font-size: 1rem; }
  .res-card p { font-size: 0.85rem; color: #56728f; }
  .resource-grid { gap: 12px; }
}

/* 极小屏 (≤400px) – 按钮略缩小 */
@media (max-width: 400px) {
  .content {
    padding: 8px 6px 0;
  }

  .res-card {
    padding: 14px 12px;
  }

  .res-card h4 {
    font-size: 0.9rem;
  }

  .res-card p {
    font-size: 0.75rem;
  }

  .btn-primary {
    width: 38px;
    height: 38px;
  }

  .btn-primary i {
    font-size: 1.2rem;
  }
}