:root {
  --primary-color: #ff6600;      
  --secondary-color: #cc5200;    
  --accent-color: #888888;       
  --light-color: #ffffff;        
  --dark-color: #333333;         
  --bg-color: #f5f5f5;           
  --success-color: #4CAF50;      
  --warning-color: #ff9800;      
  --border-radius: 8px;
  --box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-color);
  color: var(--dark-color);
  padding-bottom: 80px; 
}

.container {
  width: calc(100% - 40px);
  max-width: 1400px;
  margin: 20px auto;
  padding: 0;
}

#productSelectionContainer {
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  padding: 25px;
  box-shadow: var(--box-shadow);
  margin-bottom: 25px;
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

#productSelectionContainer h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

#productSelectionContainer h3::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 3px;
}

.product-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 20px;
    padding: 15px 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
    align-items: center;
}

.product-container > div {
    transition: transform 0.3s ease, background-color 0.3s ease;
    cursor: pointer; 
}

.product-container > div:hover {
    transform: scale(1.05); 
    background-color: rgba(0, 0, 0, 0.1); 
}

@media (max-width: 768px) {
    .product-container {
        display: grid;
        grid-template-columns: 1fr 1fr; 
        gap: 10px;
        overflow-x: visible; 
    }
}

.product-container::-webkit-scrollbar {
  height: 6px;
}

.product-container::-webkit-scrollbar-track {
  background: transparent;
}

.product-container::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.3);
  border-radius: 6px;
}

.product-thumbnail {
  flex: 0 0 auto;
  width: 220px;
  min-width: 220px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  height: 320px;
  position: relative;
  overflow: visible;
}

.product-image-container {
  width: 100%;
  height: 220px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  background-color: #f8f8f8;
  border-radius: var(--border-radius);
}

.product-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 100%;
  transition: transform 0.3s ease;
  padding: 5px;
}

.product-title {
  font-weight: 600;
  font-size: 16px;
  margin: 5px 0;
  color: var(--dark-color);
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2; /* standard property for compatibility */
  -webkit-box-orient: vertical;
  height: 63px;
}

.product-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-color);

  padding: 8px 0;
  text-align: center;
  background-color: rgba(255, 102, 0, 0.05);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.product-price .old-price {
  text-decoration: line-through !important;
  color: #999;
  font-weight: 400;
  font-size: 14px;
  display: block;
}

.product-price .discounted-price {
  color: var(--primary-color);
  font-weight: 800;
  font-size: 20px;
  display: block;
}

/* Kiválasztott termék információs sáv */
.selected-product-info {
  display: none; /* JS mutatja meg kiválasztás után */
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin: 8px 0 12px;
  justify-content: space-between;
}

.selected-product-info .spi-name {
  font-weight: 600;
  color: var(--dark-color);
}

.selected-product-info .spi-price {
  font-weight: 700;
  color: var(--primary-color);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.selected-product-info .spi-price .old-price {
  text-decoration: line-through !important;
  color: #999;
  font-weight: 400;
  font-size: 11px;
}

.selected-product-info .spi-price .discounted-price {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 14px;
}

/* Kompakt megjelenés a kosár alatt a bottom bar-ban */
#tabMenu .selected-product-info {
  margin: 6px 10px 8px;
}

.selected-product-info.compact {
  padding: 4px 8px;
  gap: 6px;
  font-size: 12px;
  background-color: #ffffff;
  border: 1px solid #eeeeee;
  border-radius: 6px;
  box-shadow: none;
  opacity: 0.95;
  justify-content: center;
}

.selected-product-info.compact .spi-name {
  font-weight: 500;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65%;
}

.selected-product-info.compact .spi-price {
  font-weight: 600;
  font-size: 12px;
  color: var(--primary-color);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.selected-product-info.compact .spi-price .old-price {
  text-decoration: line-through !important;
  color: #999;
  font-weight: 400;
  font-size: 10px;
}

.selected-product-info.compact .spi-price .discounted-price {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 12px;
}

.product-thumbnail .info-icon {
  top: 5px;
  right: 5px;
}

.product-thumbnail.selected {
  background-color: rgba(255, 102, 0, 0.1);
  border: 2px solid var(--primary-color);
}

@media (max-width: 768px) {
  .product-thumbnail {
    width: 180px;
    min-width: 180px;
    height: 300px;
  }

  .product-image-container {
    height: 180px;
  }

  .product-title {
    font-size: 14px;
    height: 38px;
  }

  .product-price {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .product-thumbnail {
    width: 160px;
    min-width: 160px;
    height: 200px;
  }

  .product-image-container {
    height: 160px;
  }

  .product-title {
    font-size: 13px;
    height: 65px;
  }

  .product-price {
    font-size: 15px;
  }
}

.info-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--accent-color);
  cursor: pointer;
  background: rgba(255,255,255,0.9);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.info-icon:hover {
  color: var(--primary-color);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(255,102,0,0.3);
}

#monthBar {
  display: flex;
  align-items: center;
  gap: 0px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 15px;
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 3px;
  scrollbar-width: thin;
  position: sticky;
  top: 0px;
  z-index: 90;
  flex-wrap: wrap;
  justify-content: center;
}

