* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #ff6a00;
  --secondary-color: #ff6a00;
  --text-color: #242424;
  --text-color-white: #fdfdfd;
  --background-color: #fdfdfd;
  --background-items: rgba(255, 106, 0, 0.1);
  --font-primary: "Playwrite ES Deco", cursive, sans-serif;
  --font-secondary: "Figtree", sans-serif;
  --red-color: #ff3300;
  --yellow-color: #ffc300;
  --green-color: #62ff00;
  --red-color-bg: #ff330020;
  --yellow-color-bg: #ffc30020;
  --green-color-bg: #62ff0020;
}

body {
  font-family: var(--font-secondary);
  color: var(--text-color);
  font-size: 14px;
}

nav.breadcrumbs {
  display: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-secondary);
  font-weight: 700;
  color: var(--primary-color);
  font-size: 28px;
  margin-bottom: 7px;
  margin-top: 21px;
  line-height: 1;
}

h2,
h3,
h4 {
  font-size: 28px;
}

h3 {
  font-size: 21px;
  color: #505050;
  margin-bottom: 3.5px;
}

.blog-page h3 {
  margin-bottom: 7px;
  font-size: 24.5px;
}

h1 {
  margin-top: 0px;
  font-size: 49px;
  font-family: var(--font-secondary);
  line-height: 0.7;
  margin-bottom: 14px;
}

h1 span {
  color: #505050;
  font-family: var(--font-secondary);
  font-size: 28px;
}

p,
li,
summary,
details {
  font-family: var(--font-secondary);
  color: var(--text-color);
  font-size: 17.5px;
  line-height: 1.3;
}

ul,
ol {
  list-style: none;
}

.app {
  max-height: 100vh;
}

.btn {
  font-family: var(--font-secondary);
  font-weight: 500;
  font-size: 14px;
  border-radius: 7px;
  background-color: var(--primary-color);
  color: var(--text-color-white);
  border: none;
  padding: 11.5px 28px;
}

.container {
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

header > .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0px;
  backdrop-filter: blur(6px);
}
.site-header .logo {
  text-decoration: none;
  color: var(--text-color);
  display: flex;
  gap: 8px;
  align-items: center;
}
.site-header .nav {
  display: flex;
  gap: 21px;
  align-items: center;
}
.site-header .nav a {
  font-family: var(--font-secondary);
  color: var(--text-color);
  text-decoration: none;
  font-weight: 400;
  font-size: 14px;
}

a.disabled {
  opacity: 0.5;
  cursor: none;
  pointer-events: none;
}
.site-header .nav a.btn {
  color: var(--text-color-white);
}
.site-header .nav a:hover {
  text-decoration: underline;
}

#listTitle {
  font-size: 1.8em;
  color: var(--primary-color);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  flex: 1;
  padding: 5px;
}

#listTitle:hover {
  border-bottom-color: var(--primary-color);
}

#listTitle:focus {
  outline: none;
  border-bottom-color: var(--primary-color);
  background: var(--background-color);
}

.view-toggle {
  display: flex;
  background: var(--background-color);
  border-radius: 8px;
  padding: 4px;
}

.view-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 18px;
  border: 2px solid var(--primary-color);
  margin-right: 7px;
}

.view-btn path {
  fill: var(--primary-color);
}

.view-btn.active {
  background: var(--primary-color);
  color: var(--text-color-white);
}

.view-btn.active path {
  fill: var(--text-color-white);
}

.input-section {
  background: rgba(255, 106, 0, 0.1);
  padding: 35px 21px;
  border-radius: 7px;
  margin-top: 14px;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

#taskInput {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.3s;
}

#taskInput:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.priority-mini {
  display: flex;
  gap: 5px;
}

.priority-mini-btn {
  width: 36px;
  height: 36px;
  border-radius: 100%;
  border: 2px solid;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  font-size: 18px;
}

.priority-mini-btn:hover {
  transform: scale(1.1);
}

.priority-mini-btn.alta {
  border-color: var(--red-color);
}

.priority-mini-btn.media {
  border-color: var(--yellow-color);
}

.priority-mini-btn.bassa {
  border-color: var(--green-color);
}

.priority-mini-btn.active.alta {
  background: var(--red-color);
}

