/* assets/css/custom.css - Stili personalizzati per Bootstrap Italia */

/* Skip link accessibile */
.visually-hidden-focusable {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.visually-hidden-focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 8px 12px !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  background-color: #0073e6 !important;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 4px !important;
  z-index: 9999 !important;
}

/* Breadcrumb Bootstrap Italia style */
.breadcrumb-container {
  padding: 1rem 0 0.5rem 0;
}

.breadcrumb {
  background-color: transparent;
  padding: 0;
  margin-bottom: 0;
  font-size: 0.875rem;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
  display: none; /* Rimuoviamo il separatore di default */
}

.breadcrumb-item .separator {
  margin: 0 0.5rem;
  color: #5c6f82;
  font-weight: normal;
}

.breadcrumb-item.active {
  color: #435a6b;
  font-weight: 600;
}

.breadcrumb-item a {
  color: #0073e6;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: #004080;
  text-decoration: underline;
}

/* Card personalizzazioni eleganti Bootstrap Italia */
.card-wrapper .card {
  border: 1px solid #e6e9f0;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
}

.card-wrapper .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 43, 85, 0.15);
  border-color: #0073e6;
}

/* Card teaser miglioramenti */
.card-teaser-border {
  border-width: 2px !important;
  transition: all 0.3s ease;
}

.card-teaser-border:hover {
  border-color: #0073e6 !important;
}

/* Avatar personalizzazioni */
.avatar {
  transition: all 0.3s ease;
}

.card:hover .avatar {
  transform: scale(1.1);
}