#monthBar::-webkit-scrollbar {
  height: 6px;
}

#monthBar::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 10px;
}

#monthBar .month {
  flex: 0 0 auto;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 30px;
  transition: var(--transition);
  white-space: nowrap;
  font-weight: 500;
  background: var(--light-color);
  color: var(--accent-color);
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  border: 1px solid #eaeaea;
}

#monthBar .month:hover {
  background-color: #f0f0f0;
  color: var(--primary-color);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

#monthBar .month.active {
 background-color: #7d0000;
    color: var(--light-color);
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(255, 102, 0, 0.2);
    border-color: var
}

#monthBar .month i {

  font-size: 15px;
}

#canvasContainer {
  position: relative;
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  margin: 0 auto 30px auto;
  box-shadow: 0 5px 25px rgba(0,0,0,0.15);
  width: 595px;
  height: 842px;
  border: 1px solid #dadada;
  overflow: hidden;
  transition: var(--transition);
}

.canvas-helper {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(255,255,255,0.9);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--dark-color);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  pointer-events: none;
}

#tabMenu {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--light-color);
  z-index: 999;
  box-shadow: 0 -5px 25px rgba(0,0,0,0.08);
  transition: var(--transition);
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}

#topActionsWrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 8px 15px;
  border-bottom: 1px solid #f0f0f0;
  background-color: #f8f8f8;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
}

.actionButton {
  flex: 0 0 auto;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  padding: 8px 15px;
  background-color: var(--primary-color);
  color: var(--light-color);
  border: none;
  border-radius: 20px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(255,102,0,0.2);
}

.actionButton:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255,102,0,0.3);
}

.actionButton i {
  font-size: 14px;
}

#tabItemsWrapper {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0px 5px;
  /* background: #000000; */
  gap: 5px;
  /* border: 1px solid black; */
  /* background-color: #ffa500; */
}

.tabItem {
  flex: 1;
  text-align: center;
  background: #6b6b6b;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px 0px;
  font-size: 12px;
  /* border: 1px solid #494949; */
  color: #ffffff;
  border-radius: 10px;
  position: relative;
  box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
}

.tabItem:hover {
  color: var(--primary-color);
  background-color: rgba(255,102,0,0.05);
}

.tabItem.active {
  color: #ff6600;
  font-weight: 500;
  background: #ffffff;
}

.tabItem.active::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 40%;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 3px 3px 0 0;
}

.tabItem i {
  display: block;
  font-size: 20px;

}

#tabContent {

  padding: 0;
  max-height: 270px;
  overflow-y: auto;

  background-color: var(--light-color);
  border-top: 1px solid #eaeaea;
}

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

.tabContentHeader {
  padding: 5px;
  background-color: #f8f8f8;
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tabContentHeader h4 {
  margin: 0;
  color: var(--primary-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tabContentBody {
  padding: 0px;
}

#closeTabContent {
  background-color: #ff3b30;
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(255, 59, 48, 0.3);
}

#closeTabContent:hover {
  background-color: #d32f2f;
  transform: rotate(90deg);
}

#uploadSection {
  padding: 0;
}

.upload-area {
  border: 2px dashed var(--accent-color);
  border-radius: var(--border-radius);
  padding: 25px;
  text-align: center;
  transition: var(--transition);
  background-color: #f9f9f9;
  margin-bottom: 15px;
  cursor: pointer;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background-color: rgba(255,102,0,0.05);
}

.upload-area i {
  font-size: 40px;
  color: var(--accent-color);
  margin-bottom: 10px;
  transition: var(--transition);
}

.upload-area:hover i {
  color: var(--primary-color);
  transform: translateY(-5px);
}

.upload-area p {
  margin: 0;
  color: var(--accent-color);
  font-size: 14px;
}

.upload-area .upload-text {
  font-weight: 500;
  margin-bottom: 5px;
}

.upload-controls {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

#uploadButton {
  background-color: var(--success-color);
  color: var(--light-color);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

#uploadButton:hover {
  background-color: #388E3C;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.upload-text {
  font-size: 14px;
  color: var(--accent-color);
}

.clickable-upload-text {
  cursor: pointer;
  color: var(--primary-color);
  text-decoration: underline;
  transition: color 0.3s ease;
}

.clickable-upload-text:hover {
  color: var(--secondary-color);
  text-decoration: none;
}

#thumbnailContainer {
 display: flex;
 overflow-x: auto;
 white-space: nowrap;
 margin-top: 5px;
 scrollbar-width: thin;
 scrollbar-color: var(--accent-color) #f0f0f0;
 justify-content: flex-start;
}

#thumbnailContainer::-webkit-scrollbar {
  height: 6px;
}

