/* Critical CSS - Solo classi Bootstrap effettivamente utilizzate */

/* Layout Container System */
.container {
  width: 100%;
  padding-right: var(--bs-gutter-x, 0.75rem);
  padding-left: var(--bs-gutter-x, 0.75rem);
  margin-right: auto;
  margin-left: auto;
}

@media (min-width: 576px) {
  .container { max-width: 540px; }
}
@media (min-width: 768px) {
  .container { max-width: 720px; }
}
@media (min-width: 992px) {
  .container { max-width: 960px; }
}
@media (min-width: 1200px) {
  .container { max-width: 1140px; }
}

/* Grid System */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: calc(-0.5 * var(--bs-gutter-x, 1.5rem));
  margin-left: calc(-0.5 * var(--bs-gutter-x, 1.5rem));
}

.col-lg-6, .col-md-8, .col-md-6 {
  flex: 0 0 auto;
  padding-right: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
  padding-left: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
}

@media (min-width: 768px) {
  .col-md-8 { width: 66.66666667%; }
  .col-md-6 { width: 50%; }
}

@media (min-width: 992px) {
  .col-lg-6 { width: 50%; }
}

/* Cards */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-color: #fff;
  background-clip: border-box;
  border: 1px solid rgba(0, 0, 0, 0.125);
  border-radius: 0.375rem;
}

.card-body {
  flex: 1 1 auto;
  padding: 1rem;
}

/* Buttons */
.btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  color: #c6c6c6;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.375rem;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.btn-primary {
  color: var(--text);
  background-color: #0d6efd;
  border-color: #0d6efd;
}

.btn-secondary {
  color: var(--text);
  background-color: #6c757d;
  border-color: #6c757d;
}

.btn-close {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: 0.25rem 0.25rem;
  color: #000;
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m.235 1.118 1.36-1.36L8 6.163 14.405.118l1.36 1.36L9.36 8l6.405 6.405-1.36 1.36L8 9.36l-6.405 6.405-1.36-1.36L6.64 8 .235 1.405z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  border: 0;
  border-radius: 0.375rem;
  opacity: 0.5;
  cursor: pointer;
}

.btn-close:hover {
  color: #000;
  text-decoration: none;
  opacity: 0.75;
}

.btn-close:focus {
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  opacity: 1;
}

.btn-close-white {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Form Controls */
.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ced4da;
  appearance: none;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-select {
  display: block;
  width: 100%;
  padding: 0.375rem 2.25rem 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
}

.form-check {
  display: block;
  min-height: 1.5rem;
  padding-left: 1.5em;
  margin-bottom: 0.125rem;
}

.form-check-input {
  width: 1em;
  height: 1em;
  margin-top: 0.25em;
  vertical-align: top;
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: 1px solid rgba(0, 0, 0, 0.25);
  appearance: none;
  print-color-adjust: exact;
}

.form-check-input[type=checkbox] {
  border-radius: 0.25em;
}

.form-check-input[type=checkbox]:checked {
  background-color: #0d6efd;
  border-color: #0d6efd;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-check-input[type=checkbox]:indeterminate {
  background-color: #0d6efd;
  border-color: #0d6efd;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
}

.form-check:hover .form-check-input:not(:disabled):not(:checked) {
  border-color: #b3b3b3;
}

.form-label {
  margin-bottom: 0.5rem;
}

.form-check-label {
  color: #212529;
  cursor: pointer;
}

/* Alerts */
.alert {
  position: relative;
  padding: 1rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
}

.alert-success {
  color: #0a3622;
  background-color: #d1e7dd;
  border-color: #badbcc;
}

.alert-danger {
  color: #58151c;
  background-color: #f8d7da;
  border-color: #f1aeb5;
}

.alert-warning {
  color: #66512c;
  background-color: #fff3cd;
  border-color: #ffda6a;
}

.alert-info {
  color: #055160;
  background-color: #cff4fc;
  border-color: #b8daff;
}

.alert-heading {
  color: inherit;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.35em 0.65em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.375rem;
}

.bg-success {
  background-color: #198754 !important;
}

.bg-danger {
  background-color: #dc3545 !important;
}

.bg-warning {
  background-color: #ffc107 !important;
  color: #cc661c !important;
}

.bg-light {
  background-color: #f8f9fa !important;
}

/* Toast */
.toast {
  position: relative;
  max-width: 350px;
  font-size: 0.875rem;
  pointer-events: auto;
  background-color: rgba(255, 255, 255, 0.85);
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  border-radius: 0.375rem;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.15s ease-in-out;
}

.toast:not(.show) {
  display: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.hide {
  opacity: 0;
  transform: translateX(100%);
}

.toast-container {
  position: absolute;
  z-index: 1090;
  width: max-content;
  max-width: 100%;
  pointer-events: none;
}

.toast-body {
  padding: 0.75rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1055;
  display: none;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}

.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
  transform: translate(0, -50px);
}

.modal.show .modal-dialog {
  transform: none;
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: 0.5rem;
  pointer-events: none;
  max-width: 500px;
}

.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
}

