/* ----------------------------------
 * Action menu
 * ---------------------------------- */

html[dir="ltr"] [role="dialog"][data-type="action"] [dir],
html[dir="ltr"] [role="dialog"][data-type="action"] button {
  text-align: left;
}
html[dir="rtl"] [role="dialog"][data-type="action"] [dir],
html[dir="rtl"] [role="dialog"][data-type="action"] button {
  text-align: right;
}

/* Main dialog setup */
[role="dialog"][data-type="action"] {
  background: #2d2d2d;
  overflow: hidden;
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 0 7rem;
  /**
   * Using "font-size: 0" to avoid the unwanted visual space (about 3px) created
   * by white spaces and line breaks in the code between inline-block elements.
   */
  font-size: 0;
  color: #fff;
}

[role="dialog"][data-type="action"]:before {
  content: '';
  display: inline-block;
  vertical-align: top;
  width: 0.1rem;
  height: 100%;
  margin-inline-start: -0.1rem;
}

[role="dialog"][data-type="action"] > header {
  box-sizing: border-box;
  font-size: 1.6rem;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: 5rem;
  line-height: 4.9rem;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  overflow: hidden;
  font-weight: normal;
  padding: 0 3rem;
  border-bottom: 0.1rem solid #616262;
}
[role="dialog"][data-type="action"] > header * {
  overflow: hidden;
  text-overflow: ellipsis;
}

[role="dialog"][data-type="action"] > header h1 {
  font-size: 1.6rem;
  line-height: 4.9rem;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  overflow: hidden;
  margin: 0;
  height: 100%;
  font-weight: normal;
}

/* Generic set of actions in toolbar */
[role="dialog"][data-type="action"] > header menu[type="toolbar"] {
  height: 100%;
  margin: 0 -3rem;
  margin-inline-start: 1rem;
  padding: 0;
}
html[dir="ltr"] [role="dialog"][data-type="action"] > header menu[type="toolbar"] { float: right; }
html[dir="rtl"] [role="dialog"][data-type="action"] > header menu[type="toolbar"] { float: left; }

[role="dialog"][data-type="action"] > header menu[type="toolbar"] a,
[role="dialog"][data-type="action"] > header menu[type="toolbar"] button {
  box-sizing: border-box;
  position: relative;
  width: auto;
  min-width: 5rem;
  height: 4.9rem;
  margin-bottom: 0;
  padding: 0 1rem;
  border-radius: 0;
  line-height: 4.9rem;
  background: none;
  text-align: center;
  text-shadow: none;
  z-index: 5;
}
html[dir="ltr"] [role="dialog"][data-type="action"] > header menu[type="toolbar"] a,
html[dir="ltr"] [role="dialog"][data-type="action"] > header menu[type="toolbar"] button {
  float: left;
}
html[dir="rtl"] [role="dialog"][data-type="action"] > header menu[type="toolbar"] a,
html[dir="rtl"] [role="dialog"][data-type="action"] > header menu[type="toolbar"] button {
  float: right;
}

[role="dialog"][data-type="action"] > header a,
[role="dialog"][data-type="action"] > header button {
  border: none;
  padding: 0;
  overflow: hidden;
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.1em;
  color: #fff;
  border-radius: 0;
  text-decoration: none;
}

[role="dialog"][data-type="action"] button::-moz-focus-inner {
  outline: none;
  border: none;
}

/* Pressed state */
[role="dialog"][data-type="action"] > header a:active .icon:after,
[role="dialog"][data-type="action"] > header button:active .icon:after,
[role="dialog"][data-type="action"] > header menu[type="toolbar"] a:active,
[role="dialog"][data-type="action"] > header menu[type="toolbar"] button:active  {
  background: #008aaa !important;
}

/* Disabled state */
[role="dialog"][data-type="action"] > header menu[type="toolbar"] a[aria-disabled="true"],
[role="dialog"][data-type="action"] > header menu[type="toolbar"] button[disabled]  {
  opacity: 0.5;
  pointer-events: none;
}

/* Icon definitions */
[role="dialog"][data-type="action"] > header .icon {
  position: relative;
  float: none;
  display: inline-block;
  vertical-align: top;
  width: 4rem;
  height: 4.9rem;
  margin: 0 -1rem;
  background: transparent no-repeat center center / 3rem auto;
  font-size: 0;
  overflow: hidden;
}

