html {
  font-size: 14px;
}

html, body {
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.dev-env-banner {
  background: linear-gradient(135deg, #ff7a18 0%, #ff8c42 100%);
  color: #ffffff;
  padding: 0.35rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1100;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.dev-env-banner + header .navbar.fixed-top {
  top: 2.75rem !important;
}

body.admin-ui.dev-env-banner-visible {
  padding-top: 3rem;
}

body.admin-ui.dev-env-banner-visible .navbar.fixed-top {
  top: 2.75rem !important;
}

body.admin-ui.dev-env-banner-visible main {
  padding-top: 0;
}

@supports (padding: env(safe-area-inset-top)) {
  body::before {
    content: '';
    z-index: 2;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top);
    backdrop-filter: blur(10px);
    mask: linear-gradient(
      to bottom,
      black,
      black 50%,
      rgba(0, 0, 0, 0.7) 75%,
      rgba(0, 0, 0, 0) 100%
    );
  }
}

@supports (height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }
}

main {
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

footer {
  position: relative;
  padding: calc(0.25rem + env(safe-area-inset-bottom, 0.25rem)) 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  font-size: 0.85rem;
  line-height: 1.2;
}

.volunteer-container {
  max-width: 720px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Admin UI polish */
.admin-ui {
  background: linear-gradient(180deg, #f7f8fb 0%, #f1f4f9 100%);
}

.admin-ui .navbar {
  backdrop-filter: blur(6px);
}

.admin-ui .card {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.2s ease;
}

.admin-ui .card:hover {
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.12);
}

.admin-ui .card-footer {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.admin-ui .table thead th {
  background-color: #f8fafc;
  color: #334155;
}

.admin-ui .table tbody tr:hover {
  background-color: #f1f5f9;
}

.admin-ui .btn-primary {
  background-color: #2563eb;
  border-color: #2563eb;
}

.admin-ui .btn-outline-primary {
  border-color: #2563eb;
  color: #2563eb;
}

.admin-ui .btn-outline-primary:hover,
.admin-ui .btn-outline-primary:focus,
.admin-ui .btn-outline-primary:focus-visible {
  color: #ffffff;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.admin-ui .btn-outline-secondary:hover,
.admin-ui .btn-outline-secondary:focus,
.admin-ui .btn-outline-secondary:focus-visible {
  color: #ffffff;
  background-color: var(--bs-secondary);
  border-color: var(--bs-secondary);
}

.admin-ui .badge {
  border-radius: 999px;
  font-weight: 600;
}

.admin-ui h1,
.admin-ui h2,
.admin-ui h3 {
  letter-spacing: -0.02em;
}

.admin-ui .offcanvas {
  background-color: #ffffff;
}

.admin-ui .list-group-item {
  border: 0;
  border-radius: 12px;
  margin-bottom: 6px;
}

.admin-ui .list-group-item:hover {
  background-color: #f1f5f9;
}

.admin-ui .table {
  border-collapse: separate;
  border-spacing: 0;
}

.wysiwyg-editor {
  min-height: 160px;
  background-color: #ffffff;
}

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

.wysiwyg-editor:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
}

/* Volunteer UI polish */
.volunteer-ui {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.volunteer-ui .card {
  border: 0;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transition: box-shadow 0.2s ease;
}

.volunteer-ui .card:hover {
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.volunteer-ui .btn {
  border-radius: 12px;
}

@media (max-width: 576px) {
  .lesson-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .lesson-content {
    width: 100%;
  }

  .lesson-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: auto;
    margin-top: 0.25rem;
  }

  .lesson-actions .btn,
  .lesson-actions a.btn {
    white-space: nowrap;
  }
}

.volunteer-ui .btn-calendar {
  min-width: 0;
  min-height: auto;
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: center;
  white-space: nowrap;
}

.volunteer-ui .btn-calendar i {
  font-size: 1rem;
}

.volunteer-ui .badge {
  border-radius: 999px;
  font-weight: 600;
}

.volunteer-ui h1,
.volunteer-ui h2,
.volunteer-ui h3 {
  letter-spacing: -0.02em;
}

.volunteer-ui footer {
  padding-bottom: env(safe-area-inset-bottom);
}

.volunteer-ui main {
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

/* Login UI polish */
.login-ui {
  background: radial-gradient(circle at top, #f8fafc 0%, #eef2f7 55%, #e2e8f0 100%);
}

.login-ui .card {
  border: 0;
  border-radius: 20px;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.12);
}

/* Projection UI */
.projection-ui {
  background: radial-gradient(circle at top, #f8fafc 0%, #eef2f7 50%, #e2e8f0 100%);
}

.projection-ui .card {
  border: 0;
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}

.projection-ui .qr-box {
  background: #ffffff;
  border-radius: 20px;
  padding: 20px;
  display: inline-block;
}

.projection-ui .presence-item {
  border-radius: 14px;
  background: #ffffff;
  padding: 8px 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.projection-ui .presence-item .fw-semibold {
  font-size: 1rem;
}

.material-card {
  color: inherit;
}

.material-card:hover {
  color: inherit;
}

.pdf-viewer {
  width: 100%;
  overflow-x: scroll;
  overflow-y: auto;
  scrollbar-gutter: stable both-edges;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  -webkit-overflow-scrolling: touch;
}

.pdf-viewer canvas {
  display: block;
  margin: 0;
  max-width: none;
}

.drag-handle {
  cursor: grab;
}

.drag-row {
  cursor: grab;
}

.dev-header-badge {
  background: #ff7a18;
  color: #ffffff;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.admin-ui footer {
  padding: 0.2rem 0;
  font-size: 0.8rem;
}

.admin-footer {
    flex-wrap: nowrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* DataTables tweaks */
.dataTables_filter {
    text-align: right !important;
}
.dataTables_filter label {
    width: 100%;
    margin-bottom: 0;
}
.dataTables_filter input {
    width: auto;
    display: inline-block;
    margin-left: 0.5rem;
}
.dt-buttons {
    margin-bottom: 0.5rem;
}
.dt-export-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
}
.dt-export-buttons .dt-button {
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

.presence-scroll {
    max-height: 78vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}
.realtime-wrap {
    min-height: 85vh;
}
@media print {
  body.admin-verbali {
    background: #fff !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  html {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  body.admin-verbali .verbale-filters,
  body.admin-verbali .d-print-none,
  body.admin-verbali .offcanvas,
  body.admin-verbali header,
  body.admin-verbali footer,
  body.admin-verbali nav,
  body.admin-verbali button,
  body.admin-verbali .dt-info,
  body.admin-verbali .dt-column-order {
    display: none !important;
  }
  body.admin-verbali .verbale-print {
    display: block !important;
  }
  body.admin-verbali .verbale-print,
  body.admin-verbali .verbale-print * {
    visibility: visible !important;
  }
  body.admin-verbali .card,
  body.admin-verbali .shadow,
  body.admin-verbali .shadow-sm,
  body.admin-verbali .verbale-print,
  body.admin-verbali .container {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.admin-verbali table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    font-size: 11px;
    border: 1px solid #000 !important;
  }
  body.admin-verbali table.dataTable {
    width: 100% !important;
  }
  body.admin-verbali .dataTables_wrapper {
    width: auto !important;
  }
  body.admin-verbali table th,
  body.admin-verbali table td {
    border: 1px solid #000 !important;
    padding: 2mm !important;
    font-size: 11px !important;
    word-break: break-word !important;
  }
  /* rimuovo le larghezze fisse per evitare overflow e perdita del bordo destro */
  body.admin-verbali table th:first-child,
  body.admin-verbali table td:first-child,
  body.admin-verbali table th:nth-child(2),
  body.admin-verbali table td:nth-child(2),
  body.admin-verbali table th:last-child,
  body.admin-verbali table td:last-child {
    width: auto !important;
  }
  body.admin-verbali table th:last-child,
  body.admin-verbali table td:last-child {
    border-right: 1px solid #000 !important;
  }
  body.admin-verbali table th,
  body.admin-verbali table td {
    padding: 2mm !important;
    font-size: 11px !important;
    word-break: break-word !important;
  }
  body.admin-verbali table th:last-child,
  body.admin-verbali table td:last-child {
    display: table-cell !important;
    white-space: nowrap !important;
  }
  body.admin-verbali table th:first-child,
  body.admin-verbali table td:first-child {
    width: 105mm !important;
  }
  body.admin-verbali table th:nth-child(2),
  body.admin-verbali table td:nth-child(2) {
    width: 50mm !important;
  }
  body.admin-verbali .verbale-print,
  body.admin-verbali .table-responsive {
    width: 100% !important;
  }
  body.admin-verbali .table-responsive {
    overflow: visible !important;
  }
}