.priority-mini-btn.active.media {
  background: var(--yellow-color);
}

.priority-mini-btn.active.bassa {
  background: var(--green-color);
}

#addBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px var(--background-items);
}

.controls-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  margin-bottom: 7px;
}

.controls-row > div:first-of-type {
  display: flex;
  flex-direction: row-reverse;
  gap: 21px;
  align-items: center;
}

.group-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  align-items: baseline;
}

.group-btn {
  padding: 14px 12px;
  border: 2px solid var(--primary-color);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 12px;
  height: fit-content;
  line-height: 1;
}

.group-btn:hover {
  background: var(--background-color);
}

.group-btn.active {
  background: var(--primary-color);
  color: var(--text-color-white);
  border-color: var(--primary-color);
}

.group-btn:nth-of-type(2) {
  border-color: var(--red-color);
}

.group-btn:nth-of-type(2).active {
  border-color: var(--red-color);
  background-color: var(--red-color);
}
.group-btn:nth-of-type(3) {
  border-color: var(--yellow-color);
}

.group-btn:nth-of-type(3).active {
  border-color: var(--yellow-color);
  background-color: var(--yellow-color);
}
.group-btn:nth-of-type(4) {
  border-color: var(--green-color);
}

.group-btn:nth-of-type(4).active {
  border-color: var(--green-color);
  background-color: var(--green-color);
}

.group-btn:nth-of-type(5) {
  border-color: var(--text-color);
}

.group-btn:nth-of-type(5).active {
  border-color: var(--text-color);
  background-color: var(--text-color);
}

.stats {
  display: flex;
  gap: 7px;
  flex-direction: row-reverse;
}

.stat-card {
  background: var(--background-items);
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
  min-width: 80px;
}

.stat-number {
  font-size: 35px;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-label {
  font-size: 11.5px;
  color: var(--text-color);
  margin-top: 2px;
}

.tasks-container {
  max-height: 40vh;
  min-height: 40vh;
  overflow-y: scroll;
  padding: 14px 0px;
  position: relative;
}

.tasks-container::-webkit-scrollbar {
  width: 8px;
}

.tasks-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.tasks-container::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
}

/* Grid View */
.tasks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

/* List View */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  border: 2px solid var(--background-items);
  border-radius: 10px;
  padding: 12px;
  transition: all 0.3s;
  cursor: move;
  position: relative;
  animation: fadeIn 0.3s ease;
}

.task-item.priority-alta {
  background: linear-gradient(
    135deg,
    var(--red-color-bg) 0%,
    var(--red-color-bg) 100%
  );
  border-color: var(--red-color-bg);
}

.task-item.priority-media {
  background: linear-gradient(
    135deg,
    var(--yellow-color-bg) 0%,
    var(--yellow-color-bg) 100%
  );
  border-color: var(--yellow-color-bg);
}

.task-item.priority-bassa {
  background: linear-gradient(
    135deg,
    var(--green-color-bg) 0%,
    var(--green-color-bg) 100%
  );
  border-color: var(--green-color-bg);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.task-item:hover {
  box-shadow: 0 4px 12px var(--background-items);
  transform: translateY(-2px);
}

.task-item.dragging {
  opacity: 0.5;
  transform: rotate(3deg);
}

.task-item.completed {
  opacity: 0.5;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.task-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  justify-content: space-between;
}

.drag-handle {
  cursor: grab;
  font-size: 16px;
  color: var(--text-color);
}

.drag-handle:active {
  cursor: grabbing;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.priority-selector {
  display: flex;
  gap: 4.5px;
}

.priority-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.priority-dot.alta {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.priority-dot.media {
  border-color: var(--yellow-color);
  background: var(--yellow-color);
  color: white;
}

.priority-dot.bassa {
  border-color: var(--green-color);
  background: var(--green-color);
  color: white;
}

.priority-dot.inactive {
  opacity: 0.3;
}

.priority-dot:hover {
  transform: scale(1.15);
  opacity: 1 !important;
}

.task-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-color);
  word-wrap: break-word;
}

.task-item.completed .task-text {
  text-decoration: line-through;
  color: var(--text-color);
}

.task-actions {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  align-items: center;
}

.edit-btn,
.delete-btn {
  padding: 7px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  font-weight: 600;
  background: none;
  color: var(--text-color);
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-color);
  font-size: 16px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ad-space {
  margin: 15px 0;
  padding: 20px;
  background: linear-gradient(135deg, #e0f7ff 0%, #d0f0ff 100%);
  border-radius: 10px;
  text-align: center;
  color: var(--text-color);
  font-size: 13px;
  border: 2px dashed #b3e0ff;
  display: none;
}

/* List view specific styles */
.view-list .task-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  flex-direction: row-reverse;
}

.view-list .task-header {
  margin-bottom: 0;
  flex: 1;
  justify-content: end;
  gap: 21px;
}

.task-header > div {
  display: flex;
  gap: 3.5px;
}
.task-header > div:first-of-type {
  gap: 7px;
}

.view-list .task-text {
  font-size: 15px;
}

.view-list .task-actions {
  margin-top: 0;
  margin-left: 10px;
  flex-direction: row;
}

.view-list .edit-btn,
.view-list .delete-btn {
  padding: 6px 12px;
}

/* ============================================
   EXPORT/IMPORT BAR
   ============================================ */

.export-import-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
}

