/* Shared row styles used across components in the application */

.levelinstancesrow {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  margin-bottom: 24px;
  background: #f5f7fa;
  border-radius: 8px;
  position: relative;
  gap: 8px; /* Add consistent gap between items */
}


/* QR code container styling */
#qrcodeContainer {
  display: flex;
  align-items: flex-start;
  margin-left: 8px;
  animation: fadeIn 0.3s ease-in;
  flex: 0 0 auto; /* Don't allow it to flex/grow */
  width: auto;
  min-width: 0;
}

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

.levelinstancesrow:last-of-type {
  margin-bottom: 0;
  border-bottom: none;
}

.levelinstancesrow.bottom-row {
  background: #e0f7f4;
  border: none;
  box-shadow: 0 2px 12px rgba(0,129,128,0.08);
  position: relative;
  padding: 8px 8px 8px 40px; /* Add padding on all sides */
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center; /* Change from flex-start to center for vertical centering */
  align-content: center; /* Also change align-content for consistency */
  gap: 16px; /* Increase gap between all items for better spacing */
  min-height: 160px; /* Ensure consistent row height */
}

.levelinstancesrow.folder-row {
  background: #f5f7fa;
  border: none;
  box-shadow: 0 2px 12px rgba(0,129,128,0.08);
  position: relative;
  padding-left: 38px;
  overflow: hidden;
}

.levelinstancesrow.folder-row .vertical-label {
  color: #003d4c;
}

.levelinstancesrow.bottom-row::before {
  content: none;
}

.levelinstancesrow.folder-row::before {
  content: none;
}

.single-instance-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  margin-bottom: 24px;
  background: #008180;
  border-radius: 8px;
  position: relative;
  min-height: 120px;
}

.vertical-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 1.1rem;
  font-weight: bold;
  color: #ffffff;
  background: #008180;
  display: flex;
  justify-content: center;
  min-width: 32px;
  max-width: 32px;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100%;
  letter-spacing: 0.1em;
  user-select: none;
  z-index: 1;
  border-radius: 8px 0 0 8px;
}

/* Shared tile styles for all tile types */
.tile {
  position: relative;
  background: #f9f5ec;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(223,163,109,0.08);
  padding: 16px 16px 40px 20px;
  margin: 0; /* Remove margin to rely on parent's gap */
  transition: box-shadow 0.2s, border 0.2s;
  border: 2px solid #dfa36d;
  outline: none;
  width: 240px; /* Fixed width instead of min/max width */
  height: 145px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #333333;
  font-family: LibreFranklinThin;
  will-change: transform; /* Optimize for animations */
} 

.tile.selected  {
  background: #f9f5ec !important;
  border: 2px solid #dfa36d !important;
  color: #333333;
}

.tile.selected .iconsmenu i
{
  color: #dfa36d;
}
.tile.selected .iconsmenu i:hover
{
  color: #008180;
}
.tile.selected .iconsmenu i.bi-trash-fill:hover {
  color: #dc3545;
}
.tile:hover, .tile:focus-within, .tile:focus {
  box-shadow: 0 4px 16px rgba(223,163,109,0.16);
  border: 2px solid #dfa36d;
}
.tile.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 12px;
  background: #dfa36d !important;
  border-radius: 12px 0 0 12px;
  z-index: 2;
}

/* Add back style for tiles with inline background-color styles */
.tile[style*="background-color:#373737"] {
  background: #f9f5ec !important; 
  border: 2px solid #dfa36d !important;
  color: #333333;
}

.tile[style*="background-color:#373737"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 12px;
  background: #dfa36d;
  border-radius: 12px 0 0 12px;
}

.tile[style*="background-color:#373737"] .levelfirstline,
.tile[style*="background-color:#373737"] .levelsecondline,
.tile[style*="background-color:#373737"] .tileid {
  color: #333333;
}

.tile[style*="background-color:#373737"] .iconsmenu i {
  color: #dfa36d;
}

.tile[style*="background-color:#373737"] .iconsmenu i:hover {
  color: #008180;
}

.tile[style*="background-color:#373737"] .iconsmenu i.bi-trash-fill:hover {
  color: #dc3545;
}

