/* === GLOBAL === */
html, body {
  overflow-x: hidden !important;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f5f5;
  color: #333;
}

/* === OSNOVNI KONTEJNER === */
#editor-container {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: visible;
}

/* === LEVI PANEL === */
.vertical-panel {
  display: flex;
  flex-direction: column;
  width: 8%;
  min-width: 90px;
  max-height: 100vh;
  background-color: #ffffff;
  border-right: 1px solid #ddd;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: #c0c0c0 #f5f5f5;
}

.vertical-panel::-webkit-scrollbar {
  width: 8px;
}
.vertical-panel::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 4px;
}
.vertical-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ccc, #aaa);
  border-radius: 6px;
  border: 2px solid #f5f5f5;
}

.vertical-panel .section {
  padding: 12px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 0.5px solid #eee;
  transition: all 0.3s ease;
  border-left: 1px solid transparent;
  background-color: #fff;
}
.vertical-panel .section:hover {
  background: linear-gradient(135deg, #fefefe, #f7faff);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  transform: translateX(2px);
  transition: all 0.25s ease;
}

/* Aktivna sekcija */
.vertical-panel .section.active {
  background: linear-gradient(135deg, #fdfbff, #f1f7ff);
  font-weight: 600;
  color: #333;
  box-shadow: inset 0 0 10px rgba(160, 180, 255, 0.25),
              0 3px 8px rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  transform: translateX(2px);
  transition: all 0.25s ease;
}
/* === CENTRALNI DEO === */
.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 10px 20px 0;
  overflow-y: auto;
  background: #fff;
}

#wave-display {
  width: 100%;
  max-width: 1000px;
  background-color: #fefeff;
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

#wave-display-central {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

#waveCanvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 20px auto 0;
  border: 1px solid #ccc;
  background: transparent;
}

#waveform {
  width: 100%;
  height: 1px !important;
  background: transparent;
}

/* === DESNI PANEL === */
.vertical-functions-panel {
  min-width: 180px;
  max-width: 25%;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #ddd;
  padding: 10px;
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.05);
  max-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: #c0c0c0 #f5f5f5;
}

.vertical-functions-panel::-webkit-scrollbar {
  width: 8px;
}
.vertical-functions-panel::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 4px;
}
.vertical-functions-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ccc, #aaa);
  border-radius: 6px;
  border: 2px solid #f5f5f5;
}

