/* ui-version: 5 (do not change when modifying theme for yourself) */
/* Variables */
@if not(global-variable-exists(background-color)) {
  $background-color: #ccc !global;
}

/* Background colors associated with received emails: */
@if not(global-variable-exists(recv-normal)) {
  $recv-normal: #ffffff !global;
}
@if not(global-variable-exists(recv-quoted)) {
  $recv-quoted: #e8e8e8 !global;
}
@if not(global-variable-exists(recv-collapsed)) {
  $recv-collapsed: #f5f5f5 !global;
}

/* Background colors associated with sent emails: */
@if not(global-variable-exists(sent-normal)) {
  $sent-normal: #ffffff !global;
}

@if not(global-variable-exists(sent-quoted)) {
  $sent-quoted: #e8e8e8 !global;
}

@if not(global-variable-exists(sent-collapsed)) {
  $sent-collapsed: #f5f5f5 !global;
}

/* Fonts */
@if not(global-variable-exists(font-base-size)) {
  $font-base-size: 16px !global;
}

@if not(global-variable-exists(font-mono)) {
  $font-mono: monospace !global;
}

@if not(global-variable-exists(font-sans)) {
  $font-sans: sans-serif !global;
}

@if not(global-variable-exists(font-family-default)) {
  $font-family-default: $font-sans !global;
}

/* Colours */
@if not(global-variable-exists(email-solid)) {
  $email-solid: #d8d8d8 !global;
}

@if not(global-variable-exists(focused-solid)) {
  $focused-solid: #4a90d9 !global;
}

@if not(global-variable-exists(sibling-color)) {
  $sibling-color: lighten( $focused-solid, 20%) !global;
}

@if not(global-variable-exists(attachment-color)) {
  $attachment-color:  $sibling-color !global;
}