[role="dialog"][data-type="action"] > header .icon.icon-close {
  background-image: url(action_menu/images/icons/close.png);
}

html[dir="ltr"] [role="dialog"][data-type="action"] > header .icon.icon-back {
  background-image: url(action_menu/images/icons/left.png);
}
html[dir="rtl"] [role="dialog"][data-type="action"] > header .icon.icon-back {
  background-image: url(action_menu/images/icons/right.png);
}

/* Navigation links (back, cancel, etc) */
[role="dialog"][data-type="action"] > header > button,
[role="dialog"][data-type="action"] > header > a {
  width: 5rem;
  height: 4.9rem;
  background: none;
  overflow: visible;
  margin: 0 -1rem;
  margin-inline-start: -3rem;
  position: relative;
}
html[dir="ltr"] [role="dialog"][data-type="action"] > header > button,
html[dir="ltr"] [role="dialog"][data-type="action"] > header > a {
  float: left;
}
html[dir="rtl"] [role="dialog"][data-type="action"] > header > button,
html[dir="rtl"] [role="dialog"][data-type="action"] > header > a {
  float: right;
}

[role="dialog"][data-type="action"] > header > button::-moz-focus-inner {
  border: 0;
  padding: 0;
}

[role="dialog"][data-type="action"] > header > button .icon,
[role="dialog"][data-type="action"] > header > a .icon {
  position: static;
  display: block;
  width: 3rem;
  height: 4.9rem;
  margin: 0;
  overflow: visible;
  font-size: 0;
}

[role="dialog"][data-type="action"] > header > button .icon:after,
[role="dialog"][data-type="action"] > header > a .icon:after {
  content: "";
  position: absolute;
  offset-inline-start: 0;
  top: 0;
  z-index: -1;
  width: 3rem;
  height: 4.9rem;
}

/* Content */
[role="dialog"][data-type="action"] > section {
  color: #fff;
  position: absolute;
  top: 7rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 2rem;
  font-size: 1.6rem;
  overflow: scroll;
}

/* Specific component code */
[role="dialog"][data-type="action"] > menu {
  margin: 0;
  padding: 0;
  max-height: calc(100% - 13.5rem); /*header(5rem) + footer(7rem) + padding(1.5rem)*/
  height: auto;
  padding-top: 1.5rem;
  overflow: auto;
  width: auto;
  border: none;
  background: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7rem;
}

[role="dialog"][data-type="action"] > menu > button {
  width: calc(100% - 3rem);
  height: 4rem;
  box-sizing: border-box;
  vertical-align: middle;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  font-weight: normal;
  line-height: 4rem;
  outline: none;
  font-size: 1.6rem;
  text-shadow: none;
  padding: 0 1.2rem;
  margin: 0 1.5rem 1rem;
  background: rgba(87, 87, 87, 0.8);
  border: none;
  border-radius: 0;
  position: relative;
  color: #fff;
  font-family: sans-serif;
  font-style: italic;
}

[role="dialog"][data-type="action"] > menu > .last-button-container {
  position: fixed;
  width: 100%;
  background-color: #4d4d4d;
  height: 7rem;
  offset-inline-start: 0;
  bottom: 0;
}

[role="dialog"][data-type="action"] > menu > .last-button-container button {
  width: calc(100% - 3rem);
  position: fixed;
  bottom: 0;
  margin: 0 1.5rem 1.5rem;
  offset-inline-start: 0;
  color: #333;
  background: #d8d8d8;
  text-align: center;
  border: none;
  border-radius: 2rem;
  line-height: 4rem;
  font-size: 1.6rem;
  height: 4rem;
  font-family: sans-serif;
  font-style: italic;
}

[role="dialog"][data-type="action"] > menu > button:nth-last-child(2) {
  margin-bottom: 1.5rem;
}

/* Press state */
[role="dialog"][data-type="action"] > menu button:active {
  background: #00aacc;
  color: #fff;
}

/* Disabled */
[role="dialog"][data-type="action"] > menu > button[disabled] {
  background-color: rgba(87, 87, 87, 0.8);
  color: rgba(255, 255, 255, 0.4);
  opacity: 0.5;
  pointer-events: none;
}

[role="dialog"][data-type="action"] > menu > .last-button-container button[disabled] {
  background-color: #e7e7e7;
  color: #a6a6a6;
  opacity: 1;
}
