/* Jótállás Kalkulátor Stílusok */

.jotallas-kalkulator-container {
  max-width: 600px;
  margin: 20px auto;
  padding: 25px;
  background: var(--warranty-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--warranty-shadow, rgba(0, 0, 0, 0.1));
  font-family: inherit;
  position: relative;
  /* korábban: transition: all 0.3s ease; */
  --warranty-transition-fast: 120ms;
  --warranty-transition-normal: 220ms;
  --warranty-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --warranty-border-frame: 2px;
  transition: background-color var(--warranty-transition-normal)
      var(--warranty-ease),
    color var(--warranty-transition-normal) var(--warranty-ease),
    box-shadow var(--warranty-transition-normal) var(--warranty-ease),
    border-color var(--warranty-transition-fast) linear;
  border: var(--warranty-border-frame) solid var(--warranty-border);
}

/* CSS változók - világos mód alapértelmezés */
.jotallas-kalkulator-container {
  --warranty-bg: #ffffff;
  --warranty-text: #333333;
  --warranty-border: #e0e0e0;
  --warranty-input-bg: #ffffff;
  --warranty-dropdown-bg: #ffffff;
  --warranty-hover-bg: #f5f5f5;
  --warranty-result-bg: #f8f9fa;
  --warranty-accent: #4caf50;
  --warranty-placeholder: #999999;
  --warranty-shadow: rgba(0, 0, 0, 0.1);
  --warranty-focus-shadow: rgba(76, 175, 80, 0.15);
}

/* Automatikus sötét mód detektálás */
@media (prefers-color-scheme: dark) {
  .jotallas-kalkulator-container {
    --warranty-bg: #1e1e1e;
    --warranty-text: #ffffff;
    --warranty-border: #404040;
    --warranty-input-bg: #2d2d2d;
    --warranty-dropdown-bg: #2d2d2d;
    --warranty-hover-bg: #404040;
    --warranty-result-bg: #2d2d2d;
    --warranty-placeholder: #cccccc;
    --warranty-shadow: rgba(0, 0, 0, 0.3);
    --warranty-focus-shadow: rgba(76, 175, 80, 0.25);
  }
}

/* Body sötét mód detektálás - erősebb szabályok */
body.dark-mode .jotallas-kalkulator-container,
.dark-mode .jotallas-kalkulator-container,
body.dark .jotallas-kalkulator-container,
.dark .jotallas-kalkulator-container,
body.dark-theme .jotallas-kalkulator-container,
.dark-theme .jotallas-kalkulator-container,
body.theme-dark .jotallas-kalkulator-container,
.theme-dark .jotallas-kalkulator-container {
  --warranty-bg: #1e1e1e !important;
  --warranty-text: #ffffff !important;
  --warranty-border: #404040 !important;
  --warranty-input-bg: #2d2d2d !important;
  --warranty-dropdown-bg: #2d2d2d !important;
  --warranty-hover-bg: #404040 !important;
  --warranty-result-bg: #2d2d2d !important;
  --warranty-placeholder: #cccccc !important;
  --warranty-shadow: rgba(0, 0, 0, 0.3) !important;
  --warranty-focus-shadow: rgba(76, 175, 80, 0.25) !important;
  background: #1e1e1e !important;
  color: #ffffff !important;
}

/* Manuális sötét mód osztály - erősebb szabályok */
.jotallas-kalkulator-container.dark-mode,
.jotallas-kalkulator-container.dark,
.jotallas-kalkulator-container.dark-theme,
.jotallas-kalkulator-container.theme-dark {
  --warranty-bg: #1e1e1e !important;
  --warranty-text: #ffffff !important;
  --warranty-border: #404040 !important;
  --warranty-input-bg: #2d2d2d !important;
  --warranty-dropdown-bg: #2d2d2d !important;
  --warranty-hover-bg: #404040 !important;
  --warranty-result-bg: #2d2d2d !important;
  --warranty-placeholder: #cccccc !important;
  --warranty-shadow: rgba(0, 0, 0, 0.3) !important;
  --warranty-focus-shadow: rgba(76, 175, 80, 0.25) !important;
  background: #1e1e1e !important;
  color: #ffffff !important;
}

/* Manuális világos mód osztály */
.jotallas-kalkulator-container.light-mode {
  --warranty-bg: #ffffff;
  --warranty-text: #333333;
  --warranty-border: #e0e0e0;
  --warranty-input-bg: #ffffff;
  --warranty-dropdown-bg: #ffffff;
  --warranty-hover-bg: #f5f5f5;
  --warranty-result-bg: #f8f9fa;
  --warranty-placeholder: #999999;
  --warranty-shadow: rgba(0, 0, 0, 0.1);
}