.functions-section {
  margin-bottom: 20px;
  padding: 12px;
  background: linear-gradient(120deg, #fdfdff, #f5f6fa);
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.functions-section:hover {
  background: linear-gradient(120deg, #f5f7fa, #eef1f7);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transform: scale(1.02);
}

/* === BOJE I GRADIJENTI === */
.color-option, .gradient-option {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  margin: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  display: inline-block;
  box-shadow: 0 0 4px rgba(0,0,0,0.08);
  transition: all 0.2s ease;
}
.color-option:hover, .gradient-option:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.color-option.selected, .gradient-option.selected {
  border: 2px solid #0077cc;
  box-shadow: 0 0 8px rgba(0, 119, 204, 0.4);
}

/* === AUDIO, TEMPLATE I DODATNI ELEMENTI === */
#song-controls { margin-top: 15px; }
#song-results { margin-top: 10px; max-height: 300px; overflow-y: auto; }
.song-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-bottom: 1px solid #ccc; }

.template-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* OVO ČUVA DVA REDA */
  gap: 12px;
  justify-items: center;
  align-items: start;
  padding: 10px 0;
}

.template-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  color: #444;
  cursor: pointer;
  transition: all 0.2s ease;
}
.template-item:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.template-icon {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 5px;
  background-color: #fff;
  transition: all 0.2s ease;
}
.template-item:hover .template-icon {
  border-color: #a88cff;
  box-shadow: 0 0 8px rgba(168, 140, 255, 0.3);
}

/* === SHAPE SELECTION === */
.shape-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}
.shape-selection-icons {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* OVO ČUVA DVA REDA */
  gap: 12px;
}
.shape-selection > .shape-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 70px;
  padding: 8px;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #f9f9f9;
}
.shape-selection > .shape-option:hover {
  transform: scale(1.08);
  background: linear-gradient(120deg, #f5f8fc, #eef5f9);
  border-color: #00aaff;
  box-shadow: 0 2px 10px rgba(0,170,255,0.2);
}
.shape-selection > .shape-option.selected {
  border-color: #0077cc;
  background: linear-gradient(120deg, #d0ebff, #ccefff);
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

/* === DOWNLOAD BUTTON === */
#downloadOrOrder { margin-top: 30px; }
.icon {
  width: 40px !important;   /* širina ikone */
  height: 40px !important;  /* visina ikone */
  margin-bottom: 5px !important; /* razmak između ikone i natpisa */
}
.icon svg {
  width: 40px !important;
  height: 40px !important;
  display: block !important;
}
.vertical-panel .section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.controls {
  display: flex;
  flex-direction: column;
  max-width: 300px;
  margin: 0 auto;
   margin-top: 25px !important;
}

.controls .control-group {
  margin-bottom: 12px; /* razmak između grupa label+input */
}

.controls label {
  display: block;
  margin-bottom: 4px; /* razmak između labela i slajdera */
  font-size: 14px;
  color: #333;
}

.controls input[type="range"] {
  width: 100%;
  margin: 0;
}
#canvas-size-options {
  width: 160px;                /* širina dropdown-a */
  padding: 6px 10px;           /* unutrašnji razmak */
  border: 1px solid #ccc;      /* svetlo sivi okvir */
  border-radius: 8px;           /* zaobljeni uglovi */
  background-color: #f9f9f9;   /* svetla pozadina */
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;            /* uklanja default browser stil */
  -webkit-appearance: none;
  -moz-appearance: none;
  position: relative;
}

/* Hover efekat */
#canvas-size-options:hover {
  border-color: #0077cc;
  background-color: #fff;
}

/* Focus efekat */
#canvas-size-options:focus {
  outline: none;
  border-color: #0077cc;
  box-shadow: 0 0 5px rgba(0, 119, 204, 0.3);
  background-color: #fff;
  margin-bottom: 10px;
}

/* Strelica u modernom stilu */
#canvas-size-options::-ms-expand {
  display: none; /* za IE */
}

/* Opcionalno: dodaj pseudo element za strelicu */
#canvas-size-options-wrapper {
  position: relative;
  display: inline-block;
}
#canvas-size-options-wrapper::after {
  content: '▾';           /* strelica */
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #555;
  font-size: 12px;
}
#apply-canvas-size {
  margin-top: 10px; /* razmak iznad dugmeta */
}
#search-button {
  margin-top: 10px; /* razmak iznad dugmeta */
}
/* Stil upload sekcije */
#upload-functions {
  display: block;
  text-align: center;  /* centrira input */
  padding: 8px 0;
}

/* Smanjen i moderan input fajla */
#upload-audio {
  margin-top: 6px;          /* razmak od vrha sekcije */
  padding: 6px 10px;        /* unutrašnji padding */
  width: 70%;               /* smanjuje širinu da ne prelazi panel */
  max-width: 200px;         /* maksimalna širina */
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: #f5f5f5;  /* neutralna svetla boja */
  cursor: pointer;
  font-size: 13px;          /* manja font veličina da stane u input */
  transition: all 0.2s ease;
}

#upload-audio:hover {
  border-color: #999;       /* neutralan hover efekt */
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
#text-functions button.add-text + button.add-text {
  margin-top: 10px; /* razmak između dugmadi */
}
.print-product-info select {
  -webkit-appearance: none !important; /* Safari/Chrome */
  -moz-appearance: none !important;    /* Firefox */
  appearance: none !important;         /* Standard */
  background-color: #f5f5f5 !important; /* neutralna pozadina */
  border: 1px solid #ccc !important;
  border-radius: 6px !important;       /* zaobljene ivice */
  padding: 6px 30px 6px 10px !important; /* prostor za strelicu */
  font-size: 14px !important;
  color: #333 !important;
  cursor: pointer !important;
  min-width: 80px !important;
  transition: all 0.2s ease;
}

