@include portal-type-font-awesome-icon(ftw-book-book, book);
@include portal-type-font-awesome-icon(ftw-book-chapter, bookmark);
@include portal-type-font-awesome-icon(ftw-book-filelistingblock, list-ul);
@include portal-type-font-awesome-icon(ftw-book-htmlblock, code);
@include portal-type-font-awesome-icon(ftw-book-table, table);
@include portal-type-font-awesome-icon(ftw-book-textblock, paragraph);

/* HTML Block
https://github.com/4teamwork/ftw.htmlblock/blob/master/ftw/htmlblock/browser/resources/styles.scss
*/
@include ie-only(".sl-can-edit .ftw-book-htmlblock.has-iframe .sl-block-content") {
  cursor:  not-allowed;
}

@include ie-only(".sl-can-edit .ftw-book-htmlblock iframe") {
  pointer-events: none;
}


ul.book-index {
  &, & ul {
    list-style: none;
  }
  li {
    margin-top: .2em;
    margin-bottom: 0;
  }
}


.ftw-book-table table {
  width: 100%;
}


body .sl-simplelayout.sl-can-edit .sl-block.ftw-book-chapter {
  min-height: 0;
}
.sl-block.ftw-book-chapter h2 {
  margin: .5em 0;
}


/* let chapter be addable although its a sl block
https://github.com/4teamwork/ftw.simplelayout/blob/master/ftw/simplelayout/browser/dynamic_scss_resources.py */
body #plone-contentmenu-factories .contenttype-ftw-book-chapter {
  display: block !important;
}

a.book-sl-toolbar-icon-table-import-export {
  background-image: embed-resource("importexport.svg", $fill-css:('.icon', $color-icon));
  &:hover {
    background-image: embed-resource("importexport.svg", $fill-css:('.icon', $color-sl-icon-hover));
  }
}

/* MAIN BOOK STYLES */
div#portal-column-one div.portletWrapper dl.portletGoToParent {
  margin-bottom: 0em;
}

/* Add chapter prefixes / numbering */
body {
  counter-reset: chapter section subsection subsubsection paragraph subparagraph;
}

.toc2 {
  counter-increment: chapter;

  &:not(.hiddenStructure) {
    counter-reset: section;
  }

  &:before {
    content: counter(chapter) " ";
  }
}

.toc3 {
  counter-increment: section;

  &:not(.hiddenStructure) {
    counter-reset: subsection;
  }

  &:before {
    content: counter(chapter) "." counter(section) " ";
  }
}

.toc4 {
  counter-increment: subsection;

  &:not(.hiddenStructure) {
    counter-reset: subsubsection;
  }

  &:before {
    content: counter(chapter) "." counter(section) "." counter(subsection) " ";
  }
}

.toc5 {
  counter-increment: subsubsection;

  &:not(.hiddenStructure) {
    counter-reset: paragraph;
  }

  &:before {
    content: counter(chapter) "." counter(section) "." counter(subsection) "." counter(subsubsection) " ";
  }
}

.toc6 {
  counter-increment: paragraph;

  &:not(.hiddenStructure) {
    counter-reset: subparagraph;
  }

  &:before {
    content: counter(chapter) "." counter(section) "." counter(subsection) "." counter(subsubsection) "." counter(paragraph) " ";
  }
}

.toc7 {
  counter-increment: subparagraph;

  &:before {
    content: counter(chapter) "." counter(section) "." counter(subsection) "." counter(subsubsection) "." counter(paragraph) "." counter(subparagraph) " ";
  }
}

.book-reader {
  // "toc2" increments the "chapter" counter but the "chapter" couunter is not reset
  // anywhere, thus the "chapter" counter will be increased by every chapter / sub chapter.
  // To prevent this we reset the "chapter" counter on a known parent that every chapter has.
  .book-reader-block {
    counter-reset: chapter;
  }

  .toc2 {
    counter-reset: section;
  }

  .toc3 {
    counter-reset: subsection;
  }

  .toc4 {
    counter-reset: subsubsection;
  }

  .toc5 {
    counter-reset: paragraph;
  }

  .toc6 {
    counter-reset: subparagraph;
  }

  .toc7 {
    counter-increment: subparagraph;
  }
}

/* Disable simplelayout design menu on chapter, since we cannot
   create a PDF with multiple columns. */
.portaltype-chapter #simplelayout-contentmenu-design {
  display: none;
}

.BlockOverallWrapper.chapter > a {
  display: block;
  margin-bottom: 2em;
}

.simplelayout-content table {
  width: 100%;
}

.border-grid {
  border: 1px solid #DEDEDE;
}

.border-right {
  border-right: 1px solid #DEDEDE;
}

.border-left {
  border-left: 1px solid #DEDEDE;
}

.border-bottom {
  border-bottom-width: 1px;
  border-bottom-color: #DEDEDE;
  border-bottom-style: solid;
}

.border-top {
  border-top-width: 1px;
  border-top-color: #DEDEDE;
  border-top-style: solid;
}

.right {
  text-align: right;
}

.left {
  text-align: left;
}

.center {
  text-align: center;
}

.indent2 {
  padding-left: 2mm;
}

.indent10 {
  padding-left: 10mm;
}

.bold {
  font-weight: bold !important;
}

.grey {
  color: #808080;
}

.scriptsize {
  font-size: 7.5pt;
  font-weight: normal;
}

.footnotesize {
  font-size: 7pt;
}

.sl-export-import-action {
  background: url("++resource++ftw.book-resources/icon_export_import.png") no-repeat !important;
}

/* Keywords tab */
#keywords_overview {
  padding-top: 1em;

  form .select2-container {
    float: left;
    margin-right: 0.5em;
  }

  .result, .no-results {
    clear: both;
    padding-top: 1em;
    margin-bottom: 1em;
  }
}

/* READER AND READER NAVIGATION */
#content .book-reader-navigation {
  li {
    list-style: none;
    margin: 0;
  }

  ul {
    list-style: none;
    padding: 0em 0em;
    margin-left: 2em;

    &.book-reader-navigation-0 {
      margin-left: 0;
    }
  }

  a {
    border: none;
    text-decoration: none;
    font-weight: bold;
    margin-bottom: 0.25em;
    display: block;

    &:hover, &:visited, &:link {
      border: none;
      text-decoration: none;
      font-weight: bold;
      margin-bottom: 0.25em;
      display: block;
    }

    &.active {
      color: #75AD0A;
    }
  }
}

.book-reader-content {
  overflow-y: scroll;
  padding: 0em 2em;
}

.book-reader-navigation {
  overflow-y: scroll;
  float: left;
  width: 30em;
  height: 50px;
  max-width: 30%;
}

#content #close-book-reader {
  display: none;
}


/** TINYMCE plugins Plone 4 **/
.ploneSkin {
  span.mce_tinymce_keyword {
    background: url("++resource++ftw.book.tinymce.keyword/img/keyword.png") no-repeat center center;
  }

  span.mce_tinymce_footnote {
    background: url("++resource++ftw.book.tinymce.footnote/img/footnote.png") no-repeat center center;
  }
}