.action-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.action-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 8px var(--background-items);
}

/* ============================================
     MODAL
     ============================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s;
}

.modal.hidden {
  display: none;
  opacity: 0;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  animation: modalFadeIn 0.3s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 2px solid #ffe5e5;
  flex-shrink: 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #ff6b6b;
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #ffe5e5;
  color: #ff6b6b;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.close-btn:active {
  background: var(--red-color-bg);
  transform: scale(0.9);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 2px solid #ffe5e5;
  flex-shrink: 0;
}

/* Export Options */
.export-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  border: 2px solid #ffe5e5;
  background: white;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.export-option:last-child {
  margin-bottom: 0;
}

.export-option:active {
  background: #fff5f5;
  transform: scale(0.98);
  border-color: #ff6b6b;
}

.export-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.export-info {
  text-align: left;
  flex: 1;
}

.export-info strong {
  display: block;
  font-size: 15px;
  color: #333;
  margin-bottom: 4px;
}

.export-info small {
  display: block;
  font-size: 12px;
  color: #666;
}

/* Checklist Modal Styles */
.checklist-instructions {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.checklist-instructions p {
  margin: 0 0 10px 0;
  line-height: 1.6;
}

.checklist-instructions p:last-child {
  margin-bottom: 0;
}

.checklist-instructions ol {
  margin: 10px 0;
  padding-left: 20px;
}

.checklist-instructions li {
  margin: 8px 0;
  line-height: 1.5;
}

.note-style {
  background: white;
  padding: 10px;
  border-radius: 8px;
  border-left: 4px solid var(--yellow-color);
  font-size: 13px;
  color: #666;
  margin-top: 15px !important;
}

.checklist-preview {
  margin-top: 20px;
}

.checklist-preview p {
  margin: 0 0 10px 0;
  font-weight: 600;
  color: #666;
  font-size: 14px;
}

.preview-text {
  width: 100%;
  min-height: 150px;
  max-height: 200px;
  padding: 15px;
  border: 2px solid #ffe5e5;
  border-radius: 10px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  background: #f8f9fa;
  color: #333;
}

.task-text {
  cursor: pointer;
  transition: all 0.2s;
  padding: 4px 8px;
  border-radius: 6px;
  margin: -4px -8px;
}

.task-text:hover {
  background: var(--background-items);
}

.task-edit-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  outline: none;
  transition: all 0.2s;
  box-shadow: 0 0 0 3px var(--background-items);
}

.task-edit-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--background-items);
}

.task-item.editing {
  background: #fffbf5 !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 4px 16px var(--background-items);
  transform: translateY(-2px);
}

.task-item.editing .task-text {
  margin: 0;
  padding: 0;
}

/* Quando il testo della task è lungo */
.task-edit-input {
  word-wrap: break-word;
  word-break: break-word;
}

/* High contrast mode */
body.high-contrast .task-edit-input {
  border: 3px solid #000 !important;
  background: #fff !important;
  color: #000 !important;
}

body.high-contrast .task-item.editing {
  border: 3px solid #ff0000 !important;
  background: #fffacd !important;
}