@if not(global-variable-exists(mime-color)) {
  $mime-color: lighten( #FFFF00, 15%) !global;
}

@if not(global-variable-exists(encrypted)) {
  $encrypted: #99cc66 !global;
}

@if not(global-variable-exists(signed)) {
  $signed: #cccc66 !global;
}

@media print {

    body {
        background-color: white !important;
    }
    body, .email {
        font-size: 11px !important;
    }
    .avatar, .button, .starred {
        display: none !important;
    }
    .email {
        display: none !important;
    }
    .email.print {
        display: block !important;
        background-color: white !important;
        clear: both !important;
        float: left !important;
    }
    .email.print .body {
        display: inline-block !important;
        background-color: white !important;
    }
    .email.print .preview {
        display: none !important;
    }

    .email.print .tags {
        display: none !important;
    }

    .email.print .subject {
        display: none !important;
    }

    .email.print .hidden_only {
        display: none !important;
    }

    .email.print {
        border-left: 0px !important;
    }

    .email .header_container .marked.icon {
      display: none !important;
    }

    .noprint {
      display: none !important;
    }
}

body {
    margin: 0 !important;
    padding: 0 !important;
    font-size: $font-base-size;
    font-family: $font-family-default;
    // -webkit-user-select: none;
    // -webkit-user-drag: none;
    text-align: center;
}



a {
    color: #08c;
}

td, th {
    vertical-align: top;
}
hr {
    background-color: #999;
    height: 1px;
    border: 0;
    margin-top: 15px;
    margin-bottom: 15px;
}

.body, .header, .preview {
    -webkit-user-select: auto;
    -webkit-user-drag: auto;
}
.shower, .hider {
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.button {
    border: 1px transparent solid;
    border-radius: 2.5px;
    cursor: pointer;
    padding: 4px;
    margin-top: 7px;
    text-align: center;
}
.button * {
    pointer-events: none;
}
.button:hover {
    border-color: rgba(0,0,0,0.18);
    box-shadow: inset 0px 0px 1px rgba(255,255,255,0.8);
}
.button:active {
    border-color: rgba(0,0,0,0.20);
    background-color: rgba(0,0,0,0.05);;
    padding: 5px 3px 3px 5px;
    box-shadow: inset 0px 0px 1px rgba(0,0,0,0.05);
}

.email {
    font-size: $font-base-size;
    /* border: 1px rgba(0,0,0,1) solid; */
    border: 1px solid $email-solid;
    border-width: 1px 0px;
    background-color: $recv-normal !important;
    color: black;
    /*font-size: small;*/
    /* box-shadow: 0 3px 3px rgba(0,0,0,1);
    display: inline-block;
    word-wrap: break-word;
    width: auto;
    /*margin-left: auto;*/
    /*margin-right: auto;*/
    width: 100%;
    /*min-width: 48em;*/
    box-sizing:border-box;
    text-align: left;
    margin: 3px 0;

    & + & {
      margin-right: auto !important;
    }

    & > & > & > & > & {
        font-size: 90%;
    }

    .email_container {
	.header_container, .body {
	    border-left: 6px solid transparent;
	}
	.email_warning {
	    padding-left: 6px;
	}
    }
    .attachment_container {
	border-left: 6px solid transparent;
    }

    &.focused {
      padding-left: 0px;
      border-left: 0px;
      /* box-shadow: 0 0 0 transparent !important; */

      .email_container, .attachment_container {
	border-left: 6px solid $focused-solid;

	.header_container, .body {
	    border-left: 0px;
	}
	.email_warning {
	    padding-left: 0px;
	}
      }
    }
    &.hide {
      background-color: darken( $recv-normal, 5% ) !important;
      padding-left: 7px;
      border-left: 6px solid transparent;
	.email_container, .header_container, .body {
	    border-left: 0;
	}
    }
    &.focused.hide {
      border-left: 6px solid $focused-solid;
    }

    .body {
      padding: 15px;
      max-width: 60em;
    }
}

.email.sent {
    background-color: white;/* sent-normal */
}

.email .starred {
    display: none;
}
.email .unstarred {
    display: block;
}
.email.starred .starred {
    display: block;
}
.email.starred .unstarred {
    display: none;
}
.email.read, #multiple_messages .email {
    border-color: rgba(0,0,0,0.4);
    box-shadow: 0 3px 11px rgba(0,0,0,0.21);
}
.email.animate {
    -webkit-transition: border-color 3s ease;
    -webkit-transition: box-shadow 3s ease;
}

.email .email_warning {
    display: none;
    padding: 1em;
    background-color: #fcc;
    text-align: center;
}

.email .email_info {
    display: none;
    padding: 1em;
    background-color: #8CE7FF;
    text-align: center;
}

.email_box {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    width: 100% !important;
}
.email_container {
    overflow: hidden;
}
.email_container .header_container {
    padding: 15px;
}

.email_container .header_container a:hover * {
    color: #08c;
}

.email_container .header_container .button_bar {
    float: right;
    margin-top: -6px;
}
.email_container .header_container .button_bar > .button {
    float: left;
}
.email_container .header_container .button_bar > .button > .icon {
    width: 16px;
    height: 16px;
}

.email_container .header_container .preview {
    /*font-size: 8pt;*/
    font-size: 0.8em;
    color: #777;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-left: 48px;
}

.email_container .header_container .tags {
    /*font-size: 8pt;*/
    font-size: 0.7em;
    color: #31587a;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-left: 48px;
}

.email_container .header_container .subject {
    /*font-size: 8pt;*/
    font-size: 0.7em;
    color: #000;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    margin-left: 48px;
}

.focused {
    /* box-shadow: 0 0 10px rgba(71,71,173,1) !important; */
}

.avatar {
    display: none;
    image-rendering: optimizeQuality;
}

.avatar[src^=file], .avatar[src^=http], .avatar[src^=data] {
    display: inline;
    width: 48px;
    height: 48px;
    float: left;
    border-radius: 5px;
}

body:not(.nohide) .email.hide .header_container .avatar {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    border-radius: 2.5px;
}

.email .body {
    border-top: 1px solid $email-solid;
    margin: 5px;
    margin-top: 0;
    padding-top: 25px;
    overflow-x: auto;
    overflow-y: hidden;

    .body_part a[href*="//"] {
	word-break: break-all;
    }
}

iframe {
  border: none;
  width: 100%;
  text-align: left;
  float: left;
  display: block;
}

.email .remote_images {
    display: none;
    margin: 0 16px;
    border: 1px solid #999;
    border-bottom: none;
    padding: 1em;
    background: #ffc;
}

.email .remote_images .close_show_images {
    float: right;
    margin-top: -0.67em;
    margin-right: -0.67em;
}

.email .replaced_inline_image {
    max-width: 100%;
    display: block;
    margin-top: 1em;
}

.email .link_warning {
    display: inline-block;
    position: absolute;
    margin-top: -1em;
    border: 1px solid #999;
    padding: 1em;
    background: #ffc;
    box-shadow: 0 3px 11px rgba(0,0,0,0.21);
    /* Reset styles */
    font-size: 0.8em;
    font-family: sans;
    color: black;
}
.email .link_warning a {
    color: #08c;
}
.email .link_warning span {
    display: block;
    padding-left: 1em;
}
.email .link_warning .close_link_warning {
    float: right;
    margin-top: -0.67em;
    margin-right: -0.67em;
}

@media screen {

    body {
        background-color: $background-color !important;
    }

    body:not(.nohide) .email.hide,
    body:not(.nohide) .email .email.hide {
        background-color: #f5f5f5;/* recv-collapsed */
        box-shadow: 0 2px 5px rgba(0,0,0,0.12);
    }
    body:not(.nohide) .email.sent.hide,
    body:not(.nohide) .email.sent .email.hide {
        background-color: #f5f5f5;/* sent-collapsed */
    }
    body:not(.nohide) .email.hide .body,
    body:not(.nohide) .email.hide > .attachment_container,
    .email:not(.hide) .header_container .preview,
    body.nohide .email .header_container .preview,
    body:not(.nohide) .email.hide .email {
        display: none;
    }
    .email:not(.hide) .email_warning.show,
    .email:not(.hide) .email_info.show,
    body:not(.nohide) .email.hide .header_container .preview {
        display: block;
    }
    .email:not(.hide) .header_container .tags,
    body.nohide .email .header_container .tags,
    body:not(.nohide) .email.hide .email {
        display: none;
    }
    .email:not(.hide) .email_warning.show,
    .email:not(.hide) .email_info.show,
    body:not(.nohide) .email.hide .header_container .tags {
        display: block;
    }
    .email:not(.hide) .header_container .subject,
    body.nohide .email .header_container .subject,
    body:not(.nohide) .email.hide .email {
        display: none;
    }
    .email:not(.hide) .email_warning.show,
    .email:not(.hide) .email_info.show,
    body:not(.nohide) .email.hide .header_container .subject {
        display: block;
    }
    body:not(.nohide) .email:not(:only-of-type) .header_container,
    body:not(.nohide) .email .email .header_container {
        cursor: pointer;
    }
    .email:not(.hide) .header .field .value,
    body.nohide .email .header .field .value {
        cursor: auto;
    }
    body:not(.nohide) .email.hide .header {
        padding: 0;
        text-align: right;
    }
    body:not(.nohide) .email.hide .header .field {
        display: inline;
        margin-right: 2px;
        text-align: left;
    }
    body:not(.nohide) .email.hide .header .field:not(:first-child) {
        display: inline-block;
    }
    body:not(.nohide) .email.hide .header .field:not(.important),
    body:not(.nohide) .email.hide .header .field .title {
        display: none;
    }
    body:not(.nohide) .email.hide .header .field .value {
        margin-left: 0;
    }
    body:not(.nohide) .email.hide .header .field .not_hidden_only,
    .email:not(.hide) .header .field .hidden_only,
    body.nohide .email .header .field .hidden_only {
        display: none;
    }
    body:not(.nohide) .email.hide .header .field a {
        pointer-events: none;
    }
    .email:not(.hide) .remote_images.show,
    body.nohide .email .remote_images.show {
        display: block;
    }
    body:not(.nohide) .email.compressed {
        margin-top: -1px;
        height: 10px;
    }
    body:not(.nohide) .email.compressed + .email {
        margin-top: -1px;
    }
    body:not(.nohide) .compressed .email_container {
        overflow: hidden;
        display: none
    }
    body:not(.nohide) .compressed + .compressed + .compressed + .compressed + .compressed + .compressed + .compressed + .compressed + .compressed {
        display:none;
    }
}

.email .compressed_note {
    text-align: center;
    height: 0;
}
.email .compressed_note > span {
    display: none;
    padding: 0px 10px;
    background-color: #f5f5f5;/* recv-collapsed */
    position: relative;
    cursor: hand;
}
.email.sent .compressed_note > span {
    background-color: #f5f5f5;/* sent-collapsed */
}
body.nohide .email .compressed_note > span {
    display: none !important;
}

.email .email {
    box-shadow: none;
    margin-top: 0;
    border: none;
    border-top: 1px rgba(0,0,0,0.4) solid;
    background-color: white;/* recv-normal */
}
.email.sent .email {
    background-color: white;/* sent-normal */
}
.email .email .email_container .menu,
.email .email .email_container .starred,
.email .email .email_container .unstarred {
    display: none;
}

.email.hide .marked.icon.first {
    display: none;
}
.email:not(.hide) .marked.icon.sec {
    display: none;
}
.email:not(.marked) .marked.icon {
    display: none;
}
.email .header_container .marked.icon {
    float: right;
    height: 20px;
}

.email.hide .attachment.icon.first {
    display: none;
}
.email:not(.hide) .attachment.icon.sec {
    display: none;
}
.email:not(.attachment) .attachment.icon {
    display: none;
}
.email .header_container .attachment.icon {
    float: right;
    height: 20px;
}

.email > .attachment_container {
    padding-bottom: 10px;
}
.email > .attachment_container > .top_border {
    border-bottom: 1px solid #aaa;
    height: 10px;
    margin: 0 16px 5px;
}
.email > .email + .attachment_container .top_border{
    height: auto;
    margin: 0;
}
.email > .attachment_container > .attachment {
    margin: 10px 10px 0 10px;
    padding: 2px;
    overflow: hidden;
    /*font-size: 10pt;*/
    /*font-size: small;*/
    font-size: 0.8em;
    cursor: pointer;
    display: inline;
    background-color: transparent;
    border-width: 1px;
    border-style: solid;
    border-radius: 4px;
    border-color: transparent;

    &.focused {
	background-color: lighten( $attachment-color, 5% );
    border-color: darken( $attachment-color, 50% );
	box-shadow: inset 0px 0px 1px rgba(255,255,255,0.8);
    }
}

.email > .attachment_container > .attachment:hover,
.email > .attachment_container > .attachment:active {
    border-color: rgba(0,0,0,0.18);
    box-shadow: inset 0px 0px 1px rgba(255,255,255,0.8);
}

.email > .attachment_container > .attachment:active {
    padding: 3px 1px 1px 3px;
    border-color: rgba(0,0,0,0.20);
    background-color: rgba(0,0,0,0.05);
    box-shadow: inset 0px 0px 2px rgba(0,0,0,0.05);
}

.email > .attachment_container > .attachment .preview {
    width: 52px;
    height: 52px;
    text-align: center;
    vertical-align: middle;
}
.email > .attachment_container > .attachment .preview img {
    max-width: 50px;
    max-height: 50px;
}
.email > .attachment_container > .attachment .preview .thumbnail {
    border: 1px solid #999;
    box-shadow: 0 0 5px #b8b8b8;
    background-size: 16px 16px;
    background-position:0 0, 8px 0, 8px -8px, 0px 8px;
    max-width: 150px;
    max-height: 150px;
}
.email > .attachment_container > .attachment:hover .preview .thumbnail {
    background-image:
        -webkit-linear-gradient(45deg, rgba(0, 0, 0, 0.1) 25%, transparent 25%, transparent),
        -webkit-linear-gradient(-45deg, rgba(0, 0, 0, 0.1) 25%, transparent 25%, transparent),
        -webkit-linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.1) 75%),
        -webkit-linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.1) 75%);
}
.email > .attachment_container > .attachment .info {
    vertical-align: middle;
    padding-left: 5px;
    font-size: 0.7em;
}
.email > .attachment_container > .attachment .info > :not(.filename) {
    color: #666;
}