/* Fejléc */
.jotallas-header {
  text-align: center;
  margin-bottom: 25px;
}

.jotallas-header h3 {
  color: var(--warranty-text);
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 15px 0; /* Felső margó már 0 */
  line-height: 1.4;
}

.jotallas-description {
  color: var(--warranty-text);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  opacity: 0.8;
  font-style: italic;
  max-width: 500px;
  margin: 0 auto;
}

/* Keresési konténer */
.jotallas-search-container {
  position: relative;
  margin-bottom: 20px;
}

/* Keresési input */
.jotallas-search-input {
  width: 100%;
  padding: 15px 20px;
  font-size: 16px;
  border: 2px solid var(--warranty-border);
  border-radius: 8px;
  background: var(--warranty-input-bg);
  color: var(--warranty-text);
  font-style: italic;
  transition: background-color var(--warranty-transition-normal)
      var(--warranty-ease),
    color var(--warranty-transition-normal) var(--warranty-ease),
    border-color var(--warranty-transition-fast) linear,
    box-shadow var(--warranty-transition-fast) var(--warranty-ease),
    padding var(--warranty-transition-fast) var(--warranty-ease);
  box-sizing: border-box;
  font-family: inherit;
}

.jotallas-search-input:focus {
  outline: none;
  border-color: var(--warranty-accent);
  box-shadow: 0 0 0 3px var(--warranty-focus-shadow);
  font-style: normal;
}

.jotallas-search-input::placeholder {
  color: var(--warranty-placeholder);
  font-style: italic;
  opacity: 0.8;
}

.jotallas-search-input:focus::placeholder {
  opacity: 0.6;
}

/* Legördülő menü */
.jotallas-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--warranty-dropdown-bg);
  border: 2px solid var(--warranty-border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 20px var(--warranty-shadow);
}