/* ============================================
   ACCESSIBILITY TOGGLE (iOS Fixed)
   ============================================ */

.a11y-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #4a5568;
  color: white;
  border: none;
  border-radius: 50px;
  padding: 14px 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* iOS fix: forza hardware acceleration */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.a11y-toggle:active {
  background: #2d3748;
  transform: scale(0.95) translateZ(0);
}

.a11y-icon {
  font-size: 20px;
}

/* Assicura che sia sopra tutto su iOS */
@supports (-webkit-touch-callout: none) {
  .a11y-toggle {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 20px);
    left: env(safe-area-inset-left, 20px);
  }
}

/* ============================================
   DRAG AND DROP - Visual Feedback Fixed
   ============================================ */

/* Body durante drag */
body.is-dragging {
  cursor: grabbing !important;
  user-select: none;
}

/* Task mentre viene draggata */
.task-item.dragging {
  opacity: 0.3;
  transform: rotate(5deg) scale(1.05);
  cursor: grabbing !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  border: 3px dashed var(--primary-color) !important;
}

/* Riduci opacità task non coinvolte */
body.is-dragging
  .task-item:not(.dragging):not(.drop-target-left):not(.drop-target-right):not(
    .drop-target-above
  ):not(.drop-target-below):not(.group-hover) {
  opacity: 0.5;
  filter: grayscale(30%);
}

/* Linea di inserimento (drop indicator) */
.drop-indicator {
  position: fixed;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    #ff6a00 50%,
    var(--primary-color) 100%
  );
  border-radius: 3px;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 0 12px var(--background-items), 0 0 24px var(--background-items);
  animation: indicatorPulse 0.8s ease-in-out infinite;
}

@keyframes indicatorPulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 12px var(--background-items),
      0 0 24px var(--background-items);
  }
  50% {
    opacity: 0.8;
    box-shadow: 0 0 16px var(--background-items),
      0 0 32px var(--background-items);
  }
}

/* Drop target - SINISTRA (Grid) */
.task-item.drop-target-left {
  border-left: 4px solid var(--primary-color) !important;
  margin-left: 8px;
  transform: translateX(4px);
  transition: all 0.2s ease;
}

/* Drop target - DESTRA (Grid) */
.task-item.drop-target-right {
  border-right: 4px solid var(--primary-color) !important;
  margin-right: 8px;
  transform: translateX(-4px);
  transition: all 0.2s ease;
}

/* Drop target - SOPRA (List) */
.task-item.drop-target-above {
  border-top: 4px solid var(--primary-color) !important;
  margin-top: 8px;
  transform: translateY(4px);
  transition: all 0.2s ease;
}

