/*
 * Public site (catalog, book page, reader sign-in, legal pages).
 * Uses the same palette, logo, Poppins font, and icon fonts as the admin portal:
 *   brand red  #bd2125 (hover #8e191c)
 *   navy       #263544 (navbar logo block and sidebar), #1d2531 (active item)
 *   nav text   #b7c0cd
 *   page bg    #f2f7fb, body text #333, muted #919aa3
 * Poppins @font-face comes from unitas.css. Icons come from font-awesome.min.css and feather.css.
 */

body.portal {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f2f7fb;
  color: #333;
  font-family: "Poppins", "Open Sans", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: clip;
}

.portal a {
  color: #bd2125;
}

.portal a:hover {
  color: #8e191c;
}

/* Header: mirrors the admin navbar logo block */
.portal-header {
  position: relative;
  width: 100%;
  background: #263544;
  box-shadow: 0 2px 4px 0 rgba(43, 43, 43, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 50px;
  padding: 0 20px;
  box-sizing: border-box;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  height: 50px;
}

.portal-brand img {
  height: 40px;
  width: auto;
}

.portal-menu {
  display: none;
  align-items: center;
  margin-left: auto;
  padding: 10px 2px;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.portal-menu i {
  margin-right: 8px;
}

.portal-menu:hover,
.portal-menu:focus {
  color: #fff;
}

.portal-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.portal-nav a {
  color: #b7c0cd;
  font-size: 14px;
  padding: 14px 12px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.portal-nav a i {
  font-size: 14px;
  width: 16px;
  text-align: center;
  margin-right: 8px;
}

.portal-nav a:hover,
.portal-nav a.active {
  color: #fff;
  text-decoration: none;
}

.portal-nav a.active {
  background: #1d2531;
  border-bottom-color: #bd2125;
}

.portal-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* Page title with the red icon box used by admin .page-header */
.portal-page-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.portal-page-header .page-icon {
  flex: none;
  width: 50px;
  height: 50px;
  margin-right: 16px;
  border-radius: 5px;
  background: #bd2125;
  color: #fff;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.portal-page-header h1 {
  font-size: 18px;
  font-weight: 500;
  margin: 0;
  color: #333;
}

.portal-page-header p {
  margin: 2px 0 0;
  color: #919aa3;
  font-size: 13px;
  letter-spacing: 0.08em;
}

.portal-card {
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 1px 2.94px 0.06px rgba(4, 26, 55, 0.16);
}

.portal-card .card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9eef3;
}

.portal-card .card-title i {
  color: #bd2125;
  margin-right: 8px;
}

/* Forms and buttons */
.portal .form-control {
  font-family: inherit;
  border-radius: 2px;
}

.portal .form-control:focus {
  border-color: #bd2125;
  box-shadow: 0 0 0 0.2rem rgba(189, 33, 37, 0.2);
}

.portal .btn {
  font-family: inherit;
  border-radius: 2px;
}

.portal .btn i {
  margin-right: 6px;
}

.portal .btn-unitas {
  background: #bd2125;
  border-color: #bd2125;
  color: #fff;
}

.portal .btn-unitas:hover,
.portal .btn-unitas:focus,
.portal .btn-unitas:active {
  background: #8e191c;
  border-color: #8e191c;
  color: #fff;
}

.portal .btn-navy {
  background: #263544;
  border-color: #263544;
  color: #fff;
}

.portal .btn-navy:hover,
.portal .btn-navy:focus {
  background: #1d2531;
  border-color: #1d2531;
  color: #fff;
}

.portal .alert {
  border-radius: 2px;
}

.portal .alert i {
  margin-right: 6px;
}

.portal-search {
  display: flex;
  margin: 0 0 24px;
}

.portal-search input {
  flex: 1;
  margin-right: 8px;
}

/* Catalog grid */
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  grid-gap: 20px;
}

.portal-book {
  display: block;
  overflow: hidden;
  color: #333;
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s;
}

.portal-book:hover {
  color: #333;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(4, 26, 55, 0.18);
  transform: translateY(-2px);
}

.portal-book .cover,
.portal-book .cover-empty {
  display: block;
  width: 100%;
  height: 260px;
  background: #e9eef3;
}

.portal-book .cover {
  object-fit: cover;
}

.portal-book .cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b7c0cd;
  font-size: 40px;
}

.portal-book .body {
  padding: 14px 16px 16px;
}

.portal-book h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #333;
  overflow-wrap: anywhere;
}

.portal-book .author {
  color: #919aa3;
  font-size: 13px;
  margin: 0 0 10px;
}

.portal-book .author i,
.portal-book .price i {
  margin-right: 6px;
}

.portal-book .price {
  color: #bd2125;
  font-weight: 600;
  font-size: 14px;
  margin: 0;
}

.portal-empty {
  color: #919aa3;
}

.portal-empty i {
  margin-right: 6px;
}

