/* Основен контейнер – центриране и контрол на ширината */
.custom-caricature-options {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 15px;
  box-sizing: border-box;
}

/* Заглавия */
.custom-caricature-options h3 {
  font-size: 1.15em;
  margin: 25px 0 8px;
  color: #333;
  text-transform: uppercase;
  text-align: center; /* Центриране на заглавията */
}

/* Групи от опции */
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center; /* Центриране на бутоните */
}

/* Единичен бутон за избор */
.option {
  display: inline-flex;
  align-items: center;
  background: #edf9fc;
  border: 2px solid #52cef7;
  border-radius: 30px;
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.option input {
  display: none;
}

.option:has(input:checked) {
  background: #52cef7;
  color: #1a1a1a;
  border-color: #52cef7;
  box-shadow: 0 0 0 3px rgba(7, 127, 255, 0.4);
}

.option .price {
  margin-left: 8px;
  font-weight: bold;
  color: #1a1a1a;
}

/* Допълнителни полета (3+ лица, тип рамка) */
#persons-extra,
#frame-types {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

#persons-extra button {
  background: #52cef7;
  color: #1a1a1a;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.4em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}

#persons-extra button:hover {
  background: #52cef7;
}

#persons-count {
  width: 60px;
  text-align: center;
  border: 2px solid #edf9fc;
  border-radius: 8px;
  padding: 6px 0;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Динамична цена за 3+ лица */
#persons-extra-price {
  font-weight: bold;
  color: #000000;
  margin-left: 15px;
  align-self: center;
}

/* Формуляри */
textarea,
input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #edf9fc;
  border-radius: 8px;
  font-size: 1em;
  box-sizing: border-box;
  margin-bottom: 10px;
}

/* Тотал */
#total-price {
  font-size: 1.35em;
  font-weight: bold;
  color: #007bff;
  text-align: center;
  margin: 30px 0;
  padding: 12px;
  background: #f0f8ff;
  border-radius: 12px;
}

/* Календар – основни стилове */
.datepicker-wrapper {
  display: flex;
  justify-content: center;
}

#datepicker-container {
  width: 100%;
  max-width: 420px !important; /* Фиксирана ширина за десктоп – не се разтяга */
  margin: 20px auto;
}

#datepicker-container .ui-datepicker {
  width: 100% !important;
  padding: 12px;
  background: #ffffff;
  border: 2px solid #52cef7;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

#datepicker-container .ui-datepicker-header {
  background: #52cef7;
  color: #1a1a1a;
  border-radius: 8px 8px 0 0;
  padding: 10px;
  font-size: 1.15em;
}

#datepicker-container .ui-datepicker-title {
  font-weight: bold;
}

#datepicker-container .ui-datepicker-calendar {
  width: 100% !important;
  border-collapse: separate;
  border-spacing: 4px;
}

#datepicker-container .ui-datepicker-calendar th,
#datepicker-container .ui-datepicker-calendar td {
  width: 14.2857% !important;
  height: 44px !important;
  text-align: center;
  vertical-align: middle;
  padding: 0 !important;
}

#datepicker-container .ui-datepicker-calendar td a,
#datepicker-container .ui-datepicker-calendar td span {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50% !important;
  text-decoration: none;
  color: #333;
  font-size: 1em;
  transition: all 0.2s;
}

/* Неделя – кръгла и червена */
#datepicker-container .ui-datepicker-calendar td:last-child a,
#datepicker-container .ui-datepicker-calendar td:last-child span {
  background: #ffebee !important;
  color: #d32f2f !important;
  font-weight: 600 !important;
}