/* Hover i fokus efekti */
.print-product-info select:hover {
  border-color: #888 !important;
  background-color: #f0f0f0 !important;
}

.print-product-info select:focus {
  outline: none !important;
  border-color: #0077cc !important;
  box-shadow: 0 0 4px rgba(0, 119, 204, 0.3) !important;
}

/* Custom strelica desno */
.print-product-info select {
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23333' stroke-width='2' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 12px 8px !important;
}
/* Stil za sve dugmadi unutar print sekcije koja su korpa */
.print-product-info button {
  all: unset;               /* uklanja sve default i Elementor stilove */
  cursor: pointer;          /* pokazivač da je klikabilno */
  display: inline-block;
  font-size: 24px;          /* poveća ikonicu */
  line-height: 1;
  transition: transform 0.15s ease;
  margin-left: 10px;        /* razmak između dropdowna i dugmeta */
}

/* Hover efekat */
.print-product-info button:hover {
  transform: scale(1.2);
}

/* Klik efekat */
.print-product-info button:active {
  transform: scale(1.1);
}
/* 🎨 Moderni stil za upload background */
#upload-background {
  width: 100%;
  max-width: 180px;     /* da ne ide preko panela */
  padding: 8px;
  border: 2px dashed #ccc;
  border-radius: 10px;
  background: #f9f9f9;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

#upload-background:hover {
  background: #f0f0f0;
  border-color: #999;
}

#upload-background:active {
  transform: scale(0.97);
}
/* 🎚️ Labela uvek iznad slajdera */
#gradient-angle {
  display: block;      /* zauzima ceo red */
  width: 100%;         /* slajder pun širine */
  margin-top: 1px !important;     /* mali razmak od labele */
}

label[for="gradient-angle"] {
  display: block;      /* labela uvek u svom redu */
  margin-bottom: 2px;  /* razmak ispod labele */
  font-size: 14px;
  color: #333;
}
/* 📌 Spusti celu sekciju "Kreiraj gradijent" malo niže */
.background-category {
  margin-top: 30px; /* pomeri dole sekciju */
}

/* 📌 Drži Boja 1 i Boja 2 u jednom redu */
.background-category label[for="gradient-color1"],
.background-category label[for="gradient-color2"],
#gradient-color1,
#gradient-color2 {
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
}

/* 📌 Kvadratići boja da budu jasni i bez okvira */
#gradient-color1,
#gradient-color2 {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 6px; /* blago zaobljeni */
  cursor: pointer;
}

/* 📌 Ukloni default border kod color inputa u Webkitu */
#gradient-color1::-webkit-color-swatch,
#gradient-color2::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
  padding: 0;
}

/* 📌 Isto i za Firefox */
#gradient-color1::-moz-color-swatch,
#gradient-color2::-moz-color-swatch {
  border: none;
  border-radius: 6px;
}
/* 📌 Panel tekst kontrola */
#text-controls-panel {
  margin-top: 20px; /* spusti panel malo */
  display: flex;
  flex-direction: column;
  gap: 12px; /* razmak između kontrola */
  max-width: 250px;
}

/* 📌 Boja kvadratić */
#text-controls-panel input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 36px;
  border: none;
  padding: 0;
  border-radius: 6px;
  vertical-align: middle;
  cursor: pointer;
}

/* Safari/Webkit kvadratići */
#text-controls-panel input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
  padding: 0;
}

/* Firefox kvadratići */
#text-controls-panel input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 6px;
}

/* 📌 Number input za veličinu slova */
#text-size {
  width: 60px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #ccc;
  outline: none;
}

/* 📌 Font select modernizacija */
#text-font {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  appearance: none; /* uklanja default stil */
}

/* 📌 Slider za rotaciju */
#text-rotate {
  width: 100%;
}