@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
  }
  
  .modal-dialog-centered {
    min-height: calc(100% - 3.5rem);
  }
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
  outline: 0;
}

.modal-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem;
  border-bottom: 1px solid #dee2e6;
  border-top-left-radius: calc(0.5rem - 1px);
  border-top-right-radius: calc(0.5rem - 1px);
}

.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 1rem;
}

.modal-title {
  margin-bottom: 0;
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1050;
  width: 100vw;
  height: 100vh;
  background-color: #000;
}

.modal-backdrop.fade {
  opacity: 0;
}

.modal-backdrop.show {
  opacity: 0.5;
}

/* Flexbox Utilities */
.d-flex {
  display: flex !important;
}

.d-block {
  display: block !important;
}

.d-grid {
  display: grid !important;
}

.flex-grow-1 {
  flex-grow: 1 !important;
}

.flex-column {
  flex-direction: column !important;
}

.flex-wrap {
  flex-wrap: wrap !important;
}

.justify-content-center {
  justify-content: center !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.align-items-center {
  align-items: center !important;
}

/* Spacing */
.p-0 { padding: 0 !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.pt-0 { padding-top: 0 !important; }
.pt-3 { padding-top: 1rem !important; }
.pb-0 { padding-bottom: 0 !important; }
.pb-4 { padding-bottom: 1.5rem !important; }

.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-auto { margin-left: auto !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-auto { margin-right: auto !important; }

/* Text and Color Utilities */
.text-white { color: #fff !important; }
.text-muted { color: #6c757d !important; }
.text-center { text-align: center !important; }
.text-success { color: #198754 !important; }
.text-danger { color: #dc3545 !important; }

.bg-light { background-color: #f8f9fa !important; }
.bg-opacity-10 { --bs-bg-opacity: 0.1; }

/* Border and Shadow */
.border-0 { border: 0 !important; }
.rounded-3 { border-radius: 0.5rem !important; }
.rounded-4 { border-radius: 1rem !important; }
.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; }
.shadow-lg { box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important; }

/* Position */
.position-fixed { position: fixed !important; }
.position-relative { position: relative !important; }
.bottom-0 { bottom: 0 !important; }
.end-0 { right: 0 !important; }

/* Size */
.h2 { font-size: calc(1.325rem + 0.9vw); }
.h4 { font-size: calc(1.275rem + 0.3vw); }
.h5 { font-size: 1.25rem; }
.small { font-size: 0.875em; }
.fs-3 { font-size: calc(1.3rem + 1.2vw) !important; }
.fs-4 { font-size: calc(1.275rem + 0.3vw) !important; }
.fs-5 { font-size: 1.25rem !important; }
.fw-light { font-weight: 300 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.lead { font-size: 1.25rem; font-weight: 300; }
.display-4 { font-size: calc(1.475rem + 2.7vw); font-weight: 300; }
.display-5 { font-size: calc(1.425rem + 2.1vw); font-weight: 300; }

/* Gap utility */
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }

/* Transitions e Fading */
.fade {
  transition: opacity 0.15s linear;
}

.fade:not(.show) {
  opacity: 0;
}

.collapse:not(.show) {
  display: none;
}

.collapsing {
  height: 0;
  overflow: hidden;
  transition: height 0.35s ease;
}

/* Visibility */
.show { 
  display: block !important; 
}

.modal.show {
  display: block !important;
}

/* Spinner */
.spinner-border {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  vertical-align: -0.125em;
  border: 0.125em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

.spinner-border-sm {
  width: 0.75rem;
  height: 0.75rem;
  border-width: 0.125em;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

/* Lista */
.list-unstyled {
  padding-left: 0;
  list-style: none;
}

/* Media queries responsive */
@media (min-width: 768px) {
  .d-md-flex { display: flex !important; }
  .p-md-5 { padding: 3rem !important; }
  .justify-content-md-between { justify-content: space-between !important; }
}