#thumbnailContainer::-webkit-scrollbar-thumb {
  background-color: var(--accent-color);
  border-radius: 3px;
}

#thumbnailContainer::-webkit-scrollbar-track {
  background-color: #f0f0f0;
}

.upload-controls {
  display: flex;
  align-items: center;
  margin-top: 4px;
  position: sticky;
  top: 0;
  background-color: #fff;
  padding: 0px 0;
  z-index: 5;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

#uploadOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(5px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 102, 0, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));

  align-content: stretch;
}

.setting-card {
  background-color: #f9f9f9;
  border-radius: var(--border-radius);
  padding: 15px;
  transition: var(--transition);
}

.setting-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.setting-card h5 {
  margin: 0 0 10px;
  color: var(--dark-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-card h5 i {
  color: var(--primary-color);
}

.setting-option {
  margin-bottom: 10px;
}

.setting-option label {
  display: block;
  margin-bottom: -13px;
  font-size: 14px;
  color: var(--accent-color);
}

.setting-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-family: 'Poppins', sans-serif;
  transition: var(--transition);
}

.setting-input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255,102,0,0.1);
}

.color-picker {
  -webkit-appearance: none;
  appearance: none; /* standard property for compatibility */
  width: 35px;
  height: 35px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 50%;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.backgrounds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.background-thumb {
  position: relative;
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  transition: var(--transition);
}

.background-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.background-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.background-thumb.selected {
  box-shadow: 0 0 0 3px var(--primary-color);
}

.background-thumb::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.1);
  opacity: 0;
  transition: var(--transition);
}

.background-thumb:hover::after {
  opacity: 1;
}

.backgrounds-category {
  margin-bottom: 20px;
}

.backgrounds-category h5 {
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--dark-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.backgrounds-category h5 i {
  color: var(--primary-color);
}

.text-tools {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  margin-bottom: 0px;
  background-color: #f9f9f9;
  padding: -2px;
  border-radius: var(--border-radius);
}

.text-tool {
  padding: 5px 9px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  background-color: var(--light-color);
  color: var(--dark-color);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.text-tool:hover {
  background-color: #f0f0f0;
  color: var(--primary-color);
}

.text-tool.active {
  background-color: var(--primary-color);
  color: var(--light-color);
}

.text-input-container {
  margin-top: 15px;
}

.text-input-container textarea {
  width: 92%;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
  font-family: 'Poppins', sans-serif;
  min-height: 100px;
  transition: var(--transition);
  resize: vertical;
}

.text-input-container textarea:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255,102,0,0.1);
}

.text-add-button {
  background-color: var(--primary-color);
  color: var(--light-color);
  border: none;
  border-radius: var(--border-radius);
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  box-shadow: 0 2px 8px rgba(255,102,0,0.2);
}

.text-add-button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255,102,0,0.3);
}

.modalOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  overflow: hidden; 

}

.modalContent {
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  padding: 9px;
  max-width: 637px;
  width: 90%;
  max-height: 102vh; 
  overflow-y: auto; 
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: modalFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.preview-grid {
    display: flex;
    grid-template-columns: repeat(1, 1fr);
    grid-gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
  .preview-grid {
    grid-template-columns: repeat(2, 1fr); 
  }

  .modalContent {
    max-width: 700px; 
    max-height: 90vh;
  }
}

@media (min-width: 1200px) {
  .preview-grid {
    grid-template-columns: repeat(3, 1fr); 
  }

  .modalContent {
    max-width: 900px; 
  }
}

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

.closeModalBtn {
  position: absolute;
  top: 15px;
  right: 15px;
  cursor: pointer;
  font-size: 24px;
  color: var(--accent-color);
  transition: var(--transition);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.closeModalBtn:hover {
  color: var(--warning-color);
  background-color: #f8f8f8;
}

@media (max-width: 768px) {
  body {
    padding-bottom: 70px;
  }

  .container {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  #canvasContainer {
    width: 300px;
    height: 424px;
  }

  .product-container {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  #monthBar {
    padding: 10px;
  }

  #monthBar .month {
    padding: 5px 6px;
    font-size: 10px;
  }

  /* Mobilon a hónapsáv egy sorban, vízszintes görgetéssel */
  #monthBar {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
  }
  #monthBar .month {
    flex: 0 0 auto;
  }

  #topActionsWrapper {
    padding: 8px;
    gap: 5px;
  }

  .actionButton {
    padding: 6px 12px;
    font-size: 13px;
  }

  #tabItemsWrapper {
    padding: 1px 5px;
  }

  .tabItem {
    padding: 5px;
    font-size: 11px;
  }

  .tabItem i {
    font-size: 18px;
    margin-bottom: 3px;
  }

  .tabContentHeader {
    padding: 10px;
  }

  .tabContentBody {
    padding: 8px;
  }

  .tabContentHeader h4 {
    font-size: 16px;
  }

  #uploadButton {
    padding: 8px 15px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {

  .actionButton, .tabItem {
    padding: 5px 10px;
    font-size: 11px;
  }

  .tabItem i {
    font-size: 16px;
  }

  .backgrounds-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }
}