/* 📌 Labela i kontrola u redu (Boja, Veličina, Font) */
#text-controls-panel label {
  display: flex;
  align-items: center;
  gap: 8px; /* razmak između teksta i inputa */
}
@media only screen and (max-width: 768px) {
  #editor-container {
    flex-direction: column;
  }

  /* Centralni panel ide na vrh */
  #wave-display {
    order: 0;
    width: 100%;
    margin: 0 auto 10px auto;
    padding: 8px;
    background: rgb(218, 202, 230);
    position: relative;
  }

  #waveCanvas {
    width: 100%;
    height: auto;
    display: block;
    max-height: 180px !important;
  }

  /* Prvi vertikalni panel klizno odmah ispod talasa, vizuelno bliže */
  .vertical-panel {
    order: 1;
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 5px;
    gap: 8px;
    scrollbar-width: none;

    /* pomeranje po Y osi bez uticaja na flow */
    transform: translateY(-3px);
  }
  .vertical-panel::-webkit-scrollbar { display: none; }

  /* Drugi vertikalni panel (funkcije) fiksno ispod kliznog panela */
  .vertical-functions-panel {
    order: 2;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
    padding: 5px;
    margin-bottom: 10px;
    border-top: 1px solid #ddd;
    box-sizing: border-box;
    position: relative; /* da ostane u svom flow */
    z-index: 10;
  }

  /* Dugmad unutar funkcijskog panela */
  .vertical-functions-panel .functions-section {
    flex: 0 1 auto;
    min-width: 80px;
    position: relative; /* za apsolutno otvaranje sadržaja */
  }

  /* Otvaranje funkcija ne pomera ništa gore */
  .vertical-functions-panel .functions-section .function-content {
    position: absolute; /* otvara se preko ostalog sadržaja */
    top: 100%; /* odmah ispod dugmeta */
    left: 0;
    width: max-content;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 20;
  }
}
@media only screen and (max-width: 768px) {

  /* Sve funkcijske sekcije – mobilni stil */
  .functions-section {
    width: 100%;
    border-radius: 10px;
    padding: 10px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  }

  /* Kad se sekcija otvori – iskače PREKO, ne pomera talas */
  .functions-section .function-content {
    position: fixed !important;
    top: 55%; /* ispod talasa */
    left: 0;
    width: 100%;
    height: auto;
    max-height: 45vh;
    overflow-y: auto;
    background: #fff;
    border-top: 2px solid #ddd;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    border-radius: 12px 12px 0 0;
    z-index: 999;
    padding: 15px 10px;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  /* Animacija otvaranja i zatvaranja */
  .functions-section .function-content.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
  }
  .functions-section .function-content.active {
    transform: translateY(0);
    opacity: 1;
  }

  /* Unutrašnji elementi da stanu lepo na mobilni ekran */
  .function-content input,
  .function-content select,
  .function-content button,
  .function-content label {
    width: 100%;
    font-size: 14px;
    margin-bottom: 8px;
    box-sizing: border-box;
  }

  /* Slideri i boje */
  .function-content input[type="range"] {
    width: 100%;
  }

  .function-content input[type="color"] {
    width: 40px;
    height: 40px;
  }

  /* Dugmad “Zatvori” unutar svake sekcije */
  .function-content .close-panel {
    display: block;
    text-align: center;
    margin: 10px auto 0;
    padding: 8px 15px;
    background: #0077cc;
    color: #fff;
    border-radius: 8px;
    width: 90%;
  }

  /* Talas ostaje fiksan – ne gura se nagore */
  #wave-display {
    position: relative;
    z-index: 1;
  }
}
/* === FIX za otvaranje funkcija (audio, print, wave, itd.) — SAMO MOBILNI === */
@media only screen and (max-width: 768px) {

  /* osnovni sloj panela */
  .vertical-functions-panel .functions-section {
    position: relative;
    z-index: 5;
  }

  /* talas ostaje iznad svega drugog, ali ne prekriven */
  #wave-display,
  #waveCanvas {
    position: relative;
    z-index: 10;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

 /* panel sekcija — otvara se odmah ispod panela sa ikonicama */
.vertical-functions-panel .functions-section[style*="display: block"] {
  position: relative !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  width: 100% !important;
  margin-top: 10px !important;
  padding: 20px 16px 30px;
  z-index: 40 !important;

  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);

  animation: slideDownSmooth 0.3s ease;
  max-height: 60vh;
  overflow-y: auto;
}

