:root {
  --accent: #ff8800;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #222;
  --muted: #666;
}

* {
box-sizing: border-box;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

/* ========== HEADER ==========*/
header {
  background: white;
  border-bottom: 1px solid #ddd;
  padding: 16px 32px;
}

.header-home {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.header-logo {
  height: 50px;
  width: 50px;
  object-fit: contain;
}

header .logo {
  font-weight: 700;
  font-size: 30px;
  color: var(--accent);
}

/* Patreon */
.header-patreon {
  position: absolute;
  top: 0px;           /* distanza dal bordo superiore dell'header */
  right: 20px;         /* distanza dal bordo destro dell'header */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #ff8800;
  font-size: 0.85rem;
}

.header-patreon .patreon-logo {
  width: 60px;
  height: 60px;
  margin-bottom: 2px;  /* spazio minimo tra logo e testo */
  transition: transform 0.2s; /* smooth per l'animazione */
}

/* Hover: scuotimento */
.header-patreon:hover .patreon-logo {
  animation: shake 0.5s;
  animation-iteration-count: 1;
}

.header-patreon .patreon-text {
  font-weight: bold;
  text-align: center;
  margin-top: 0px;     /* riduce ancora lo spazio se necessario */
}

/* Keyframes scuotimento */
@keyframes shake {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(-10deg); }
  20% { transform: rotate(10deg); }
  30% { transform: rotate(-10deg); }
  40% { transform: rotate(10deg); }
  50% { transform: rotate(-5deg); }
  60% { transform: rotate(5deg); }
  70% { transform: rotate(-5deg); }
  80% { transform: rotate(5deg); }
  90% { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}



/* ========== MAIN ==========*/

main {
  max-width: 1100px;
  margin: 60px auto;
  padding: 0 24px;
  text-align: center;
}

h1 {
  font-size: 42px;
  margin-bottom: 12px;
}

p.subtitle {
  color: var(--muted);
  font-size: 18px;
  margin-bottom: 48px;
}

/* ========== TOOLS CARDS ==========*/

.tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 24px;
}

.tool-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 28px 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.tool-icon {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 36px;
  color: var(--accent);
  margin-bottom: 16px;
}

.tool-logo {
  max-height: 150px;
  max-width: 150px;
  object-fit: contain;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.tool-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.tool-desc {
  font-size: 14px;
  color: var(--muted);
}

footer {
  margin-top: 80px;
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ========== TOOLS PAGES ==========*/

.tool-page {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  max-width: 1100px;
  margin: 60px auto;
  padding: 0 24px;
}

/* Sidebar */
.tool-sidebar {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Switch */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.switch-toggle {
  position: relative;
  width: 42px;
  height: 22px;
}

.switch-toggle input {
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 22px;
  cursor: pointer;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.slideri {
  position: absolute;
  inset: 0;
  background: #37a1cabe;
  border-radius: 22px;
  cursor: pointer;
}

.slideri::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch-toggle input:checked + .slider {
  background: #ff8800;
}

.switch-toggle input:checked + .slider::before {
  transform: translateX(20px);
}

.switch-toggle input:checked + .slideri {
  background: #ff8800;
}

.switch-toggle input:checked + .slideri::before {
  transform: translateX(20px);
}

/* Bottone */
.convert-btn {
  background: #ff8800;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

.convert-btn:hover {
  background: #ff8800d0;
}


/* Switch con immagini laterali */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.switch-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
}

.switch-side img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.switch-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}


/* ========== DROP AREA ==========*/
.drop-area {
  background: white;
  border: 2px dashed #ddd;
  border-radius: 16px;
  padding: 32px;
  min-height: 260px;

  display: grid;
  grid-template-columns: repeat(auto-fill, 96px);
  gap: 20px;
  justify-content: center;
  align-content: start;

  position: relative;
  text-align: center;
}

.drop-area.dragover {
  border-color: #ff8800;
  background: #fff5f5;
}

.drop-hint {
  grid-column: 1 / -1;
  color: #888;
  font-size: 16px;
}

.drop-area input[type="file"] {
  display: none;
}

/* File icon */
.file-item {
  width: 96px;
  text-align: center;
  font-size: 12px;
  cursor: default;
}

.file-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 6px;
  background: url("immagini/nbt.png") center / contain no-repeat;
}

.file-name {
  word-break: break-word;
}




/* ======================== MUSIC EDITOR ===================================*/

.music-editor {
  flex: 1;
  display: flex;
  justify-content: center; /* centro orizzontalmente */
  align-items: flex-start; /* allineato in alto */
  background: #fefefe;
  border: 1px solid #ccc;
  margin: 0;
  padding: 1rem;
}

#sheet-canvas {
  display: block;
  width: 101%;      /* occupa tutta la larghezza disponibile */
  height: 400px;    /* altezza del pentagramma */
  background-color: #fff;
  border: 2px solid #000;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
  cursor: crosshair;
}


/* ======================== RESPONSIVE MEDIA QUERIES ===================================*/

/* Tablet e dispositivi medi */
@media (max-width: 1024px) {
  .tools {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .tool-page {
    grid-template-columns: 200px 1fr;
    gap: 24px;
  }

  .tool-sidebar {
    padding: 20px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  /* Header */
  header {
    padding: 12px 16px;
    position: relative;
  }

  header .logo {
    font-size: 22px;
  }

  .header-logo {
    height: 40px;
    width: 40px;
  }

  .header-patreon {
    position: static;
    margin-top: 12px;
    top: auto;
    right: auto;
    font-size: 0.75rem;
  }

  .header-patreon .patreon-logo {
    width: 45px;
    height: 45px;
    margin-bottom: 2px;
  }

  /* Main content */
  main {
    margin: 40px auto;
    padding: 0 16px;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 8px;
  }

  p.subtitle {
    font-size: 14px;
    margin-bottom: 32px;
  }

  /* Tools grid */
  .tools {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
  }

  .tool-card {
    padding: 20px 16px;
    border-radius: 8px;
  }

  .tool-icon {
    height: 80px;
    margin-bottom: 12px;
  }

  .tool-logo {
    max-height: 100px;
    max-width: 100px;
  }

  .tool-title {
    font-size: 16px;
  }

  .tool-desc {
    font-size: 12px;
  }

  /* Tool page layout - single column su mobile */
  .tool-page {
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 40px auto;
  }

  .tool-sidebar {
    padding: 16px;
  }

  /* Switch */
  .switch {
    font-size: 13px;
  }

  .switch-row {
    gap: 12px;
  }

  .switch-side {
    width: 60px;
  }

  .switch-side img {
    width: 48px;
    height: 48px;
  }

  .switch-text {
    font-size: 11px;
  }

  /* Button */
  .convert-btn {
    padding: 12px;
    font-size: 14px;
  }

  /* Drop area */
  .drop-area {
    padding: 24px;
    min-height: 200px;
    grid-template-columns: repeat(auto-fill, 80px);
    gap: 16px;
  }

  .drop-hint {
    font-size: 14px;
  }

  .file-item {
    width: 80px;
    font-size: 11px;
  }

  .file-icon {
    width: 56px;
    height: 56px;
  }

  /* Music editor */
  .music-editor {
    padding: 0.75rem;
  }

  #sheet-canvas {
    height: 300px;
  }

  footer {
    margin-top: 60px;
    padding: 16px;
    font-size: 12px;
  }
}

/* Telefoni piccoli */
@media (max-width: 480px) {
  header {
    padding: 10px 12px;
  }

  header .logo {
    font-size: 18px;
  }

  .header-logo {
    height: 35px;
    width: 35px;
  }

  .header-patreon .patreon-logo {
    width: 40px;
    height: 40px;
  }

  .header-patreon .patreon-text {
    font-size: 0.65rem;
  }

  main {
    margin: 30px auto;
    padding: 0 12px;
  }

  h1 {
    font-size: 24px;
  }

  p.subtitle {
    font-size: 13px;
    margin-bottom: 24px;
  }

  .tools {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tool-card {
    padding: 16px 12px;
  }

  .tool-icon {
    height: 70px;
    margin-bottom: 10px;
  }

  .tool-logo {
    max-height: 80px;
    max-width: 80px;
  }

  .tool-title {
    font-size: 15px;
  }

  .tool-desc {
    font-size: 12px;
  }

  .tool-sidebar {
    padding: 12px;
  }

  .switch {
    font-size: 12px;
    gap: 8px;
  }

  .switch-side {
    width: 50px;
  }

  .switch-side img {
    width: 40px;
    height: 40px;
  }

  .convert-btn {
    padding: 10px;
    font-size: 13px;
  }

  .drop-area {
    padding: 16px;
    min-height: 150px;
    grid-template-columns: repeat(auto-fill, 70px);
    gap: 12px;
  }

  .drop-hint {
    font-size: 13px;
  }

  .file-item {
    width: 70px;
    font-size: 10px;
  }

  .file-icon {
    width: 48px;
    height: 48px;
  }

  #sheet-canvas {
    height: 250px;
  }

  footer {
    margin-top: 40px;
    padding: 12px;
  }
}