.attachment .encrypted {
  border: 1px dashed green !important;
}

.attachment .signed {
  border: 1px dashed orange !important;
}


#encrypt_container {
  display: none;
}

.email > .email_container > .body > .encrypt_container {
  display: block;
  clear: both;
  vertical-align: middle;
  text-align: center;
  padding-bottom: 5px;
  padding-top: 5px;
  margin-top: 5px;
  margin-bottom: 5px;
  border: 1px solid black;
  color: #333333;
}

.email > .email_container > .body > .encrypt_container > .message > span.header {
  color: black;
  font-weight: bold;
  margin-bottom: 2px;
  display: block;
}

.encrypt_container.encrypted, .encrypt_container.encrypted.signed {
  background-color: $encrypted;
}

.encrypt_container.signed {
  background-color: $signed;
}

.encrypt_container.verify_failed, .encrypt_container.decrypt_failed {
  background-color: red;
}

.body_part.encrypted.decrypt_failed {
  border-left: 0px;
}

.body_part.encrypted, .body_part.encrypted.signed {
  display: block;
  border-left: 5px solid $encrypted;
  padding: 10px;
}

.gpg_error {
  border-left: 5px solid red;
  padding-left: 5px;
  margin-left: 5px;
}

.body_part.signed.verify_failed {
  border-left: 0px;
}