.jotallas-dropdown.active {
  display: block;
  animation: dropdownSlide 0.2s ease-out;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.jotallas-dropdown-content {
  padding: 0;
}

.jotallas-dropdown-item {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--warranty-border);
  color: var(--warranty-text);
  transition: background-color var(--warranty-transition-fast)
      var(--warranty-ease),
    color var(--warranty-transition-fast) var(--warranty-ease),
    padding-left var(--warranty-transition-fast) var(--warranty-ease);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.jotallas-dropdown-item:hover,
.jotallas-dropdown-item.highlighted {
  background-color: var(--warranty-hover-bg);
  padding-left: 25px;
}

.jotallas-dropdown-item:last-child {
  border-bottom: none;
}

.jotallas-dropdown-item:focus {
  outline: 2px solid var(--warranty-accent);
  outline-offset: -2px;
  background-color: var(--warranty-hover-bg);
}

/* Eredmény konténer */
.jotallas-result {
  margin-top: 25px;
  padding: 18px; /* Csökkentett padding desktop nézetben */
  background: var(--warranty-result-bg);
  border-radius: 8px;
  border: 2px solid var(--warranty-accent);
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 10px var(--warranty-shadow);
  display: none; /* Alapértelmezetten elrejtve */
  transition: background-color var(--warranty-transition-normal)
      var(--warranty-ease),
    color var(--warranty-transition-normal) var(--warranty-ease),
    border-color var(--warranty-transition-fast) linear,
    box-shadow var(--warranty-transition-normal) var(--warranty-ease);
}

/* Eredmény konténer megjelenítve */
.jotallas-result.show {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.jotallas-result-content h4 {
  color: var(--warranty-text);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0; /* Csökkentett alsó margó */
  line-height: 1.3; /* Csökkentett sormagasság */
}

/* Specifikus szabály a result title számára */
#jotallas-result-title {
  margin-top: 0 !important;
}

/* Erős felülírás a kalkulátor cím marginjához */
.jotallas-kalkulator-container .jotallas-header h3,
#jotallas-kalkulator .jotallas-header h3,
div.jotallas-kalkulator-container .jotallas-header h3 {
  margin: 0 0 15px 0 !important;
  margin-top: 0 !important;
}

.jotallas-result-content p {
  color: var(--warranty-text);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 20px 0;
  opacity: 0.9;
}

.jotallas-result-period {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.jotallas-period-label {
  color: var(--warranty-text);
  font-size: 16px;
  font-weight: 500;
}

.jotallas-period-value {
  background: linear-gradient(135deg, var(--warranty-accent), #45a049);
  color: white;
  padding: 10px 18px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
  transition: transform 0.2s ease;
}

.jotallas-period-value:hover {
  transform: translateY(-1px);
}

/* Görgetősáv stílusa */
.jotallas-dropdown::-webkit-scrollbar {
  width: 8px;
}

.jotallas-dropdown::-webkit-scrollbar-track {
  background: var(--warranty-bg);
  border-radius: 4px;
}

.jotallas-dropdown::-webkit-scrollbar-thumb {
  background: var(--warranty-border);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.jotallas-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--warranty-accent);
}

/* Tablet reszponzivitás */
@media (max-width: 1024px) {
  .jotallas-kalkulator-container {
    max-width: 90%;
    margin: 15px auto;
  }
}

/* Reszponzív design - Tablet és kisebb asztali */
@media (max-width: 768px) {
  .jotallas-kalkulator-container {
    margin: 10px;
    padding: 20px;
    border-radius: 10px;
  }

  .jotallas-header h3 {
    font-size: 22px;
    margin: 0 0 12px 0; /* Explicit margin beállítás tablet nézetben */
  }

  /* Erős felülírás tablet nézetben */
  .jotallas-kalkulator-container .jotallas-header h3,
  #jotallas-kalkulator .jotallas-header h3,
  div.jotallas-kalkulator-container .jotallas-header h3 {
    margin: 0 0 12px 0 !important;
    margin-top: 0 !important;
  }

  .jotallas-description {
    font-size: 13px;
    margin-bottom: 20px;
    max-width: 90%;
  }

  .jotallas-search-input {
    padding: 16px 18px;
    font-size: 16px;
    border-radius: 10px;
    /* iOS zoom prevention */
    -webkit-text-size-adjust: 100%;
  }

  .jotallas-search-input::placeholder {
    font-size: 14px;
    line-height: 1.4;
  }

  .jotallas-dropdown {
    border-radius: 0 0 10px 10px;
    max-height: 40vh;
  }

  .jotallas-dropdown-item {
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.4;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .jotallas-dropdown-item:hover,
  .jotallas-dropdown-item.highlighted {
    padding-left: 23px;
  }

  .jotallas-result {
    padding: 16px; /* Csökkentett padding tablet nézetben */
    border-radius: 10px;
    margin-top: 16px; /* Csökkentett távolság tablet nézetben */
    text-align: center; /* Középre igazítás tablet nézetben */
  }

  .jotallas-result-content h4 {
    font-size: 18px;
    line-height: 1.3;
    margin-bottom: 6px; /* Csökkentett alsó margó tablet nézetben */
  }

  /* Result title specifikus margin tablet nézetben */
  #jotallas-result-title {
    margin-top: 0 !important;
  }

  .jotallas-result-content p {
    font-size: 14px;
    line-height: 1.5;
  }

  .jotallas-period-label {
    font-size: 15px;
  }

  .jotallas-period-value {
    font-size: 15px;
    padding: 10px 16px;
  }

  .jotallas-result-period {
    flex-direction: column;
    align-items: center; /* Középre igazítás tablet nézetben */
    gap: 12px;
    text-align: center;
  }
}

/* Mobil reszponzivitás - Kis képernyők */
@media (max-width: 480px) {
  .jotallas-kalkulator-container {
    margin: 8px;
    padding: 18px;
    border-radius: 8px;
  }

  .jotallas-header h3 {
    font-size: 20px;
    margin: 0 0 12px 0; /* Explicit margin beállítás mobil nézetben */
  }

  /* Erős felülírás mobil nézetben */
  .jotallas-kalkulator-container .jotallas-header h3,
  #jotallas-kalkulator .jotallas-header h3,
  div.jotallas-kalkulator-container .jotallas-header h3 {
    margin: 0 0 12px 0 !important;
    margin-top: 0 !important;
  }

  .jotallas-description {
    font-size: 12px;
    margin-bottom: 18px;
    max-width: 95%;
    line-height: 1.4;
  }

  .jotallas-search-input {
    padding: 16px 15px;
    font-size: 16px; /* iOS zoom prevention */
    border-radius: 8px;
    -webkit-appearance: none;
    appearance: none;
    -webkit-text-size-adjust: 100%;
  }

  .jotallas-search-input::placeholder {
    font-size: 14px;
    line-height: 1.3;
  }

  .jotallas-dropdown {
    max-height: 50vh;
    border-radius: 0 0 8px 8px;
  }

  .jotallas-dropdown-item {
    padding: 16px 15px;
    font-size: 15px;
    min-height: 52px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    /* Touch target requirements */
    min-width: 44px;
    position: relative;
  }

  .jotallas-dropdown-item:hover,
  .jotallas-dropdown-item.highlighted {
    padding-left: 20px;
  }

  /* Touch feedback */
  .jotallas-dropdown-item:active {
    background-color: var(--warranty-accent);
    color: white;
    transform: scale(0.98);
  }

  .jotallas-result {
    padding: 14px; /* Csökkentett padding mobil nézetben */
    border-radius: 8px;
    margin-top: 12px; /* Csökkentett távolság a keresési mező és eredmény között */
    text-align: center; /* Középre igazítás mobil nézetben */
  }

  .jotallas-result-content h4 {
    font-size: 17px;
    line-height: 1.3;
    margin-bottom: 12px;
  }

  /* Result title specifikus margin mobil nézetben */
  #jotallas-result-title {
    margin-top: 0 !important;
  }

  .jotallas-result-content p {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 16px;
  }

  .jotallas-period-label {
    font-size: 15px;
  }

  .jotallas-period-value {
    font-size: 15px;
    padding: 10px 14px;
    border-radius: 20px;
  }

  .jotallas-result-period {
    gap: 10px;
    flex-direction: column; /* Függőleges elrendezés mobilon */
    align-items: center; /* Középre igazítás mobilon */
    text-align: center;
    justify-content: center;
  }
}

/* Extra kis mobilok */
@media (max-width: 360px) {
  .jotallas-kalkulator-container {
    margin: 5px;
    padding: 15px;
  }

  .jotallas-header h3 {
    font-size: 18px;
    margin: 0 0 10px 0; /* Explicit margin beállítás kis mobil nézetben */
  }

  /* Erős felülírás kis mobil nézetben */
  .jotallas-kalkulator-container .jotallas-header h3,
  #jotallas-kalkulator .jotallas-header h3,
  div.jotallas-kalkulator-container .jotallas-header h3 {
    margin: 0 0 10px 0 !important;
    margin-top: 0 !important;
  }

  .jotallas-description {
    font-size: 11px;
    margin-bottom: 15px;
    max-width: 100%;
    line-height: 1.3;
  }

  .jotallas-search-input {
    padding: 14px 12px;
    font-size: 16px;
  }

  .jotallas-search-input::placeholder {
    font-size: 13px;
  }

  .jotallas-dropdown-item {
    padding: 14px 12px;
    font-size: 14px;
    min-height: 48px;
  }

  .jotallas-result {
    padding: 12px; /* Csökkentett padding kis mobilokon */
    margin-top: 10px; /* Csökkentett távolság kis mobilokon */
    text-align: center; /* Középre igazítás kis mobilokon */
  }

  .jotallas-result-content h4 {
    font-size: 16px;
  }

  /* Result title specifikus margin kis mobil nézetben */
  #jotallas-result-title {
    margin-top: 0 !important;
  }

  .jotallas-result-content p {
    font-size: 13px;
  }

  .jotallas-period-value {
    font-size: 14px;
    padding: 8px 12px;
  }
}