/* Inner elements styling - moved from component-specific CSS */
.tile .tilefirstrow {
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
}
.tile .tilefirstrowicon {
  font-size: 2rem;
  margin-right: 10px;
  margin-top: -4px;
  color: #dfa36d;
  align-self: flex-start;
  flex-shrink: 0;
}
.tile .tilefirstrowtitle {
  
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.tile .levelfirstline {
  font-weight: 600;
  font-size: 1.1rem;
  color: #333333;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.3;
  white-space: normal;
  word-wrap: break-word;
  margin-top: 8px;
}
.tile .levelsecondline {
  font-size: 0.95rem;
  color: #666666;
  margin-top: 2px;
}
.iconsmenu {
  position: absolute;
  bottom: 18px;
  left: 20px;
  right: 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: auto;
}
.iconsmenu i {
  margin: 0 4px;
  cursor: pointer;
  font-size: 1.1rem;
  color: #dfa36d;
  transition: color 0.2s;
}
.iconsmenu i:hover {
  color: #008180;
}
.iconsmenu i.bi-trash-fill:hover {
  color: #dc3545;
}
.tileid {
  font-size: 0.8rem;
  color: #888888;
  position: absolute;
  bottom: 6px;
  right: 12px;
  text-align: right;
}
.levelnameedit {
  width: 100%;
  height: 2.2em;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  padding: 2px 8px;
  margin-bottom: 2px;
}

.addtile {
  position: relative;
  background: #e0f7f4;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,129,128,0.08);
  padding: 16px 16px 20px 20px; /* Reduced bottom padding from 40px to 20px for half height */
  margin: 0; /* Match the tile margin */
  transition: box-shadow 0.2s, border 0.2s;
  border: 2px solid #008180;
  outline: none;
  width: 240px; /* Match the tile width */
  /* height: now dynamically set via inline style to match member tiles */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #333333;
}

.addtile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: #008180;
  border-radius: 12px 0 0 12px;
  transition: width 0.2s;
}

.addtile:hover::before, 
.addtile:focus-within::before, 
.addtile:focus::before {
  width: 12px;
}

.addtile .titlefirstrowicon {
  font-size: 1.4rem; /* Reduced from 1.7rem to 1.4rem for half-height tiles */
  margin-right: 10px;
  margin-top: 0.55rem; /* Lower the icon by half the font height */
  color: #008180;
  align-self: flex-start;
  flex-shrink: 0;
}

.addtile .tilefirstrow {
  display: flex;
  align-items: center; /* Change from flex-start to center to align icon and text vertically */
  margin-bottom: 4px; /* Reduced from 8px to 4px for half-height tiles */
  margin-top: 2px; /* Reduced from 4px to 2px for half-height tiles */
}

.addtile .tilefirstrowtitle {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.addtile .levelfirstline {
  font-weight: 600;
  font-size: 1.1rem;
  color: #333333;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.3;
  white-space: normal;
  word-wrap: break-word;
}

.tile .addtile:hover, .tile .addtile:focus-within, .tile .addtile:focus {
  box-shadow: 0 4px 16px rgba(0,129,128,0.16);
  border: 2px solid #008180;
} 


.foldertile {
  position: relative;
  background: #e0f7f4 !important;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,129,128,0.08);
  padding: 16px 16px 40px 20px; /* Match the padding of standard tiles (40px bottom) */
  margin: 0; /* Match the tile margin */
  transition: box-shadow 0.2s, border 0.2s;
  border: 2px solid #008180 !important;
  outline: none;
  width: 240px; /* Match the tile width */
  height: 145px; /* Match the tile height */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #333333;
}

.foldertile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: #008180 !important;
  border-radius: 12px 0 0 12px;
  transition: width 0.2s;
}

.foldertile:hover::before, 
.foldertile:focus-within::before, 
.foldertile:focus::before {
  width: 12px;
}

.foldertile .titlefirstrowicon {
  font-size: 1.7rem;
  margin-right: 10px;
  color: #008180;
  align-self: flex-start;
  flex-shrink: 0;
}

.foldertile .tilefirstrow {
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
}

.foldertile .tilefirstrowtitle {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.foldertile .levelfirstline {
  font-weight: 600;
  font-size: 1.1rem;
  color: #333333;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.3;
  white-space: normal;
  word-wrap: break-word;
}

.foldertile:hover, .foldertile:focus-within, .foldertile:focus {
  box-shadow: 0 4px 16px rgba(0,129,128,0.16);
  border: 2px solid #008180;
}

.foldertile.selected {
  background: #e0f7f4 !important;
  border: 2px solid #008180 !important;
}

.foldertile.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 12px !important;
  background: #008180 !important;
  border-radius: 12px 0 0 12px;
}

/* Remove our previous fix as we're using a simpler approach with padding and gap */
.levelinstancesrow.bottom-row > div.draggable,
.levelinstancesrow.bottom-row > .tile,
.levelinstancesrow.bottom-row > .foldertile,
.levelinstancesrow.bottom-row > .addtile {
  margin: 0; /* Reset any margins to rely on gap */
}

.foldertile .move-margin-top {
  margin-top: 10px;
}

.foldertile .move-path {
  font-size: 12px;
  color: #888;
}

.helpicon {
  position: absolute;
  top: 2px;
  right: 6px;
  z-index: 2;
  cursor: pointer;
  color: #dfa36d;
  font-size: 1.0rem;
  background: none;
  border: none;
  padding: 0;
}

.helpicon:hover {
  color: #008180;
}