/* animacija otvaranja nadole */
@keyframes slideDownSmooth {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}


  /* ručka za prevlačenje */
  .vertical-functions-panel .functions-section[style*="display: block"]::before {
    content: "";
    display: block;
    width: 60px;
    height: 5px;
    background: #ccc;
    border-radius: 10px;
    margin: 8px auto 15px;
  }

  /* glatka animacija otvaranja */
  @keyframes slideUpSmooth {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  /* ne seci modal */
  #editor-container {
    overflow: visible !important;
  }

  /* bez horizontalnog pomeranja */
  html, body {
    overflow-x: hidden !important;
  }

  /* === PANEL SA IKONICAMA odmah ispod talasa === */
  .vertical-panel {
    position: relative !important;
    top: auto !important;
    transform: none !important;
    margin-top: -10px !important; /* sada ga lagano prilepi */
    padding-top: 0 !important;
    background: #fff;
    border-bottom: 1px solid #eee;
    z-index: 20;
  }

  .editor-main {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  /* === UKLANJANJE VIŠKA PRAZNOG PROSTORA ISPOD TALASA === */
#editor-container,
.editor-main,
#wave-display-central {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}

#wave-display {
  margin-bottom: 0 !important;
}

.vertical-panel {
  margin-top: -25px !important; /* spusti ga dodatno */
}
/* === Fix: poništi desktop visinu koja gura panel dole === */
#editor-container {
  height: auto !important;
  min-height: unset !important;
  justify-content: flex-start !important; /* rasporedi elemente od vrha */
  align-items: stretch !important;
}
/* === FINAL ALIGNMENT FIX: panel sa ikonicama odmah ispod talasa === */
.editor-main {
  position: relative !important;
  z-index: 10 !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* talas nema dodatnog dna */
#wave-display,
#wave-display-central {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* ovaj panel sada se lepi ispod talasa */
.vertical-panel {
  position: relative !important;
  top: 0 !important;
  bottom: auto !important;
  transform: none !important;
  margin-top: -5px !important; /* prilepi ga do canvasa */
  padding-top: 0 !important;
  background: #fff;
  z-index: 15 !important;
}

/* funkcijski panel ispod ikonica */
.vertical-functions-panel {
  position: relative !important;
  top: 0 !important;
  bottom: auto !important;
  margin-top: 5px !important;
  z-index: 12 !important;
}

/* ukini bilo koji globalni fix koji je držao sve dole */
#editor-container {
  height: auto !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
}

}
/* === MOBILNI FIX: razmak + lepo otvaranje panela === */
@media only screen and (max-width: 768px) {

  /* Talas i panel ikonica */
  #wave-display,
  #waveCanvas {
    position: relative;
    z-index: 10;
    margin-bottom: 0 !important;
  }

  .vertical-panel {
    position: relative !important;
    top: 0 !important;
    margin-top: 8px !important; /* dodaj lagani razmak ispod talasa */
    background: #fff;
    border-bottom: 1px solid #eee;
    z-index: 20;
  }

  /* Function panel otvaranje — kao na slici 2 */
  .vertical-functions-panel .functions-section[style*="display: block"] {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    margin: 0 auto;
    padding: 22px 18px 30px;
    z-index: 50 !important;

    background: #fff;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.25);

    animation: slideUpSmooth 0.35s ease;
    max-height: 65vh;
    overflow-y: auto;
  }

  /* Animacija otvaranja — glatko odozdo */
  @keyframes slideUpSmooth {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  /* Ručka za prevlačenje */
  .vertical-functions-panel .functions-section[style*="display: block"]::before {
    content: "";
    display: block;
    width: 55px;
    height: 5px;
    background: #ccc;
    border-radius: 10px;
    margin: 8px auto 15px;
  }

  /* Spreči preklapanje sadržaja */
  #editor-container {
    overflow: visible !important;
    height: auto !important;
  }

  html, body {
    overflow-x: hidden !important;
  }
}
/* === MOBILE FINAL FIX: fiksni talas + pozadina + funkcije + lep audio panel === */
@media only screen and (max-width: 768px) {

  /* 🔒 Talas i njegova pozadina se pomeraju zajedno (ceo blok) */
  body:has(.vertical-functions-panel .functions-section[style*="display: block"]) #wave-display {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 200 !important;
    background: rgb(207, 216, 220) !important; /* ista boja kao original */
    box-shadow: 0 2px 10px rgba(0,0,0,0.12) !important;
    margin: 0 auto !important;
    padding: 10px 12px 15px !important;
    border-radius: 0 0 16px 16px !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease-in-out;
  }

  /* 🎨 Sam canvas talasa ima mali razmak od ivica pozadine */
  body:has(.vertical-functions-panel .functions-section[style*="display: block"]) #waveCanvas {
    display: block !important;
    width: calc(100% - 20px) !important; /* razmak sa leve i desne strane */
    margin: 0 auto !important;
    border-radius: 8px !important;
    background: transparent !important;
  }

  /* 📏 Panel funkcija ide odmah ispod talasa */
  body:has(.vertical-functions-panel .functions-section[style*="display: block"]) .vertical-functions-panel {
    margin-top: 200px !important; /* visina talasa + padding */
  }

  /* 🎚️ Vertikalni panel (ikonice) */
  .vertical-panel {
    z-index: 20 !important;
  }

  /* ⚙️ Funkcijski paneli iznad ikona */
  .vertical-functions-panel {
    z-index: 50 !important;
  }

  /* 🎧 Audio panel — lep raspored i skrol unutar njega */
  #audio-functions[style*="display: block"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: #fff !important;
    border-radius: 18px !important;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.15) !important;
    z-index: 150 !important;
    padding: 15px 18px 25px !important;
    height: auto !important;
    max-height: 70vh !important;
    overflow: hidden !important;
  }

  /* 🩶 Unutrašnji skrol — prikazuje sve funkcije */
  #audio-functions .audio-scroll-zone {
    width: 100% !important;
    max-height: 65vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 10px 20px 40px !important;
    box-sizing: border-box !important;
  }

  #audio-functions .audio-scroll-zone > * {
    width: 100% !important;
    flex-shrink: 0 !important;
    margin-bottom: 12px !important;
  }

  /* 🎛️ Polje za pretragu */
  #audio-functions input[type="text"] {
    width: 90% !important;
    max-width: 320px !important;
    border: 1px solid #ccc !important;
    border-radius: 10px !important;
    padding: 10px 12px !important;
    background: #fff !important;
    font-size: 15px !important;
  }

  /* 🟣 Dugme */
  #audio-functions button {
    border: none !important;
    background: linear-gradient(135deg, #f0b3ff, #c88cff) !important;
    color: #fff !important;
    font-weight: 600 !important;
    border-radius: 25px !important;
    padding: 10px 22px !important;
    font-size: 15px !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
  }

  #audio-functions button:hover {
    background: linear-gradient(135deg, #d27bff, #a25cff) !important;
    transform: scale(1.05) !important;
  }

  /* ❌ Sakrij play/pause kontrole na mobilnom */
  #song-controls {
    display: none !important;
  }

  /* ⬆️ Nova strelica umesto sive ručke */
  .close-arrow {
    width: 45px !important;
    height: 28px !important;
    margin: 6px auto 12px auto !important;
    background: #fafafa !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important;
  }

  .close-arrow svg {
    width: 20px !important;
    height: 20px !important;
    stroke: #666 !important;
    stroke-width: 2.2px !important;
    transition: transform 0.25s ease;
  }

  .close-arrow:hover svg {
    transform: translateY(-2px);
  }

  /* Ukloni staru sivu ručku ako postoji */
  .vertical-functions-panel .functions-section[style*="display: block"]::before {
    display: none !important;
  }
}
/* === 🎯 DESKTOP FIX: centriraj talas unutar #wave-display === */
#wave-display {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 25px;       /* malo disanje unutar okvira */
  box-sizing: border-box;
}

#waveCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}
