#template('colorThemeInit.vm')

/*!
#macro (toRGBa $hexColor $opacity)
  #set ($macro.hexColor = "$!hexColor")
  #if ($macro.hexColor.matches('#[0-9a-fA-F]{3}'))
    ## Expand the color value.
    #set ($macro.hexColor = $macro.hexColor.replaceAll('(\w)', '$1$1'))
  #end
  #if ($macro.hexColor.matches('#[0-9a-fA-F]{6}'))
    #set ($integer = 0)
    #set ($red = $integer.parseInt($macro.hexColor.substring(1,3), 16))
    #set ($green = $integer.parseInt($macro.hexColor.substring(3,5), 16))
    #set ($blue = $integer.parseInt($macro.hexColor.substring(5), 16))
    rgba($red, $green, $blue, $opacity)
  #end
#end
#set ($lightBackgroundSecondaryColor = "#toRGBa($theme.backgroundSecondaryColor, 0.5)")
#set ($lightTextSecondaryColor = "#toRGBa($theme.textSecondaryColor, 0.5)")
*/

/**
 * Raw (Wiki Syntax) Diff
 */

.diff-container {
  border: 1px solid $theme.borderColor;
  font-family: Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  overflow: auto;
}

.diff-container table {
  /* Prevent scroll bars when the table fills the entire width. */
  margin: 0;
}

.diff-container td {
  border: 0 none;
  padding: 0 .5em;
}

td.diff-line-number {
  border-right: 1px solid $theme.borderColor;
  color: $lightTextSecondaryColor;
  text-align: center;
  vertical-align: middle;
}

td.diff-line {
  /* Take all the available space. */
  width: 100%;
  vertical-align: middle;
}

.diff-line-added {
  background-color: #DDFFDD;
  color: #000;
}

.diff-line-deleted {
  background-color: #FFDDDD;
  color: #000;
}

td.diff-line-meta {
  background-color: $lightBackgroundSecondaryColor;
  color: $lightTextSecondaryColor;
  padding: .4em .5em;
}

.diff-line del {
  background-color: #FFAAAA;
  text-decoration: none;
}

.diff-line ins {
  background-color: #AAFFAA;
  text-decoration: none;
}

.diff-conflict {
  background-color: #FFCF00;
}

.diff-conflict-resolution {
  background-color: #B8DEFF;
  border: 1px dashed;
}

span.diff-decision {
  padding-top: 10px;
  display: inline-block;
}

textarea.diff-decision {
  width: 70%;
  display: inline-block;
}

/* Prevent displaying the maximize link */
.diff-line .fullScreenEditLinkContainer {
  display: none;
}

.empty-decision-value {
  color: red;
}

.diff-choices {
  float: right;
}

dt.diff-header {
  border-left: 5px solid $theme.borderColor;
  border-right: 1px solid $theme.borderColor;
  color: $theme.textSecondaryColor;
  font-weight: normal;
  margin: 0;
  padding: .5em .2em;
}

dt.diff-header:first-child,
dt.diff-header + dt.diff-header {
  border-top: 1px solid $theme.borderColor;
}

dt.diff-header:last-child {
  border-bottom: 1px solid $theme.borderColor;
}

dl.diff-group {
  margin-top: 1.5em;
}

dl.diff-group > dt {
  margin-bottom: 1em;
}

dl.diff-group > dt .hint {
  color: $theme.textSecondaryColor;
  font-weight: normal;
}

dl.diff-group > dd > dl {
  /* Overwrite the left margin from Colibri. */
  margin-left: 0;
}

.diff-icon-insert {
  color: #55A532;
}

.diff-icon-delete {
  color: #BD2C00;
}

.diff-icon-change {
  color: #D0B44C;
}

.diff-item-locale, .diff-item-hint {
  color: $theme.textSecondaryColor;
  font-size: 65%;
}

.diff-item-locale {
  vertical-align: middle;
}

.diff-item-hint {
  display: block;
  margin-top: .3em;
}

ul.diff-summary {
  padding-left: 0;
}

ul.diff-summary, .diff-summary ul {
  list-style: none;
}

.diff-summary-item {
  padding: .3em 0;
}

.diff-summary-item-hint {
  color: $theme.textSecondaryColor;
  font-size: 85%;
}

.diff-info-icon {
  cursor: default;
}

/**
 * Rendered Content (HTML) Diff
 */

.html-diff [data-xwiki-html-diff="deleted"] {
  background-color: #FFAAAA;
}
.html-diff [data-xwiki-html-diff="inserted"] {
  background-color: #AAFFAA;
}
/* Not all images have transparent background so using only the background color to mark deleted and inserted images is
  not enough. */
.html-diff img[data-xwiki-html-diff="deleted"] {
  border: 2px solid #FFAAAA;
}
.html-diff img[data-xwiki-html-diff="inserted"] {
  border: 2px solid #AAFFAA;
}
.html-diff [data-xwiki-html-diff-block="deleted"] {
  background-color: #FFDDDD;
}
.html-diff [data-xwiki-html-diff-block="inserted"] {
  background-color: #DDFFDD;
}
.html-diff [data-xwiki-html-diff-hidden="true"] {
  display: none;
}

.html-diff [data-xwiki-html-diff-hidden="ellipsis"] {
  height: 20px;
  visibility: hidden;
}
.html-diff [data-xwiki-html-diff-hidden="ellipsis"]:before {
  color: $theme.textSecondaryColor;
  content: '...';
  cursor: pointer;
  position: absolute;
  visibility: visible;
}
.html-diff [data-xwiki-html-diff-hidden="ellipsis"]:hover:before {
  color: $theme.linkColor;
}