.month-calendar {
  width: 100%;
  margin-top: 20px;
  border-top: 1px solid #eaeaea;
  padding-top: 20px;
}

.calendar-container {
  width: 100%;
  max-width: 595px;
  margin: 0 auto;
  font-family: 'Poppins', sans-serif;
  box-shadow: 0 1px 10px rgba(0,0,0,0.05);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-header {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  padding: 12px;
  background-color: var(--primary-color);
  color: white;
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  background-color: white;
}

.calendar-days th {
  text-align: center;
  padding: 10px;
  background-color: #f5f5f5;
  color: var(--dark-color);
  font-weight: 500;
  font-size: 12px;
}

.calendar-day {
  text-align: center;
  padding: 5px;
  height: 55px;
  border: 1px solid #eee;
  vertical-align: top;
  transition: background-color 0.2s;
}

.calendar-day:hover {
  background-color: #f9f9f9;
}

.weekend {
  background-color: #f9f9f9;
}

.weekend .day-number {
  color: var(--accent-color);
}

.holiday {
  background-color: #fff8f8;
}

.empty-day {
  border: 1px solid #f5f5f5;
  background-color: #fafafa;
}

.day-number {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  color: var(--dark-color);
  margin-bottom: 4px;
}

.namedays {
  font-size: 9px;
  color: var(--accent-color);
  margin-top: 2px;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.holiday-name {
  font-size: 9px;
  color: #e74c3c;
  margin-top: 2px;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .calendar-day {
    height: 40px;
    padding: 2px;
  }

  .day-number {
    font-size: 12px;
  }

  .namedays, .holiday-name {
    font-size: 8px;
  }
}

.object-controller {
  position: absolute;
  z-index: 10000; 
  background-color: #fff;
  border-radius: 30px;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
  padding: 5px 15px;
  transition: all 0.2s ease;
  transform: translateX(-50%); 
  display: flex;
  align-items: center;
  animation: slideUp 0.3s ease forwards;

  pointer-events: auto; 
  margin-top: -40px; 
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.controller-buttons {
  display: flex;
  gap: -1px;
  flex-wrap: nowrap;
  flex-direction: row;
  justify-content: center;
}

.controller-btn {
  width: 36px;
  height: 36px;
  background: #fff;
  border: none;
  border-radius: 50%;
  color: #555;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.controller-btn:hover {
  background: #f5f5f5;
  transform: translateY(-2px);
  color: #333;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.controller-btn[data-action="delete"] {
  color: #e74c3c;
}

.controller-btn[data-action="delete"]:hover {
  background: #fee;
}

.controller-btn[data-action="crop"] {
  color: #3498db;
}

.controller-btn[data-action="crop"]:hover {
  background: #eef7fd;
}

.controller-btn[data-action="rotate-left"],
.controller-btn[data-action="rotate-right"] {
  color: #27ae60;
}

.controller-btn[data-action="rotate-left"]:hover,
.controller-btn[data-action="rotate-right"]:hover {
  background: #eefbf3;
}

.cropper-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.95); 
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;

  pointer-events: auto !important;
  touch-action: auto !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.cropper-container {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.cropper-wrap-box,
.cropper-canvas,
.cropper-drag-box,
.cropper-crop-box,
.cropper-modal {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.cropper-modal {
  background-color: rgba(0, 0, 0, 0.5) !important;
}

.cropper-modal-footer {
  padding: 15px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e0e0e0;
  background-color: white;
  z-index: 100000;
  position: relative;
}

.cropper-modal-content {
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.25);
  max-width: 90vw;
  width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideUp 0.4s ease;
  position: relative;
  z-index: 100000;
}

.cropper-modal-header {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
}

.cropper-modal-header h3 {
  margin: 0;
  font-weight: 500;
  color: #333;
}

.close-cropper-modal {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
}

.close-cropper-modal:hover {
  color: #e74c3c;
}

.cropper-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  max-height: 70vh;
  margin: 15px;
}

.cropper-modal-footer {
  padding: 15px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e0e0e0;
}

.cropper-view-box {
  box-shadow: 0 0 0 1px #39f;
  border-radius: 0;
  outline: 0;
}

.cropper-dashed {
  border-style: dashed;
  border-color: #eee;
}

.cropper-point {
  background-color: #3498db;
  width: 10px;
  height: 10px;
}

.cropper-point.point-n, 
.cropper-point.point-s, 
.cropper-point.point-e, 
.cropper-point.point-w {
  width: 12px;
  height: 12px;
}

.cropper-point.point-ne, 
.cropper-point.point-nw, 
.cropper-point.point-se, 
.cropper-point.point-sw {
  width: 14px;
  height: 14px;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn.primary {
  background-color: var(--primary-color, #ff6600);
  color: white;
}

.btn.primary:hover {
  background-color: var(--primary-dark, #e65c00);
  box-shadow: 0 2px 8px rgba(255, 102, 0, 0.3);
}

.btn:not(.primary) {
  background-color: #f5f5f5;
  color: #555;
}

.btn:not(.primary):hover {
  background-color: #e5e5e5;
}

.apply-options {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 15px;
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #fff;
  padding: 8px 0;
}

.apply-button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 5px;
  border: 1px solid #ddd;
  background-color: #f8f8f8;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.apply-button i {
  margin-right: 5px;
  font-size: 14px;
}

.apply-button.active {
  background-color: var(--primary-color, #f60);
  color: white;
  border-color: var(--primary-color, #f60);
}

.apply-button:hover:not(.active) {
  background-color: #eee;
}

.backgrounds-category {
  margin-bottom: 15px;
}

.backgrounds-category h5 {
  font-size: 14px;
  margin-bottom: 8px;
  color: #333;
  display: flex;
  align-items: center;
  padding-left: 2px;
}

.backgrounds-category h5 i {
  margin-right: 6px;
  color: var(--primary-color, #f60);
}

.backgrounds-grid {
  display: flex;
  overflow-x: auto;
  padding-bottom: 10px; 
  gap: 10px;
  -webkit-overflow-scrolling: touch; 
  scrollbar-width: thin; 
  scrollbar-color: rgba(0,0,0,0.3) transparent; 
}

.backgrounds-grid::-webkit-scrollbar {
  height: 4px;
}

.backgrounds-grid::-webkit-scrollbar-track {
  background: transparent;
}

.backgrounds-grid::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.3);
  border-radius: 4px;
}

.background-thumb {
  position: relative;
  min-width: 80px;
  max-width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  flex-shrink: 0; 
}

.background-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.background-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.background-thumb:hover img {
  transform: scale(1.05);
}

.background-thumb.selected {
  box-shadow: 0 0 0 3px var(--primary-color, #f60);
}

@media (min-width: 768px) {
  .background-thumb {
    min-width: 100px;
    max-width: 100px;
    height: 100px;
  }

  .apply-button {
    font-size: 14px;
    padding: 10px 12px;
  }
}

.month {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 28px; 
}

 .edited-indicator {
      display: none;
      position: absolute;
      top: 5px;
      right: 5px;
      width: 16px;
      height: 16px;
      background-color: #4CAF50;
      border-radius: 50%;
      color: white;
      font-size: 12px;
      text-align: center;
      line-height: 16px;
    }
    
    .edited-indicator:before {
      content: '✓';
      font-weight: bold;
    }

.actionButton[data-action="autofill"] {
  background-color: #9c27b0; 
}

.actionButton[data-action="autofill"]:hover {
  background-color: #7b1fa2; 
}

.thumbnail-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding: 5px 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: #f5f5f5;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.icon-btn:hover {
  background-color: #e0e0e0;
  transform: translateY(-2px);
}

.icon-btn.danger {
  color: #e74c3c;
}

.icon-btn.danger:hover {
  background-color: #fee;
}

.thumbnail-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  margin-right: 8px;
  margin-bottom: 8px;
  flex: 0 0 auto;
  width: 70px;
  height: 70px;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.thumbnail-wrapper:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  border-color: var(--primary-color);
}

.thumbnail-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.delete-icon {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background-color: rgba(231, 76, 60, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  z-index: 2;
  opacity: 0;
  transition: all 0.2s;
}

.thumbnail-wrapper:hover .delete-icon {
  opacity: 1;
}

.delete-icon:hover {
  background-color: #e74c3c;
  transform: scale(1.2);
}

.thumbnail-wrapper {
  position: relative;
  overflow: visible; 
  border-radius: 6px;
  margin-right: 8px;
  margin-bottom: 8px;
  flex: 0 0 auto;
  width: 70px;
  height: 70px;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.thumbnail-wrapper:hover .delete-icon {
  opacity: 1;
}

.delete-icon:hover {
  background-color: #e74c3c;
  transform: scale(1.2);
}

.sort-modal-content {
  padding: 20px;
  width: 300px;
}

.sort-modal-content h3 {
  margin-top: 0;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary-color);
}

.sort-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.sort-option {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.sort-option:hover {
  background-color: #f5f5f5;
}

.sort-option.active {
  background-color: rgba(255, 102, 0, 0.1);
  border-left: 3px solid var(--primary-color);
}

.sort-option i {
  margin-right: 10px;
  color: var(--primary-color);
  width: 16px;
  text-align: center;
}

.thumbnails-wrapper {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 5px;
}

.confirm-modal-content {
  background-color: white;

  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.confirm-modal-content h3 {
  margin-top: 0;
  color: #e74c3c;
}

.confirm-modal-content p {
  margin-bottom: 20px;
}

.confirm-modal-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.confirm-btn {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.confirm-btn-cancel {
  background-color: #f5f5f5;
  color: #333;
}

.confirm-btn-cancel:hover {
  background-color: #e0e0e0;
}

.confirm-btn-delete {
  background-color: #e74c3c;
  color: white;
}

.confirm-btn-delete:hover {
  background-color: #c0392b;
}

.custom-events-modal {

  width: 100%;
}

.custom-events-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 10px;
  background: #f8f8f8;
  border-radius: 5px;
}

.custom-event-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px;
  background: white;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.event-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f1f1;
  border-radius: 50%;
  margin-right: 15px;
  color: #0066cc;
  font-size: 18px;
}

.event-details {
  flex: 1;
}

.event-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.event-date {
  font-size: 12px;
  color: #666;
}

.event-actions {
  display: flex;
  gap: 5px;
}

.event-actions button {
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  border: none;
}

.event-actions .edit-event {
  background: #f0f0f0;
  color: #333;
}

.event-actions .delete-event {
  background: #ffeeee;
  color: #cc0000;
}

.icon-selection .icons-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 10px 0;
  max-height: 155px;
  overflow-y: auto;

  justify-items: center;
}

/* Kompakt ikonrács a szoros elhelyezéshez */
.icon-selection .icons-grid.compact-grid {
  gap: 4px;
  margin: 6px 0;
}

.icon-selection .icons-grid.compact-grid .icon-option {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.icon-selection .icons-grid.compact-grid .icon-option i {
  font-size: 14px;
}

.custom-events-modal {

  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .icon-selection .icons-grid {
    grid-template-columns: repeat(4, 1fr);
    max-height: 90px;
  }

  .custom-events-modal {
    width: 100%;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 10px 0;
    margin-top: 10px;
    border-top: 1px solid #eee;
    z-index: 10;
  }
}

.icon-option {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f1f1;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-option:hover {
  background: #e1e1e1;
}

.icon-option.active {
  background: #ff6600;
  color: white;
}

.date-inputs {
  display: flex;

  gap: 10px;
  justify-content: center;
}

.date-inputs select {
  padding: 8px;
  border-radius: 5px;
  border: 1px solid #ddd;
}

.form-row {
  margin-bottom: 15px;
}

.form-row label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.form-row input[type="text"] {
  width: 100%;
  padding: 8px;
  background: #ffe0b7;
  border-radius: 5px;
  border: 1px solid #ddd;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
}

#eventFormContainer {
  margin-top: 11px;

  border-top: 1px solid #eee;
}

.no-events {
  text-align: center;

  color: #666;
  font-style: italic;
}

#calendarYearSelector {
  width: 100%;
  padding: 8px;
  border-radius: 5px;
  border: 1px solid #ddd;
  background-color: #fff;
  font-size: 14px;
}

#manageCustomEvents {
  width: 100%;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .icon-selection .icons-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .custom-events-list {
    max-height: 200px;
  }

  .event-icon {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
}

.enlarged-preview-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9); 
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999 !important; 
}

.enlarged-preview {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.enlarged-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #f0f0f0;
  border-bottom: 1px solid #ddd;
}

.enlarged-preview-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
}

.close-enlarged-preview {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #666;
  padding: 0;
  line-height: 1;
}

.close-enlarged-preview:hover {
  color: #000;
}

.enlarged-preview-content {
  padding: 15px;
  overflow: auto;
  max-height: calc(90vh - 70px);
  text-align: center;
}

.enlarged-preview-img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.preview-loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background-color: #f8f8f8;
  border-radius: 8px;
}

.preview-loading-overlay .spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 102, 0, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  margin-bottom: 20px;
}