/* Loading állapot */
.jotallas-loading {
  position: relative;
}

.jotallas-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid var(--warranty-border);
  border-top: 2px solid var(--warranty-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: translateY(-50%) rotate(0deg);
  }
  100% {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Üres állapot */
.jotallas-dropdown-empty {
  padding: 20px;
  text-align: center;
  color: var(--warranty-placeholder);
  font-style: italic;
  font-size: 14px;
}

/* Hozzáférhetőségi javítások */
@media (prefers-reduced-motion: reduce) {
  .jotallas-kalkulator-container,
  .jotallas-search-input,
  .jotallas-dropdown-item,
  .jotallas-period-value {
    transition: none;
  }

  .jotallas-dropdown.active {
    animation: none;
  }

  .jotallas-result {
    animation: none;
  }
}

/* High contrast mód támogatás */
@media (prefers-contrast: high) {
  .jotallas-kalkulator-container {
    border: 2px solid var(--warranty-text);
  }

  .jotallas-search-input {
    border-width: 2px;
  }

  .jotallas-dropdown {
    border-width: 2px;
  }
}

/* Touch eszközök támogatása */
@media (pointer: coarse) {
  .jotallas-dropdown-item {
    min-height: 48px;
    padding: 16px 20px;
    font-size: 16px;
  }

  .jotallas-search-input {
    min-height: 48px;
    font-size: 16px;
  }
}

/* Landscape telefon orientáció */
@media (max-width: 768px) and (orientation: landscape) {
  .jotallas-dropdown {
    max-height: 30vh;
  }

  .jotallas-kalkulator-container {
    padding: 15px 20px;
  }
}

/* iOS Safari specifikus javítások */
@supports (-webkit-touch-callout: none) {
  .jotallas-search-input {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
  }

  .jotallas-dropdown {
    -webkit-overflow-scrolling: touch;
  }
}

/* Touch aktív állapot */
.jotallas-dropdown-item.touch-active {
  background-color: var(--warranty-accent);
  color: white;
  transform: scale(0.98);
  transition: all 0.1s ease;
}

/* Ultra magas specificitású sötét mód szabályok - WordPress témák felülírása ellen */
html body div.jotallas-kalkulator-container.dark-mode,
html body .jotallas-kalkulator-container.dark-mode,
html body #jotallas-kalkulator.dark-mode,
html.dark body .jotallas-kalkulator-container,
body.dark .jotallas-kalkulator-container,
.dark .jotallas-kalkulator-container {
  background: #1e1e1e !important;
  color: #ffffff !important;
  border: 2px solid #404040 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

html body div.jotallas-kalkulator-container.dark-mode .jotallas-search-input,
html body .jotallas-kalkulator-container.dark-mode .jotallas-search-input,
html body #jotallas-kalkulator.dark-mode .jotallas-search-input,
html.dark body .jotallas-kalkulator-container .jotallas-search-input,
body.dark .jotallas-kalkulator-container .jotallas-search-input,
.dark .jotallas-kalkulator-container .jotallas-search-input {
  background: #2d2d2d !important;
  color: #ffffff !important;
  border: 2px solid #404040 !important;
}

html body div.jotallas-kalkulator-container.dark-mode .jotallas-dropdown,
html body .jotallas-kalkulator-container.dark-mode .jotallas-dropdown,
html body #jotallas-kalkulator.dark-mode .jotallas-dropdown,
html.dark body .jotallas-kalkulator-container .jotallas-dropdown,
body.dark .jotallas-kalkulator-container .jotallas-dropdown,
.dark .jotallas-kalkulator-container .jotallas-dropdown {
  background: #2d2d2d !important;
  border: 2px solid #404040 !important;
}

html body div.jotallas-kalkulator-container.dark-mode .jotallas-dropdown-item,
html body .jotallas-kalkulator-container.dark-mode .jotallas-dropdown-item,
html body #jotallas-kalkulator.dark-mode .jotallas-dropdown-item,
html.dark body .jotallas-kalkulator-container .jotallas-dropdown-item,
body.dark .jotallas-kalkulator-container .jotallas-dropdown-item,
.dark .jotallas-kalkulator-container .jotallas-dropdown-item {
  background: #2d2d2d !important;
  color: #ffffff !important;
}

html body div.jotallas-kalkulator-container.dark-mode .jotallas-result,
html body .jotallas-kalkulator-container.dark-mode .jotallas-result,
html body #jotallas-kalkulator.dark-mode .jotallas-result,
html.dark body .jotallas-kalkulator-container .jotallas-result,
body.dark .jotallas-kalkulator-container .jotallas-result,
.dark .jotallas-kalkulator-container .jotallas-result {
  background: #2d2d2d !important;
  color: #ffffff !important;
  border: 2px solid #4caf50 !important;
}

/* Attribute alapú dark mód támogatás */
body[data-theme="dark"] .jotallas-kalkulator-container,
html[data-theme="dark"] .jotallas-kalkulator-container,
body[data-mode="dark"] .jotallas-kalkulator-container,
html[data-mode="dark"] .jotallas-kalkulator-container,
body[data-color-mode="dark"] .jotallas-kalkulator-container,
html[data-color-mode="dark"] .jotallas-kalkulator-container,
body[data-bs-theme="dark"] .jotallas-kalkulator-container,
html[data-bs-theme="dark"] .jotallas-kalkulator-container {
  --warranty-bg: #1e1e1e !important;
  --warranty-text: #ffffff !important;
  --warranty-border: #404040 !important;
  --warranty-input-bg: #2d2d2d !important;
  --warranty-dropdown-bg: #2d2d2d !important;
  --warranty-hover-bg: #404040 !important;
  --warranty-result-bg: #2d2d2d !important;
  --warranty-placeholder: #cccccc !important;
  --warranty-shadow: rgba(0, 0, 0, 0.3) !important;
  --warranty-focus-shadow: rgba(76, 175, 80, 0.25) !important;
  background: #1e1e1e !important;
  color: #ffffff !important;
}

/* color-scheme deklaráció a natív komponensekhez */
.jotallas-kalkulator-container.dark-mode {
  color-scheme: dark;
}
.jotallas-kalkulator-container.light-mode {
  color-scheme: light;
}