/* Badge eleganti */
.badge.bg-light {
  background-color: rgba(0, 115, 230, 0.1) !important;
  color: #0059b3 !important;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Badge per uffici (colore info/turchese) */
.badge.bg-light.text-info {
  background-color: rgba(23, 162, 184, 0.1) !important;
  color: #0b7285 !important;
}

/* Avatar per uffici */
.avatar.text-info {
  color: #0b7285 !important;
}

/* Icone info color */
.text-info {
  color: #0b7285 !important;
}

.text-muted {
  color: #435a6b !important;
}

/* Stretched link miglioramenti */
.stretched-link::before {
  z-index: 1;
}

.card .stretched-link {
  color: inherit;
  transition: color 0.3s ease;
}

.card:hover .stretched-link {
  color: #0073e6;
}

/* Icone nei footer delle card */
.card:hover .icon {
  transform: translateX(4px);
  transition: transform 0.3s ease;
}

/* Hero section miglioramenti */
.it-hero-wrapper {
  min-height: 480px;
  position: relative;
}

.it-hero-text-wrapper {
  max-width: 800px;
  padding: 2rem;
  border-radius: 4px;
  margin: 2rem 0;
}

/* Responsive adjustments per hero text */
@media (max-width: 991.98px) {
  .it-hero-text-wrapper {
    max-width: 100%;
  }
}

/* Header responsive miglioramenti */
@media (max-width: 991.98px) {
  .it-header-center-wrapper .it-brand-text .it-brand-title {
    font-size: 1.1rem;
  }
  
  .it-header-center-wrapper .it-socials {
    display: none !important;
  }
}

/* Footer responsive miglioramenti */
@media (max-width: 767.98px) {
  .it-footer-main section .row > div {
    margin-bottom: 1.5rem;
  }
  
  .it-footer-small-prints-list {
    flex-direction: column !important;
  }
  
  .it-footer-small-prints-list .list-inline-item {
    display: block !important;
    margin-bottom: 0.5rem;
  }
}

/* Icone personalizzazioni */
.icon {
  fill: currentColor;
}

/* Form improvements per future implementazioni */
.form-group {
  margin-bottom: 1rem;
}

/* Tabelle responsive */
@media (max-width: 767.98px) {
  .table-responsive {
    border: none;
  }
}

/* Mobile-first refinements */
html {
  scroll-padding-top: 1rem;
}

body {
  overflow-x: hidden;
  line-height: 1.5;
}

img,
svg {
  max-width: 100%;
}

.brand-logo {
  width: 56px;
  height: 56px;
  margin-right: 0.75rem;
  object-fit: contain;
  flex: 0 0 56px;
}

.footer-brand-logo {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
}

.btn,
.nav-link,
.page-link,
.dropdown-item,
.reveal-email,
.custom-navbar-toggler,
.close-menu {
  touch-action: manipulation;
}

.masked-email,
.email-address,
.table a,
.card-title a,
.breadcrumb-item {
  overflow-wrap: anywhere;
  word-break: break-word;
}

main a:not(.btn):hover,
main a:not(.btn):focus,
.it-footer a:hover,
.it-footer a:focus {
  text-decoration: underline !important;
}

.btn,
.nav-link,
.page-link,
.dropdown-item,
.custom-navbar-toggler,
.close-menu {
  min-height: 44px;
}

@media (max-width: 991.98px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .it-header-slim-wrapper {
    display: none;
  }

  .it-header-center-wrapper {
    min-height: 72px;
  }

  .it-header-wrapper {
    position: relative;
  }

  .it-header-navbar-wrapper {
    position: absolute;
    inset: 0 0 auto 0;
    height: 0;
    background: transparent;
    z-index: 20;
  }

  .it-header-navbar-wrapper .container,
  .it-header-navbar-wrapper .row,
  .it-header-navbar-wrapper .col-12,
  .it-header-navbar-wrapper .navbar {
    height: 0;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }

  .it-header-center-wrapper .it-brand-wrapper a {
    min-height: 56px;
    align-items: center;
  }

  .it-header-center-wrapper .it-brand-wrapper .brand-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
  }

  .it-header-center-wrapper .it-brand-text {
    min-width: 0;
  }

  .it-header-center-wrapper .it-brand-text .it-brand-title {
    display: -webkit-box;
    max-width: calc(100vw - 112px);
    overflow: hidden;
    line-height: 1.18;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .it-header-navbar-wrapper .custom-navbar-toggler {
    position: absolute;
    top: 12px;
    right: 1rem;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 21;
  }

  .navbar .navbar-collapsable .menu-wrapper {
    padding-top: 1.25rem;
  }

  .navbar .navbar-collapsable .navbar-nav .nav-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    font-size: 1.05rem;
  }

  .breadcrumb-container {
    padding-top: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .breadcrumb {
    flex-wrap: nowrap;
    min-width: max-content;
  }

  main.container {
    margin-top: 2rem !important;
    margin-bottom: 2.5rem !important;
  }

  .display-6 {
    font-size: 2rem;
    line-height: 1.15;
  }

  .lead {
    font-size: 1.05rem;
    line-height: 1.45;
  }

  .it-hero-wrapper {
    min-height: 420px;
  }

  .it-hero-wrapper .img-responsive-wrapper,
  .it-hero-wrapper .img-responsive,
  .it-hero-wrapper .img-wrapper,
  .it-hero-wrapper img {
    min-height: 420px;
  }

  .it-hero-wrapper img {
    object-fit: cover;
  }

  .it-hero-text-wrapper {
    width: 100%;
    margin: 1.5rem 0;
    padding: 1.25rem;
  }

  .it-hero-text-wrapper h1 {
    font-size: 2rem;
    line-height: 1.1;
  }

  .it-btn-container {
    display: grid;
    gap: 0.75rem;
  }

  .it-btn-container .btn {
    width: 100%;
    margin: 0 !important;
    justify-content: center;
  }

  .card-wrapper .card:hover {
    transform: none;
  }

  .card:hover .avatar {
    transform: none;
  }
}

@media (max-width: 767.98px) {
  .row.g-4 {
    --bs-gutter-y: 1rem;
  }

  .text-center.mb-5,
  .col-12.text-center.mb-4 {
    margin-bottom: 1.5rem !important;
  }

  h1,
  .h1 {
    font-size: 1.85rem;
    line-height: 1.15;
  }

  h2,
  .h2 {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  h3,
  .h3,
  .card-title.h4,
  .card-title.h5 {
    font-size: 1.15rem;
    line-height: 1.25;
  }

  .card-body.p-4 {
    padding: 1.125rem !important;
  }

  .avatar.size-lg,
  .avatar.size-md {
    width: 48px;
    height: 48px;
    min-width: 48px;
  }

  .avatar .icon.icon-lg,
  .avatar .icon {
    width: 28px;
    height: 28px;
  }

  .badge {
    white-space: normal;
    text-align: left;
    line-height: 1.25;
  }

  .input-group {
    display: grid;
    gap: 0.75rem;
  }

  .input-group > .form-control,
  .input-group > .btn {
    width: 100%;
    border-radius: 4px !important;
  }

  .form-control,
  .form-control-lg,
  .btn-lg,
  .btn {
    min-height: 48px;
  }

  .form-floating > label {
    max-width: calc(100% - 1.5rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .d-flex.justify-content-center.gap-3 {
    flex-direction: column;
    align-items: stretch;
  }

  .d-flex.justify-content-center.gap-3 .btn,
  .d-flex.flex-column .btn,
  .d-flex.justify-content-center.mt-5 .btn {
    width: 100%;
  }

  .table-responsive {
    overflow: visible;
  }

  .table-responsive .table {
    display: block;
    margin-bottom: 0;
  }

  .table-responsive .table caption {
    display: block;
  }

  .table-responsive thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .table-responsive tbody,
  .table-responsive tr,
  .table-responsive td {
    display: block;
    width: 100%;
  }

  .table-responsive tr {
    margin-bottom: 1rem;
    padding: 0.875rem;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 43, 85, 0.08);
  }

  .table-responsive td {
    padding: 0.625rem 0 !important;
    border: 0;
  }

  .table-responsive td + td {
    border-top: 1px solid #edf2f7;
  }

  .table-responsive td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.25rem;
    color: #435a6b;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
  }

  .table-responsive td.text-center {
    text-align: left !important;
  }

  .table-responsive td[data-label="Azioni"] .dropdown,
  .table-responsive td[data-label="Azioni"] .dropdown-toggle,
  .table-responsive td[data-label="Azioni"] .dropdown-menu {
    width: 100%;
  }

  .table-responsive td[data-label="Azioni"] .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .table-responsive .d-flex.align-items-center {
    align-items: flex-start !important;
  }

  .reveal-email {
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 44px;
  }

  .pagination-wrapper,
  .pagination {
    width: 100%;
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }

  .page-link {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .it-footer-main .it-brand-wrapper {
    padding: 1.5rem 0;
  }

  .it-footer-main section {
    padding-left: 0;
    padding-right: 0;
  }

  .it-footer-main .link-list-wrapper ul li a:not(.disabled),
  .it-footer-small-prints ul.it-footer-small-prints-list li a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
  }
}

@media (max-width: 575.98px) {
  .container {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  .it-header-center-wrapper .it-brand-text .it-brand-title {
    font-size: 1rem;
  }

  .it-hero-wrapper,
  .it-hero-wrapper .img-responsive-wrapper,
  .it-hero-wrapper .img-responsive,
  .it-hero-wrapper .img-wrapper,
  .it-hero-wrapper img {
    min-height: 360px;
  }

  .it-hero-text-wrapper {
    padding: 1rem;
  }

  .it-hero-text-wrapper h1 {
    font-size: 1.75rem;
  }

  .breadcrumb {
    font-size: 0.8125rem;
  }

  .card-wrapper .card {
    border-radius: 6px;
  }
}

/* Navigation active states */
.navbar-nav .nav-item.active .nav-link,
.navbar-nav .nav-link.active {
  font-weight: 600;
}

/* Accessibility focus improvements */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #000 !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px #ffdd00 !important;
}

#main-content:focus {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .card-wrapper .card:hover,
  .card:hover .avatar,
  .card:hover .icon {
    transform: none !important;
  }
}

/* Print styles */
@media print {
  .it-header-wrapper,
  .it-footer,
  .breadcrumb-container {
    display: none !important;
  }
  
  .container {
    max-width: none !important;
  }
}