.preview-loading-overlay p {
  font-size: 16px;
  color: #555;
  margin: 5px 0;
}

.calendar-settings-container {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.setting-card {
  flex: 1;
  background-color: #f4f4f4;
  border-radius: 8px;
  padding: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  min-width: 250px;
}

.setting-card h5 {
  margin-top: 0;

  border-bottom: 1px solid #ddd;
  padding-bottom: 0.5rem;
}

@media (max-width: 992px) {
  .calendar-settings-container {
    flex-direction: column;
  }
}

.setting-option {

  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-option label {
  margin-right: 0.5rem;
  width: 100%;
}

#calendarYearSelector {
  width: 100%;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #ddd;
}

input[type="color"] {
  width: 40%;
  height: 38px;
  padding: 0;
  border: none;
  background: none;
}

.actionButton.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.actionButton.disabled:hover::after {
  content: "Kosárba helyezéshez minden hónapot szerkeszteni kell";
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
}

.refresh-modal {
  text-align: center;
  padding: 10px;
}

.progress-container {
  width: 100%;
  height: 10px;
  background-color: #f5f5f5;
  border-radius: 5px;
  margin: 15px 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--primary-color, #ff6600);
  border-radius: 5px;
  transition: width 0.3s ease;
}

#refresh-status {
  font-size: 14px;
  color: #666;
}