/* Drop target - SOTTO (List) */
.task-item.drop-target-below {
  border-bottom: 4px solid var(--primary-color) !important;
  margin-bottom: 8px;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

/* Hover per raggruppamento */
.task-item.group-hover {
  border: 4px dashed #ffa500 !important;
  background: linear-gradient(135deg, #fff9e6 0%, #ffe4ca 100%) !important;
  transform: scale(1.08) !important;
  box-shadow: 0 12px 32px rgba(255, 165, 0, 0.5),
    inset 0 0 20px rgba(255, 165, 0, 0.2);
  animation: groupHoverPulse 1.2s ease-in-out infinite;
  position: relative;
  z-index: 100;
  margin: 12px !important;
}

.task-item.group-hover::before {
  content: "Realeas to group";
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ffa500 0%, #ff8800 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: bold;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(255, 165, 0, 0.5);
  z-index: 1000;
  animation: tooltipFloat 1.5s ease-in-out infinite;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.task-item.group-hover::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 10px;
  background: radial-gradient(
    circle at center,
    rgba(255, 165, 0, 0.15),
    transparent
  );
  pointer-events: none;
}

@keyframes groupHoverPulse {
  0%,
  100% {
    box-shadow: 0 12px 32px rgba(255, 165, 0, 0.5),
      inset 0 0 20px rgba(255, 165, 0, 0.2);
  }
  50% {
    box-shadow: 0 16px 40px rgba(255, 165, 0, 0.7),
      inset 0 0 30px rgba(255, 165, 0, 0.3);
  }
}

@keyframes tooltipFloat {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}

/* Task raggruppata (badge visivo) */
.task-item.is-group {
  border-left: 5px solid #ffa500 !important;
  background: linear-gradient(135deg, #fffbf0 0%, #fff4e0 100%) !important;
}

.task-item.is-group .task-text::before {
  content: "🗂️ ";
  margin-right: 6px;
  font-size: 16px;
}

/* Migliora il cursore durante drag */
.task-item[draggable="true"] {
  cursor: grab;
  touch-action: none;
}

.task-item[draggable="true"]:active {
  cursor: grabbing;
}

.drag-handle {
  cursor: grab !important;
  touch-action: none;
}

.drag-handle:active {
  cursor: grabbing !important;
}

/* Transizioni smooth */
.task-item:not(.dragging) {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile: aumenta la zona di drop e indicatori */
@media (max-width: 768px) {
  .task-item.drop-target-left {
    margin-left: 12px;
  }

  .task-item.drop-target-right {
    margin-right: 12px;
  }

  .task-item.drop-target-above {
    margin-top: 12px;
  }

  .task-item.drop-target-below {
    margin-bottom: 12px;
  }

  .drop-indicator {
    box-shadow: 0 0 16px var(--primary-color);
  }

  .task-item.group-hover::before {
    font-size: 11px;
    padding: 6px 12px;
    top: -35px;
  }

  .sidebar-page .main-content,
  .sidebar-page .sidebar {
    width: 100%;
  }

  .sidebar-page .sidebar .sidebar-card {
    position: relative;
  }
}

/* High contrast mode */
body.high-contrast .drop-indicator {
  background: #ff0000 !important;
  box-shadow: 0 0 20px #ff0000 !important;
}

body.high-contrast .task-item.drop-target-left,
body.high-contrast .task-item.drop-target-right,
body.high-contrast .task-item.drop-target-above,
body.high-contrast .task-item.drop-target-below {
  border-color: #ff0000 !important;
}

body.high-contrast .task-item.group-hover {
  border: 5px dashed #ff8800 !important;
  background: #fffacd !important;
}

body.high-contrast .task-item.group-hover::before {
  background: #ff8800 !important;
  border: 3px solid #000 !important;
  color: #000 !important;
  font-weight: 900 !important;
}

/* Vista griglia vs lista: assicura che gli indicatori siano corretti */
.tasks-grid .drop-indicator {
  /* Verticale per griglia */
  min-width: 4px;
}

.tasks-list .drop-indicator {
  /* Orizzontale per lista */
  min-height: 4px;
}

.sidebar-page .container {
  display: flex;
  gap: 100px;
  padding-top: 50px;
  justify-content: space-between;
}

.sidebar {
  width: 30%;
  display: flex;
  justify-content: end;
}

.sidebar-page .main-content {
  width: 60%;
}

.sidebar-card {
  position: fixed;
  top: 120px;
  background-color: var(--background-items);
  padding: 21px 21px;
  border-radius: 7px;
}

.sidebar-card h4 {
  font-size: 28px;
  line-height: 1;
  margin: 0px;
  margin-bottom: 7px;
}

.sidebar-card a {
  color: var(--text-color);

  text-decoration: none;
  width: 100%;
}

.sidebar-card li:last-of-type {
  width: 100%;
  margin-top: 3.5px;
  display: flex;
  align-items: center;
}

.sidebar-card li:last-of-type a {
  text-align: center;
  color: var(--text-color-white);
  font-weight: 600;
}

.sidebar-card ul {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar-page .main-content ul li,
.sidebar-page .main-content ol li,
.sidebar-page .main-content ul,
.sidebar-page .main-content ol {
  line-height: 1.3;
}

.sidebar-page .main-content ul li,
.sidebar-page .main-content ol li,
.sidebar-page .main-content summary {
  margin: 3.5px 0px;
}

.sidebar-page .main-content ul,
.sidebar-page .main-content ol {
  margin: 7px 0px;
  list-style: disc;
  padding-left: 21px;
}

.sidebar-page .main-content .final-cta {
  margin-top: 49px;
  padding: 21px 0px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background-color: var(--background-items);
  border-radius: 7px;
  gap: 3.5px;
}
.sidebar-page .main-content .final-cta h3 {
  margin: 0px;
}
.sidebar-page .main-content .final-cta a {
  text-decoration: none;
  margin-top: 14px;
}

/*pRIVACY*/

.privacy-page h2,
.terms-page h2,
.app h2 {
  font-size: 21px;
}

.app h2 {
  color: #505050;
}

/*bLOG*/

.blog-page h1 {
  line-height: 1;
  font-size: 28px;
}

.blog-page header p {
  display: flex;
  flex-wrap: wrap;

  align-items: start;
  gap: 14px;
}

.blog-index-page .post-card {
  margin-top: 21px;
  background: var(--background-items);
  display: flex;
  flex-direction: column;
  align-items: start;
}

.blog-index-page .post-card .btn {
  margin-top: 21px;
  text-decoration: none;
}
.blog-index-page h1 {
  margin-bottom: 21px;
}

.single-post-page img {
  width: 100%;
  height: 100%;
  margin: 21px 0px;
  -webkit-box-shadow: 4px 4px 10px 2px rgba(0, 0, 0, 0.21);
  box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.21);
}
.single-post-page a:not(a.btn, .sidebar-card a) {
  color: var(--primary-color);
}

/* ============================================
     HIGH CONTRAST MODE
     ============================================ */

body.high-contrast {
  background: #000 !important;
}

body.high-contrast .container {
  background: #fff !important;
  border: 3px solid #000 !important;
}

body.high-contrast .input-section,
body.high-contrast .stat-card,
body.high-contrast .ad-space {
  background: #fff !important;
  border: 2px solid #000 !important;
}

body.high-contrast #taskInput,
body.high-contrast #listTitle {
  border: 2px solid #000 !important;
  background: #fff !important;
  color: #000 !important;
}

body.high-contrast .task-item {
  background: #fff !important;
  border: 2px solid #000 !important;
}

body.high-contrast .task-item.priority-alta {
  background: #ffe0e0 !important;
  border: 3px solid #ff0000 !important;
}

body.high-contrast .task-item.priority-media {
  background: #fff4e0 !important;
  border: 3px solid #ff8800 !important;
}

body.high-contrast .task-item.priority-bassa {
  background: #e0ffe0 !important;
  border: 3px solid #00aa00 !important;
}

body.high-contrast .priority-dot,
body.high-contrast .priority-mini-btn,
body.high-contrast button {
  border: 2px solid #000 !important;
}

body.high-contrast .stat-number,
body.high-contrast #listTitle {
  color: #000 !important;
  font-weight: 900 !important;
}

/* Tooltips per icone in modalità accessibilità */
body.high-contrast [title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: bold;
  z-index: 10000;
  margin-bottom: 5px;
}

/* Aumenta dimensioni elementi interattivi */
body.high-contrast button,
body.high-contrast input[type="checkbox"] {
  min-width: 44px !important;
  min-height: 44px !important;
}

body.high-contrast .task-text {
  font-size: 16px !important;
  line-height: 1.6 !important;
  font-weight: 600 !important;
}

/* Focus visibile */
body.high-contrast *:focus {
  outline: 3px solid #0066ff !important;
  outline-offset: 2px !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .container {
    padding: 0px 20px;
  }
  .app > .container:first-of-type {
    display: flex;
    flex-direction: column;
  }
  .ad-space {
    display: none;
  }
  .modal {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-content {
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
  }

  .checklist-instructions {
    padding: 15px;
  }

  .checklist-instructions ol {
    padding-left: 18px;
  }

  .preview-text {
    font-size: 12px;
    min-height: 120px;
  }

  .input-section {
    order: 4;
    padding: 21px;
  }

  .input-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .stats {
    display: none;
  }

  #taskInput {
    width: 50%;
  }

  .input-row .btn {
    width: 100%;
  }

  .group-btn:not(.group-btn:first-of-type) {
    font-size: 0px;
  }

  .tasks-container {
    max-height: 30vh;
  }

  .site-header .nav {
    display: none;
  }
  .controls-row > div:first-of-type {
    width: 100%;
    align-items: center;
  }

  .a11y-toggle {
    display: none;
  }

  .priority-mini-btn {
    width: 28px;
    height: 28px;
  }
  .group-selector {
    align-items: center;
  }
  .task-edit-input {
    font-size: 16px; /* Previene zoom su iOS */
  }
}
