/* ============================================================
   Mediateca UI – layout e componenti condivisi
   ============================================================ */

:root{
  --badge-border: 8px;
  --extra-header-bg: #6c757d;
  --footer-logo-h: 48px;
  --med-shell-gap: 1rem;
  --med-shell-sticky-top: 1rem;
}

#userInput{
  margin-bottom: 1rem;
}

body{
  padding-bottom: calc(var(--footer-logo-h) * 1.5);
}

.top-band{
  min-height: 66px;
  background: #336699;
}

.top-band-logo{
  height: 40px;
  width: auto;
  display: block;
  flex: 0 0 auto;
}

.top-band .container{
  min-height: 66px;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.top-band-nav{
  display: flex;
  align-items: center;
  gap: 2rem;
  min-width: 0;
}

.top-band-link{
  color: #ffffff;
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  font-family:
    "Open Sans",
    "Source Sans Pro",
    "Roboto",
    "Lato",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Helvetica,
    Arial,
    sans-serif;
}

.top-band-link:hover,
.top-band-link:focus{
  color: #ffffff;
  text-decoration: none;
}

.top-band-link.active{
  font-weight: 600;
}

.top-band .dropdown-menu{
  margin-top: 0.5rem;
}

.top-band-dropdown{
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
  font-size: 1.05rem;
}

.top-band-dropdown .dropdown-item{
  color: #ffffff;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  background-color: #336699;
}

.top-band-dropdown .dropdown-item:hover,
.top-band-dropdown .dropdown-item:focus{
  background-color: #336699;
  color: #ffffff;
}

.top-band-dropdown .dropdown-divider{
  margin: 0.4rem 0;
}

.top-band .dropdown-toggle::after{
  margin-left: 0.4rem;
}

.site-footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0;
  z-index: 9999;
  pointer-events: none;
}

.footer-signature{
  height: var(--footer-logo-h);
  margin-right: 16px;
  opacity: 1;
  user-select: none;
  pointer-events: none;
}

.title-logo{
  height: 42px;
  width: auto;
  display: block;
  flex: 0 0 auto;
}

.title-logo--small{
  height: 28px;
  width: auto;
  opacity: 0.9;
}

.nav-main-btn{
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.inline-link-like{
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 0.5rem;
  color: #0d6efd;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

.inline-link-like:hover{
  text-decoration-thickness: 2px;
  filter: brightness(0.97);
}

.inline-link-like:focus-visible{
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

.manage-title{
  font-size: clamp(0.95rem, 0.8rem + 0.4vw, 1.15rem);
}

.manage-subtitle-text{
  font-size: clamp(1.4rem, 1.0rem + 1.2vw, 1.9rem);
  letter-spacing: 0.02em;
  text-transform: none;
}

.manage-subtitle-icon{
  font-size: clamp(1.4rem, 1.0rem + 1.0vw, 1.8rem);
  line-height: 1;
}

.manage-subtitle:not(.manage-pill){
  position: relative;
  padding-bottom: 0.25rem;
}

.manage-subtitle:not(.manage-pill)::after{
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(520px, 85%);
  height: 2px;
  transform: translateX(-50%);
  background: currentColor;
  opacity: 0.25;
  border-radius: 2px;
}

.manage-subtitle.manage-pill{
  padding-bottom: 0;
}

.manage-pill{
  display: inline-flex;
  padding: 0.35rem 0.9rem;
  border: 3px solid rgba(var(--bs-danger-rgb), 0.70);
  border-radius: 999px;
  background: transparent;
  line-height: 1.1;
}

.badge-outline-secondary{
  background: transparent;
  color: var(--bs-secondary);
  border: 1px solid var(--bs-secondary);
  text-align: center;
}

.confirm-icon{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
  font-size: 1.25rem;
}

#confirmModal.is-danger .confirm-icon{
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
}

#confirmModal.is-warning .confirm-icon{
  background: rgba(255, 193, 7, 0.18);
  color: #b38700;
}

#confirmModal{
  z-index: 2000;
}

.modal-backdrop.confirm-backdrop{
  z-index: 1990;
}

.profile-section{
  transition: opacity 0.15s ease;
}

@keyframes shake{
  0%{ transform: translateX(0); }
  20%{ transform: translateX(-6px); }
  40%{ transform: translateX(6px); }
  60%{ transform: translateX(-4px); }
  80%{ transform: translateX(4px); }
  100%{ transform: translateX(0); }
}

.shake-once{
  animation: shake 0.35s ease;
}

.med-shell{
  --bs-gutter-x: var(--med-shell-gap);
  --bs-gutter-y: var(--med-shell-gap);
}

.med-shell-main,
.med-shell-side{
  min-width: 0;
}

.med-shell-side .sticky-top{
  top: var(--med-shell-sticky-top);
}

.med-shell-side .sticky-top > .card,
.med-shell-side .sticky-top > .med-widget,
.med-shell-side .sticky-top > div{
  margin-bottom: 1rem;
}

.med-shell-side .sticky-top > :last-child{
  margin-bottom: 0 !important;
}