.fa-spin {
  animation: fa-spin 2s infinite linear;
}

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

.save-calendar-tabs {
  width: 100%;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.tab-header {
  display: flex;
  border-bottom: 1px solid #ddd;
  margin-bottom: 15px;
}

.tab-btn {
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  margin-right: 5px;
  transition: background-color 0.3s;
  background: greenyellow;
  font-weight: 500;
}

.tab-btn:hover {
  background-color: #f5f5f5;
}

.tab-btn.active {
  background-color: #ff6600;
  color: white;
}

.tab-content {
  display: none;
  padding: 15px 0;
  overflow-y: auto;
  max-height: calc(70vh - 50px);
}

.tab-content.active {
  display: block;
}

.saved-calendars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.saved-calendar-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  background-color: #fff;
}

.saved-calendar-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.calendar-preview {
  width: 100%;
  height: 150px;
  overflow: hidden;
  position: relative;
  background-color: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.no-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: #f0f0f0;
  color: #999;
}

.no-preview i {
  font-size: 48px;
}

.calendar-info {
  padding: 10px;
}

.calendar-info h4 {
  margin: 0 0 5px 0;
  font-size: 16px;
  color: #333;
}

.calendar-date {
  margin: 0;
  font-size: 12px;
  color: #777;
}

.calendar-actions {
  display: flex;
  padding: 0 10px 10px 10px;
  justify-content: space-between;
}