/* Примерна снимка */
img[alt="Примерна снимка за качване"] {
  display: block;
  margin: 0 auto 20px;
  max-width: 320px; /* Намалена за по-добър баланс */
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Красив upload зона с drag & drop */
.custom-file-upload {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 20px auto;
  text-align: center;
}

.file-label {
  display: block;
  background: #edf9fc;
  border: 2px dashed #edf9fc;
  border-radius: 12px;
  padding: 30px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-label:hover,
.file-label.drag-over {
  background: #edf9fc;
  border-color: #52cef7;
  box-shadow: 0 0 15px rgba(7, 127, 255, 0.4);
}

.file-button {
  display: inline-block;
  background: #52cef7;
  color: #1a1a1a;
  padding: 12px 30px;
  border-radius: 8px;
  font-weight: bold;
  margin-bottom: 12px;
  transition: background 0.2s;
}

.file-button:hover {
  background: #52cef7;
}

.file-name {
  display: block;
  color: #555;
  font-size: 1em;
}

#photo-upload {
  display: none;
}

/* Drag & drop ефект */
.drag-over {
  border-style: solid !important;
  border-width: 3px !important;
}

/* Когато има избран файл */
.file-name.selected {
  color: #2e7d32;
  font-weight: bold;
}

/* Премахване на всякакъв overflow */
body,
html,
.site-content,
.woocommerce div.product {
  overflow-x: hidden !important;
}

.ui-datepicker,
.ui-datepicker * {
  box-sizing: border-box !important;
}

/* Десктоп – леко подобрение на подреждането (по-равномерно) */
@media (min-width: 769px) {
  .option-group {
    justify-content: center; /* Центриране вместо flex-start */
    gap: 12px;
  }

  #persons-extra,
  #frame-types {
    justify-content: center;
  }
}

/* По-компактни полета и календар на мобилно */
@media (max-width: 768px) {
  .custom-caricature-options {
    padding: 0 8px; /* По-малко странично пространство */
  }

  /* Опции (бутони) – по-малки и по-високи */
  .option {
    padding: 8px 14px;
    font-size: 0.95em;
    min-height: 48px;
    align-items: center;
  }

  /* Групи от бутони – вертикално, но по-стегнато */
  .option-group {
    gap: 8px !important;
  }

  .option {
    margin: 6px auto !important;
    width: auto !important;
    max-width: 100%;
  }

  /* Допълнителни полета (3+ лица, тип рамка) */
  #persons-extra,
  #frame-types {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
  }

  #persons-extra button {
    width: 32px !important;
    height: 32px !important;
    font-size: 1.2em !important;
  }

  #persons-count {
    width: 60px !important;
  }

  #datepicker-container {
    max-width: 100% !important;
    margin: 10px 0 !important;
  }

  #datepicker-container .ui-datepicker {
    width: 100% !important;
    font-size: 0.88em !important;
    padding: 6px !important;
  }

  /* Центриране на всички опции/бутони/групи */
  .option-group,
  #persons-extra,
  #frame-types,
  .custom-file-upload,
  .datepicker-wrapper {
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
  }

  /* Премахване на всякакъв offset вдясно */
  .custom-caricature-options * {
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .file-label {
    padding: 20px 10px !important;
    font-size: 0.95em !important;
  }

  textarea,
  input[type="text"],
  input[type="file"] {
    padding: 8px !important;
    font-size: 0.95em !important;
  }

  #total-price {
    font-size: 1.3em !important;
    padding: 12px !important;
  }
}

/* Полета за тип рамка – повече пространство */
#frame-types {
  gap: 18px !important; /* Увеличен gap между A4, A3, A2, A1 */
  margin-top: 15px !important;
}

#frame-types .option {
  padding: 12px 20px !important; /* По-голямо padding вътре в бутоните */
  min-width: 140px !important; /* По-широки бутони за четимост */
  justify-content: center !important;
}

/* На мобилно – още повече пространство */
@media (max-width: 768px) {
  #frame-types {
    gap: 12px !important;
    flex-direction: column !important; /* Ако са много – подрежда ги вертикално */
  }

  #frame-types .option {
    width: 100% !important;
    padding: 14px !important;
  }
}

/* Почивни дни - СЪБОТА и НЕДЕЛЯ (леко и елегантно оцветяване) */
#datepicker-container .ui-datepicker-calendar td.ui-state-disabled.weekend a,
#datepicker-container
  .ui-datepicker-calendar
  td.ui-state-disabled.weekend
  span {
  background: #ffebee !important;
  color: #d32f2f !important;
  font-weight: 600 !important;
}

/* Минали дати - остават нормално сиви (без червено) */
#datepicker-container
  .ui-datepicker-calendar
  td.ui-state-disabled:not(.weekend)
  a,
#datepicker-container
  .ui-datepicker-calendar
  td.ui-state-disabled:not(.weekend)
  span {
  background: #f5f5f5 !important;
  color: #9e9e9e !important;
}

/* Общо за disabled дни - по-добър вид */
#datepicker-container .ui-datepicker-calendar td.ui-state-disabled {
  cursor: not-allowed !important;
  opacity: 0.85 !important;
}
