/* جعبه ابزار آیسی مدار — strip، grid، sheet */

.ic-tools {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px 4px;
}

.ic-tools-box .ic-tool {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  color: var(--ic-text);
  text-decoration: none;
}

.ic-tools-box .ic-tool[hidden] {
  display: none !important;
}

.ic-tools-box .ic-tool-icon {
  width: 60px;
  height: 60px;
}

.ic-tools-box .ic-tool-icon img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.ic-tools-box .ic-tool-title {
  font-size: 10px;
  text-align: center;
  line-height: 1.5;
}

.ic-tools-box.ic-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4000;
}

.ic-tools-box.ic-sheet.is-open {
  display: block !important;
}

body.ic-tools-sheet-open .ic-tabbar-dock .ic-tabbar {
  display: none !important;
}

body.ic-tools-sheet-open .ic-tabbar-dock {
  display: none !important;
}

.ic-tools-box .ic-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 58, 74, .4);
  opacity: 0;
  transition: opacity .3s ease;
}

.ic-tools-box.ic-sheet.is-open .ic-sheet-backdrop {
  opacity: 1;
}

.ic-tools-box .ic-sheet-panel {
  position: relative;
  z-index: 1;
  background: #fff;
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  overflow: hidden;
}

.ic-tools-box .ic-sheet-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ic-tools-box .ic-sheet-head {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 12px 16px 8px;
}

.ic-tools-box .ic-sheet-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
}

.ic-tools-box .ic-sheet-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #4e91e6;
}

.ic-tools-box .ic-sheet-search {
  position: relative;
  margin: 6px 24px 18px;
}

.ic-tools-box .ic-sheet-search input {
  width: 100%;
  height: 65px;
  border: 0;
  border-radius: 18px;
  background: #f8f8f8;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--ic-text);
  text-align: center;
  outline: none;
  padding: 0 44px;
}

.ic-tools-box .ic-sheet-search input::placeholder {
  color: #a6a6a6;
  font-size: 10px;
}

.ic-tools-box .ic-sheet-clear {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9aa6b2;
  font-size: 20px;
  cursor: pointer;
}

.ic-tools-box .ic-sheet-grid {
  display: flex;
  flex-wrap: wrap;
  padding: 6px 10px 5px;
  gap: 0;
}

.ic-tools-box .ic-sheet-grid .ic-sheet-tool {
  width: 25%;
  flex: 0 0 25%;
  padding: 8px;
  margin-bottom: 12px;
}

.ic-tools-box .ic-sheet-grid .ic-sheet-tool[hidden] {
  display: none;
}

.ic-tools-sheet-banner-dock {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 0;
  background: #fff;
  box-sizing: border-box;
}

.ic-tools-sheet-banner-dock .ic-tabbar-app-banner {
  width: 100%;
  margin: 0;
  border-radius: 0;
}

.ic-tools-strip-wrap {
  margin: 12px 0 10px;
}

.ic-tools-strip {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  overflow-x: auto;
  padding: 10px 0;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
  cursor: grab;
  overscroll-behavior-x: contain;
}

.ic-tools-strip.is-fitted {
  justify-content: space-between;
  overflow: hidden;
  cursor: default;
  gap: 2px;
}

.ic-tools-strip::-webkit-scrollbar {
  display: none;
}

.ic-tools-strip .ic-tool {
  flex: 0 0 71px;
  width: 71px;
  padding: 0;
  touch-action: manipulation;
}

.ic-tools-strip .ic-tool-icon,
.ic-tools-strip .ic-tool-icon img {
  width: 58px;
  height: 58px;
}

.ic-tools-strip .ic-tool-title {
  font-size: 9px;
}

.ic-tools-strip.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.ic-tools-strip img {
  -webkit-user-drag: none;
  user-select: none;
}

.ic-home-tools-grid {
  display: flex;
  flex-wrap: wrap;
  margin-top: 14px;
}

.ic-home-tools-grid .ic-home-tool {
  width: 25%;
  flex: 0 0 25%;
  padding: 8px;
  margin-bottom: 12px;
}

.ic-rail--tools {
  margin-bottom: 8px;
}

.ic-rail--tools .ic-home-tools-grid .ic-home-tool {
  margin-bottom: 4px;
}

@media (max-width: 1024px), (min-width: 801px) {
  .ic-tools {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 800px) {
  .ic-tools-strip-wrap {
    margin-inline: -16px;
    margin-top: 8px;
    margin-bottom: 4px;
  }

  .ic-tools-strip {
    gap: 2px;
    padding: 10px;
  }

  .ic-tools-strip .ic-tool {
    flex: 0 0 71px;
    width: 71px;
    height: 83px;
  }

  .ic-tools-box .ic-sheet-backdrop {
    background: #fff;
    opacity: 1;
  }

  .ic-tools-box .ic-sheet-panel {
    position: absolute;
    inset: 0;
    width: auto;
    max-width: none;
    margin: 0;
    height: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    transform: none;
    opacity: 1;
    transition: none;
    display: flex;
    flex-direction: column;
  }

  .ic-tools-box .ic-sheet-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
  }

  .ic-tools-box.ic-sheet.is-open .ic-sheet-panel {
    transform: none;
  }

  .ic-tools-box .ic-sheet-head {
    padding: 12px 16px 8px;
  }

  .ic-tools-box .ic-sheet-head h2 {
    font-size: 13px;
    font-weight: 400;
  }

  .ic-tools-box .ic-sheet-grid .ic-sheet-tool {
    padding: 0 8px;
    margin-bottom: 20px;
  }

  .ic-tools-box .ic-sheet-grid .ic-tool-icon,
  .ic-tools-box .ic-sheet-grid .ic-tool-icon img {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 800px) {
  .ic-tools {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* دسکتاپ — sheet داخل قاب گوشی وسط صفحه (نه تمام عرض مانیتور) */
@media (min-width: 801px) {
  #ic-tools-sheet.ic-tools-box.ic-sheet {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 50%;
    right: auto;
    width: min(100%, var(--ic-phone-width, 430px));
    max-width: var(--ic-phone-width, 430px);
    transform: translateX(-50%);
  }

  #ic-tools-sheet.ic-tools-box.ic-sheet.is-open .ic-sheet-backdrop {
    background: #fff;
    opacity: 1;
  }

  #ic-tools-sheet .ic-sheet-panel {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    height: 100%;
    max-height: none;
    border-radius: 0;
    transform: none;
    display: flex;
    flex-direction: column;
  }

  #ic-tools-sheet .ic-sheet-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
  }

  #ic-tools-sheet .ic-tools-sheet-banner-dock {
    flex: 0 0 auto;
  }
}