.calendar-actions .btn {
  padding: 5px 10px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.load-calendar {
  background-color: #4CAF50;
  color: white;
  flex-grow: 1;
  margin-right: 5px;
}

.load-calendar:hover {
  background-color: #45a049;
}

.delete-calendar {
  background-color: #f44336;
  color: white;
  width: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.delete-calendar:hover {
  background-color: #d32f2f;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 102, 0, 0.3);
  border-radius: 50%;
  border-top: 4px solid #ff6600;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

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

.btn {
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
}

.btn.primary {
  background-color: #ff6600;
  color: white;
}

.btn.primary:hover {
  background-color: #e55c00;
}

.btn.secondary {
  background-color: #f0f0f0;
  color: #333;
}

.btn.secondary:hover {
  background-color: #e0e0e0;
}

.btn.danger {
  background-color: #f44336;
  color: white;
}

.btn.danger:hover {
  background-color: #d32f2f;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.error-message, .no-saved-calendars {
  padding: 15px;
  background-color: #f8f8f8;
  border-radius: 4px;
  text-align: center;
  color: #666;
}

.error-message {
  border-left: 4px solid #f44336;
}

.error-message i, .no-saved-calendars i {
  margin-right: 5px;
  font-size: 16px;
}

@media (max-width: 768px) {
  .saved-calendars-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .calendar-preview {
    height: 120px;
  }

  .calendar-info h4 {
    font-size: 14px;
  }

  .calendar-date {
    font-size: 11px;
  }

  .calendar-actions .btn {
    padding: 4px 8px;
    font-size: 11px;
  }
}

.saved-calendar-item {
  animation: fadeIn 0.3s ease-in-out;
}

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

#canvasContainer {
  position: relative;
  transition: all 0.3s ease;
}

.load-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.load-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.load-progress .fa-spinner {
  font-size: 3rem;
  margin-bottom: 15px;
}

/* ===============================
   Desktop layout improvements
   =============================== */
@media (min-width: 992px) {
  /* Top bar: back link + months in one row */
  #desktopTopBar {
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--light-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 8px 10px;
    margin-bottom: 6px;
  }

  #desktopTopBar #vissza-link .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
   background: #810000;
    color: #fff;
    border-radius: 18px;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
  }

  #desktopTopBar #vissza-link .back-link:visited {
    color: #fff;
    text-decoration: none;
  }

  #desktopTopBar #vissza-link .back-link i {
    font-size: 14px;
  }

  /* Make months compact and keep in a single row */
  #desktopTopBar #monthBar {
    flex: 1;
    margin: 0;
    padding: 4px 6px;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    gap: 6px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    position: static;
  }

  #desktopTopBar #monthBar .month {
    padding: 6px 10px;
    font-size: 13px;
  }

  #desktopTopBar #monthBar .month i {
    font-size: 13px;
  }

  /* Bottom bar: header with tabs left and actions right */
  #tabHeader {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    padding: 6px 10px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #f0f0f0;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
  }

  .header-row-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
  }

  /* Push product info to the far right in the top row */
  .header-row-top #selectedProductInfo {
    grid-column: 3;
    justify-self: end;
    margin-left: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    gap: 8px;
    max-width: 45%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-row-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  #tabHeader #tabItemsWrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-start;
    padding: 0;
  }

  /* Desktop dock for controller on the left */
  #desktopControllerDock {
    display: none; /* JS mutatja, ha van kijelölés */
    align-items: center;
    gap: 6px;
    grid-column: 2;
    justify-self: center;
  }

  #desktopControllerDock .controller-buttons {
    display: flex ;
            align-items: center;
            background: #a6a6a6;
            padding: 3px 20px;
            border-radius: 21px;
            gap: 6px;
            justify-content: center;
  }

  /* Right side: selected info + actions in one row */
  #rightBlock.desktop-right-block {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
  }

  #rightBlock .selected-product-info {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #tabHeader #tabItemsWrapper .tabItem {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-size: 12px;
    background: #6b6b6b;
    border-radius: 12px;
  }

  #tabHeader #tabItemsWrapper .tabItem br {
    display: none;
  }

  #tabHeader #tabItemsWrapper .tabItem i {
    font-size: 16px;
  }

  #tabHeader .header-separator {
    width: 1px;
    height: 26px;
    background: linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.02));
    border-radius: 1px;
  }

  #tabHeader #topActionsWrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  /* Upload tab: controls (left) and thumbnails (right) in one row */
  #tabContent .upload-body .upload-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    align-content: center;
    flex-direction: row;
  }
  #tabContent .upload-body .upload-left {
    flex: 0 0 260px;
    max-width: 340px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

  /* Center the upload icon and text */
  #tabContent .upload-body .upload-left .upload-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
  }
  #tabContent .upload-body .upload-left .upload-text {
    text-align: center;
  }
  #tabContent .upload-body .upload-right {
    flex: 1 1 auto;
    min-width: 0;
  }
  #tabContent .upload-body .thumbs-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  /* On desktop, we place thumbnail-controls under upload-left and hide the topbar */
  #thumbsTopbar { display: none; }
  #uploadLeftExtras { display: flex; justify-content: flex-start; gap: 8px; }
}