/* App download links */
.portal-apps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 32px;
  color: #919aa3;
  font-size: 14px;
}

.portal-apps span {
  margin-right: 12px;
}

.portal-apps span i {
  margin-right: 6px;
}

.portal-apps a {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  padding: 8px 14px;
  border-radius: 5px;
  background: #263544;
  color: #fff;
  font-size: 14px;
  text-decoration: none;
}

.portal-apps a i {
  margin-right: 8px;
}

.portal-apps a:hover {
  background: #1d2531;
  color: #fff;
  text-decoration: none;
}

/* Book detail */
.portal-detail {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-gap: 24px;
  align-items: start;
}

.portal-detail .cover,
.portal-detail .cover-empty {
  display: block;
  width: 100%;
  background: #e9eef3;
}

.portal-detail .cover-empty {
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b7c0cd;
  font-size: 48px;
}

.portal-detail .info {
  padding: 20px 24px;
}

.portal-detail .meta {
  color: #919aa3;
  font-size: 13px;
  margin: 0 0 12px;
}

.portal-detail .meta i {
  margin-right: 6px;
}

.portal-detail .meta span {
  margin-right: 14px;
}

.portal-detail .description {
  margin: 0 0 16px;
}

.portal-detail .price {
  color: #bd2125;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 16px;
}

.portal-detail .price i {
  margin-right: 6px;
}

.portal-detail .stats {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 16px;
  color: #919aa3;
  font-size: 13px;
}

.portal-detail .stats span {
  margin-right: 16px;
}

.portal-detail .stats i {
  color: #bd2125;
  margin-right: 6px;
}

.portal-detail .actions form {
  display: inline-block;
  margin: 0 8px 8px 0;
}

.portal-detail .excerpt {
  margin-top: 24px;
  padding: 20px 24px;
}

.portal-detail .excerpt .note {
  color: #919aa3;
  font-size: 13px;
}

@media (max-width: 640px) {
  .portal-header {
    flex-wrap: nowrap;
    padding: 0 16px;
  }

  .portal-menu {
    display: inline-flex;
  }

  .portal-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    background: #263544;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.18);
    z-index: 30;
    padding: 6px 0 10px;
  }

  .portal-nav.is-open {
    display: flex;
  }

  .portal-nav a {
    padding: 12px 20px;
    border-bottom: 0;
  }

  .portal-nav a.active {
    border-left: 3px solid #bd2125;
  }

  .portal-main {
    padding: 16px 16px 32px;
  }

  .portal-search {
    flex-direction: column;
  }

  .portal-search input {
    width: 100%;
    margin: 0 0 8px;
  }

  .portal-search .btn {
    width: 100%;
  }

  .portal-book .cover,
  .portal-book .cover-empty {
    height: 220px;
  }

  .portal-page-header h1,
  .portal-detail .description {
    overflow-wrap: anywhere;
  }

  .portal-detail {
    grid-template-columns: 1fr;
  }

  .portal-detail .cover-empty {
    height: 220px;
  }

  .portal-detail .info,
  .portal-detail .excerpt {
    padding: 16px;
  }

  .portal-detail .actions .btn,
  .portal-detail .actions form {
    display: block;
    width: 100%;
    margin-right: 0;
    white-space: normal;
  }

  .portal-apps {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-apps span {
    margin: 0 0 8px;
  }

  .portal-apps a {
    justify-content: center;
    margin: 0 0 8px;
  }
}

/* Reader sign-in: the mark and card follow the admin login */
.portal-auth {
  max-width: 420px;
  margin: 4vh auto 0;
}

.portal-auth .brand-mark {
  text-align: center;
  margin-bottom: 16px;
}

.portal-auth .brand-mark img {
  height: 120px;
  width: auto;
  background: #fff;
  border-radius: 22px;
  padding: 6px;
  box-shadow: 0 1px 2.94px 0.06px rgba(4, 26, 55, 0.16);
}

.portal-auth .brand-mark p {
  color: #919aa3;
  letter-spacing: 0.14em;
  font-size: 13px;
  margin: 8px 0 0;
}

.portal-auth .portal-card {
  padding: 24px;
}

.portal-auth h1 {
  font-size: 22px;
  font-weight: 500;
  color: #bd2125;
  text-align: center;
  margin: 0 0 20px;
}

.portal-auth label {
  font-size: 13px;
  color: #919aa3;
  margin-bottom: 4px;
}

.portal-auth .back {
  text-align: center;
  margin: 16px 0 0;
  font-size: 14px;
}

.portal-auth .back i {
  margin-right: 6px;
}

/* Legal pages */
.portal-legal {
  padding: 24px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .portal-auth {
    margin-top: 16px;
  }

  .portal-auth .brand-mark img {
    height: 96px;
  }

  .portal-auth .portal-card,
  .portal-legal {
    padding: 16px;
  }
}