.body_part.signed {
  display: block;
  border-left: 5px solid $signed;
  padding: 10px;
}

#sibling_container {
    display: none;
}

.email > .email_container > .body > .sibling_container, .email > .email_container > .body > .mime_container {
    display: block;
    clear: both;
    vertical-align: middle;
    text-align: center;
    padding: 0px;
    margin-top: 15px;
    margin-bottom: 0;
    background-color: lighten( $sibling-color, 15% );
    border-width: 0 0 1px 0px;
    border-style: solid;
    border-color: darken( $sibling-color, 20% );
    border-radius: 4px;
    color: darken( $sibling-color, 80% );

    .message {
	padding-top: 6px;
	padding-bottom: 6px;
	font-size: 90%;
    }

    &.focused/*, &:hover /* click not supported yet */ {
	background-color: lighten( $sibling-color, 5% );
	.message {
	    border-color: darken( $sibling-color, 50% );
	}
    }
}

#mime_container {
    display: none;
}

.email > .email_container > .body > .mime_container {
    background-color: lighten( $mime-color, 20% );
    border-color: darken( $mime-color, 20% );
    color: darken( $mime-color, 80% );

    &.focused/*, &:hover /* click not supported yet */ {
	background-color: lighten( $mime-color, 1% );
	.message {
	    border-color: darken( $mime-color, 50% );
	}
    }
}