/* Subtle highlight animation for controller buttons (both mobile and desktop) */
@keyframes controllerHighlight {
  0% { background-color: #2a2a2aa8; }
  100% { background-color: var(--controller-final-bg, transparent); }
}

.controller-buttons.animate-highlight {
  animation: controllerHighlight 1.6s ease-out 1;
  border-radius: 20px;
  overflow: hidden;
  will-change: background-color;
}

/* Desktop: animate individual buttons dark-to-light */
@keyframes controllerBtnHighlight {
  0% { background-color: #a9a9a9; }
  100% { background-color: #fff; }
}
.controller-btn.animate-highlight {
  animation: controllerBtnHighlight 1.6s ease-out 1;
  border-radius: 20px;
}

/* Final bg targets per dock */
#mobileControllerDock .controller-buttons { --controller-final-bg: #f1f1f1; }
#desktopControllerDock .controller-buttons { --controller-final-bg: #f8f8f8; }
  #tabHeader #topActionsWrapper .actionButton {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 16px;
    box-shadow: 0 2px 6px rgba(255,102,0,0.2);
  }

  #tabHeader #topActionsWrapper .actionButton i {
    font-size: 12px;
  }

  /* Make the whole bottom module a bit more compact on desktop */
  #tabMenu {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  #tabContent {
    max-height: 220px;
  }

/* ===============================
   Mobile layout fixes (<=768px)
   =============================== */
@media (max-width: 768px) {
  /* Restore orange back bar */
  #desktopTopBar {
    background: transparent;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }

  #vissza-link {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--primary-color);
    text-align: center;
    padding: 10px;
  }

  #vissza-link .back-link {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  #vissza-link .back-link:visited {
    color: #fff;
    text-decoration: none;
  }

  #vissza-link .back-link i {
    font-size: 16px;
  }

  /* Month bar below the back bar, not sticky on mobile */
  #desktopTopBar #monthBar,
  #monthBar {
    position: static !important;
    top: auto !important;
    margin-top: 6px;
  }

  /* Bottom bar stacking: actions > selected > content > tabs */
  #tabMenu {
    display: grid;
    grid-template-areas:
      'actions'
      'selected'
      'content'
      'controller'
      'tabs';
  }

  /* Flatten header children to allow reordering */
  #tabHeader {
    display: contents;
  }
  #headerRowTop,
  #headerRowBottom {
    display: contents;
  }

  #topActionsWrapper {
    grid-area: actions;
    justify-content: center;
    gap: 6px;
    padding: 8px;
  }

  #selectedProductInfo {
    grid-area: selected;
    display: flex;
    justify-content: center;
  }

  #tabContent {
    grid-area: content;
  }

  #tabItemsWrapper {
    grid-area: tabs;
    display: flex;
    justify-content: space-evenly;
    padding: 6px 5px;
  }

  .header-separator {
    display: none;
  }

  /* Flatten right side wrapper so its children can be grid areas */
  #rightBlock {
    display: contents;
  }

  /* Hide desktop dock on mobile */
  #desktopControllerDock {
    display: none !important;
  }

  /* Upload tab mobile: revert to original stacking */
  #tabContent .upload-body .upload-row {
    display: block;
  }
  #tabContent .upload-body .upload-left,
  #tabContent .upload-body .upload-right {
    max-width: 100%;
  }
  #thumbsTopbar { display: none !important; }
  #uploadLeftExtras { display: none; }
}