.med-page-title{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.med-page-title h1,
.med-page-title h2{
  min-width: 0;
}

.med-page-title-main{
  font-size: clamp(1.65rem, 1.15rem + 1.4vw, 2.4rem);
}

.med-auth-header .btn{
  white-space: nowrap;
}

.med-auth-nick{
  color: #fd7e14;
}

.med-reader-nav .btn,
.med-op-actions .btn{
  min-height: 2.6rem;
}

.med-op-actions .card-body{
  padding: 0.9rem;
}

.med-search-tag-group .input-group-text{
  background: rgba(13, 202, 240, 0.16);
  color: #055160;
  border-color: rgba(13, 202, 240, 0.5);
}

.med-search-tag-group .form-select{
  border-color: rgba(13, 202, 240, 0.5);
  background-color: rgba(13, 202, 240, 0.08);
}

.med-search-tag-group .form-select:focus{
  border-color: #0dcaf0;
  background-color: #ffffff;
  box-shadow: 0 0 0 0.25rem rgba(13, 202, 240, 0.28);
}

.btn-med-tag-accent{
  color: #055160;
  background: rgba(13, 202, 240, 0.16);
  border-color: rgba(13, 202, 240, 0.5);
}

.btn-med-tag-accent:hover,
.btn-med-tag-accent:focus{
  color: #043b46;
  background: rgba(13, 202, 240, 0.28);
  border-color: rgba(13, 202, 240, 0.72);
}

.btn-med-tag-accent:focus-visible{
  box-shadow: 0 0 0 0.25rem rgba(13, 202, 240, 0.28);
}

.med-op-feed{
  max-height: min(70vh, 42rem);
  overflow-y: auto;
}

.med-op-feed .op-feed-item + .op-feed-item{
  margin-top: 0.45rem;
}

.med-resource-header{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 0;
  line-height: 1.2;
}

.med-resource-header-main{
  color: #000;
  font-size: 1em;
}

.med-resource-header-prefix{
  font-style: italic;
  margin-right: 0.25rem;
}

.med-resource-header-title{
  display: block;
  max-width: min(64vw, 42rem);
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.82em;
  color: var(--bs-secondary-color);
  text-align: center;
}

.med-resource-authors-list{
  min-width: 0;
}

.med-resource-authors-list li{
  min-width: 0;
}

.med-resource-authors-list .inline-link-like{
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.med-resource-inline-link{
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
  padding-left: 0;
  padding-right: 0;
}

.med-resource-spec{
  display: grid;
  grid-template-columns: minmax(6.4rem, 7.2rem) minmax(0, 1fr);
  column-gap: 0.7rem;
  row-gap: 0.45rem;
  align-items: start;
}

.med-resource-spec dt,
.med-resource-spec dd{
  margin: 0;
}

.med-resource-spec dt{
  grid-column: 1;
  white-space: nowrap;
}

.med-resource-spec dd{
  grid-column: 2;
  min-width: 0;
}

.med-scope-sector-legend .storage-sector-legend-wrap{
  margin-bottom: 0;
}

.med-shell-spacer{
  min-height: 1px;
}

@media (max-width: 1199.98px){
  .med-shell-side{
    margin-top: 1.15rem;
  }

  .med-shell-side .sticky-top{
    position: static !important;
  }

  .med-shell-side .sticky-top{
    display: grid;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 2px dashed rgba(108, 117, 125, 0.45);
  }

  .med-shell-side .sticky-top > .card,
  .med-shell-side .sticky-top > .med-widget,
  .med-shell-side .sticky-top > div{
    margin-bottom: 0 !important;
  }
}

@media (min-width: 768px) and (max-width: 1199.98px){
  .med-shell-side .sticky-top{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px){
  .med-page-title{
    gap: 0.5rem;
  }

  .med-page-title .title-logo{
    height: 34px;
  }

  .med-op-feed{
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 767.98px){
  :root{
    --med-shell-gap: 0.85rem;
  }

  body{
    padding-bottom: 3.5rem;
  }

  .top-band{
    min-height: 62px;
  }

  .top-band .container{
    gap: 0.75rem;
    flex-wrap: wrap;
    min-height: 62px;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }

  .top-band-logo{
    height: 34px;
  }

  .top-band-nav{
    gap: 0.75rem;
    width: 100%;
    justify-content: flex-end;
  }

  .top-band-link,
  .top-band-dropdown,
  .top-band-dropdown .dropdown-item{
    font-size: 1rem;
  }

  .title-logo{
    height: 30px;
  }

  .nav-main-btn{
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .med-auth-header{
    margin-bottom: 0.9rem !important;
  }

  .med-auth-header > div{
    justify-content: flex-start !important;
  }

  .med-shell-side .sticky-top{
    grid-template-columns: 1fr;
  }

  .med-resource-header{
    gap: 0.1rem;
  }

  .med-resource-header-title{
    max-width: min(92vw, 26rem);
    font-size: 0.72em;
  }

  .med-resource-spec{
    grid-template-columns: minmax(5.9rem, 6.6rem) minmax(0, 1fr);
    column-gap: 0.55rem;
    row-gap: 0.4rem;
  }

  .modal-dialog{
    margin: 0.75rem;
  }
}