.header {
    overflow: hidden;
    font-size: 90%;

    #Tags {
	.value span {
	    padding: 2px;
	}
    }
}
.header .field {
    clear: both;
    overflow: hidden;
    /*font-size: 9pt;*/
    /*font-size: normal;*/
}
.header .field .title,
.header .field .value {
    float: left;
    padding: 2px 0;
}
.header .field .title {
    width: 6.0em;
    text-align: right;
    padding-right: 7px;
    color: #777;
    position: absolute;
}
.header .field .value {
    color: black;
    margin-left: 6.25em;
    max-height: 5em;
    overflow-y: auto;
}
.header .field .value a {
    color: black;
    text-decoration: none;
}
.header .field.important .address_name {
    font-weight: bold;
}
.header .field .address_value {
    color: #777;
}

.geary_spacer {
    display: table;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    width: 100% !important;
}

.signature {
    color: #777;
    display: inline;
}
.signature a,
.quote_container a {
    color: #5fb2e7;
}

.quote_container {
    margin: 5px 0;
    padding: 12px;
    color: #303030;
    background-color: #e8e8e8;/* recv-quoted */
    border-radius: 4px;
}

.email.sent .quote_container {
    background-color: #e8e8e8;/* sent-quoted */
}

.quote_container > .shower,
.quote_container > .hider {
    color: #777;
    font-family: sans-serif;
    /*font-size: 75%;*/
    font-size: 0.8em;
    cursor: pointer;
    display: none;
}
body:not(.nohide) .quote_container.controllable > .shower {
    display: block;
}
.quote_container.controllable > .hider,
body:not(.nohide) .quote_container.controllable > .quote {
    display: none;
}
body:not(.nohide) .quote_container.controllable.show > .shower {
    display: none;
}
body:not(.nohide) .quote_container.controllable.show > .hider,
body:not(.nohide) .quote_container.controllable.show > .quote {
    display: block;
}
.quote_container > .shower:hover,
.quote_container > .hider:hover {
    color: black;
}

#message_container {
    /*position: absolute;*/
    /*left: 0;*/
    /*right: 0;*/
    /*padding: 0 5px 0px;*/
    /*left: 50%;*/
    margin: 0 auto;
    display: inline-block;
    width: 100%;
    max-width: 60em;
    text-align: center;
    font-family: $font-family-default;
}
#multiple_messages {
    display: none;
    text-align: center;
}
#multiple_messages > .email {
    margin: 100px auto;
    display: inline-block;
    width: auto;
    padding: 15px;
}
#body_template,
#email_template,
#attachment_template,
#link_warning_template {
    display: none;
}

.search_coloring *::selection {
    background-color: #00ddff;
}

.draft_edit {
    display: none;
    margin: 16px;
    text-align: right;
}

.draft_edit_button {
    background-color: #e8e8e8;
}

