/*
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Mozilla XForms support.
 *
 * The Initial Developer of the Original Code is
 * IBM Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2005
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK *****
 */

@namespace url(http://www.w3.org/2002/xforms);
@namespace html url(http://www.w3.org/1999/xhtml);
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@namespace mozType url(http://www.mozilla.org/projects/xforms/2005/type);

html|*:root repeat,
html|*:root repeatitem,
html|*:root contextcontainer,
html|*:root group,
html|*:root switch,
html|*:root case,
html|*:root select1 item,
html|*:root select1 itemset,
html|*:root select1 choices {
  display: block;
}

xul|*:root output,
xul|*:root label,
xul|*:root input,
xul|*:root secret,
xul|*:root textarea,
xul|*:root trigger,
xul|*:root submit,
xul|*:root repeat,
xul|*:root repeatitem,
xul|*:root contextcontainer,
xul|*:root group,
xul|*:root switch,
xul|*:root case {
  display: -moz-box;
}

xul|*:root select1 item,
xul|*:root select1 itemset,
xul|*:root select1 choices {
  display: none;
}

contextcontainer-inline {
  display: inline;
}

select item,
select itemset,
select choices {
  display: none;
}

message[level="ephemeral"], hint {
  background-color: InfoBackground;
  color: InfoText;
  padding: 2px 3px;
  font: message-box;
  border: 1px black solid;
  visibility: hidden !important;
  position: absolute !important;
}

action {
  position: absolute;
  z-index: 2147481647;
  visibility: hidden;
  top: 0px;
  left: 0px;
  width: 0px;
  height: 0px;
}

alert {
  display: none;
}

/* group */
group {
  -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-base');
}

/* output widgets */
html|*:root output {
  -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-output');
}

html|*:root output[mozType|type="http://www.w3.org/2001/XMLSchema#date"][appearance="full"] {
  -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-output-date-full');
}
html|*:root output[mozType|type="http://www.w3.org/2001/XMLSchema#date"][appearance="full"]
    html|span[mozType|calendar] {
  -moz-binding: url('chrome://xforms/content/widgets-xhtml.xml#calendar-full');
}

xul|*:root output {
  -moz-binding: url('chrome://xforms/content/xforms-xul.xml#xformswidget-output');
}

/* range widgets */
range {
  -moz-binding: url('chrome://xforms/content/range.xml#xformswidget-range');
}

/* input widgets */
html|*:root input {
  -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input');
}

xul|*:root input {
  -moz-binding: url('chrome://xforms/content/input-xul.xml#xformswidget-input');
}

html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#boolean"] {
  -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-boolean');
}

xul|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#boolean"] {
  -moz-binding: url('chrome://xforms/content/input-xul.xml#xformswidget-input-boolean');
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] {
  -moz-binding: url('chrome://xforms/content/input.xml#xformswidget-input-date');
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"][appearance="full"] {
  -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-date-full');
}
input[mozType|type="http://www.w3.org/2001/XMLSchema#date"][appearance="full"]
    html|span[mozType|calendar] {
  -moz-binding: url('chrome://xforms/content/widgets-xhtml.xml#calendar-full');
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|input[anonid="dropmarker"] {
  min-width:27px;
  min-height: 1.3em;
  background-image: url(chrome://xforms/content/calendar.png) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|div[anonid="picker"],
html|span[mozType|calendar] html|table {
  border: 1px outset black !important;
  background-color: -moz-Field;
  font: -moz-list;
  text-align: start;
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td,
html|span[mozType|calendar] html|td {
  border: 1px solid transparent;
  text-align: center;
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.prevMonth,
input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.nextMonth,
html|span[mozType|calendar] html|td.prevMonth,
html|span[mozType|calendar] html|td.nextMonth {
  color: GrayText;
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.prevMonth:hover,
input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.nextMonth:hover,
html|span[mozType|calendar] html|td.prevMonth:hover,
html|span[mozType|calendar] html|td.nextMonth:hover {
  background-color: grey;
  cursor: pointer;
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.currentMonth,
html|span[mozType|calendar] html|td.currentMonth {
  color: black;
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|td.currentMonth:hover,
html|span[mozType|calendar] html|td.currentMonth:hover{
  color: HighlightText;
  background-color: Highlight;
  cursor: pointer;
}

input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|div[anonid="picker"] html|td[tabindex="0"],
html|span[mozType|calendar] html|td[selected] {
  border: 1px solid black;
}

html|input.-moz-date-back-button {
  width: 20px;
  background-image: url("chrome://global/skin/arrow/arrow-lft.gif") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

html|input.-moz-date-fwd-button {
  width: 20px;
  background-image: url("chrome://global/skin/arrow/arrow-rit.gif") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#gMonth"] {
  -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-month');
}

html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#gDay"] {
  -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-day');
}

html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#gYear"] {
  -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-year');
}

/* secret widgets */
html|*:root secret {
  -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-secret');
}

xul|*:root secret {
  -moz-binding: url('chrome://xforms/content/input-xul.xml#xformswidget-secret');
}

/* textarea widgets */
html|*:root textarea {
  -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-textarea');
}

xul|*:root textarea {
  -moz-binding: url('chrome://xforms/content/input-xul.xml#xformswidget-textarea');
}

/* trigger and submit widgets */
html|*:root trigger, html|*:root submit {
  -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-trigger');
}

xul|*:root trigger, xul|*:root submit {
  -moz-binding: url('chrome://xforms/content/xforms-xul.xml#xformswidget-trigger');
}

html|*:root trigger[appearance="minimal"], html|*:root submit[appearance="minimal"] {
  -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-trigger-minimal');
}

xul|*:root trigger[appearance="minimal"], xul|*:root submit[appearance="minimal"] {
  -moz-binding: url('chrome://xforms/content/xforms-xul.xml#xformswidget-trigger-minimal');
}

trigger[appearance="minimal"]:hover, submit[appearance="minimal"]:hover {
  cursor: pointer;
}

/* Most of the trigger[appearance="minimal"] specific CSS is copied from toolbarbutton.css */
xul|*:root trigger[appearance="minimal"] {
  -moz-appearance: toolbarbutton;
  -moz-box-align: center;
  -moz-box-pack: center;
  margin: 0;
  border: 1px solid transparent;
  padding: 3px;
  background-color: transparent;
  color: -moz-DialogText;
  cursor: default;
}
xul|*:root trigger[appearance="minimal"]:focus {
  -moz-appearance: toolbarbutton;
  outline: 1px dotted -moz-DialogText;
  -moz-outline-offset: -2px;
}
xul|*:root trigger[appearance="minimal"]:hover {
  border-color: ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight;
}
xul|*:root trigger[appearance="minimal"]:hover:active {
  border-color: ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow;
  padding-top: 4px;
  padding-bottom: 2px;
  -moz-padding-start: 4px;
  -moz-padding-end: 2px;
}
xul|*:root trigger[appearance="minimal"][disabled],
xul|*:root trigger[appearance="minimal"][disabled]:hover,
xul|*:root trigger[appearance="minimal"][disabled]:hover:active {
  border-color: transparent;
  padding: 3px;
  color: GrayText !important;
}

/* label widgets */
html|*:root input[accesskey] > label,
html|*:root secret[accesskey] > label,
html|*:root textarea[accesskey] > label,
html|*:root trigger[accesskey] > label,
html|*:root submit[accesskey] > label,
html|*:root select[accesskey] > label,
html|*:root select1[accesskey] > label,
html|*:root upload[accesskey] > label {
  -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-label-accesskey');
}

html|*:root label {
  -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-label');
}

xul|*:root label {
  -moz-binding: url('chrome://xforms/content/xforms-xul.xml#xformswidget-label');
}
xul|*:root input label, xul|*:root secret label, xul|*:root textarea label,
xul|*:root select > label, xul|*:root select1 > label {
  padding-top: 4px;
}

/* case widgets */
case {
  -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-case');
}

case > html|div.-moz-xforms-case-container {
  display: inherit;
}

/* select, select1 widgets */

  /* itemset widget */
select1 itemset, select itemset {
  -moz-binding: url('chrome://xforms/content/select1.xml#xformswidget-itemset');
}

  /* select1 appearance='minimal' (default) */
html|*:root select1 {
  -moz-binding: url('chrome://xforms/content/select1.xml#xformswidget-select1');
}
html|*:root select1 item {
  -moz-binding: url('chrome://xforms/content/select1.xml#xformswidget-select1-item');
  white-space : nowrap;
}

xul|*:root select1 {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select-minimal');
}
xul|*:root select1 xul|box {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select1-minimal');
}

  /* select1 appearance='compact' */
xul|*:root select1[appearance="compact"] {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select-compact');
}
xul|*:root select1[appearance="compact"] xul|box{
  -moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select1-compact');
}

  /* select1 appearance='full' */
xul|*:root select1[appearance="full"] {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select-full');
}
xul|*:root select1[appearance="full"] xul|box {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select1-full');
}

/* select1[appearance='minimal'] for xhtml styles (most of the select1 specific
CSS is copied from forms.css) */

html|*:root html|input.-moz-xforms-date-dropdown,
html|*:root html|input.-moz-xforms-select1-dropdown {
  width: 12px;
  height: 1.3em;
  white-space: nowrap;
  position: static !important;
  background-image: url("data:image/gif;base64,R0lGODlhBwAEAIAAAAAAAP%2F%2F%2FyH5BAEAAAEALAAAAAAHAAQAAAIIhA%2BBGWoNWSgAOw%3D%3D") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  -moz-appearance: menulist-button;
  -moz-user-select: none !important;
  -moz-user-focus: ignore !important;
  -moz-binding: none;
  vertical-align: text-top;
  margin: 0px !important;
  margin-top: -1px !important;
}

html|*:root html|input.-moz-xforms-select1-dropdown::-moz-focus-inner {
  border: 0 !important;
}

html|*:root html|input.-moz-xforms-select1-dropdown:active:hover {
  border-style: outset;
}

html|*:root html|input.-moz-xforms-select1-input {
  border: 1px dotted transparent;
  margin-right: 0px;
  padding: 0px;
  font: -moz-list;
  -moz-box-sizing: border-box;
  height: 1.3em;
  line-height: normal !important;
}

html|*:root html|input.-moz-xforms-select1-input:focus {
  border: 1px dotted black;
}

html|*:root html|span.-moz-date-container,
html|*:root html|span.-moz-select1-container {
  margin: 0px;
  margin-bottom: 1px;
  border-color: ThreeDFace;
  background-color: -moz-Field;
  color: -moz-FieldText;
  font: -moz-list;
  line-height: normal !important;
  white-space: nowrap !important;
  text-align: start;
  cursor: default;
  -moz-box-sizing: border-box;
  -moz-appearance: menulist;
  border-style: inset;
  text-indent: 0;
  padding-right: 0px;
  overflow: hidden;
  border-width: 2px;
  padding-bottom: 0px;
  padding-top: 1px;
}

html|*:root html|div.-moz-xforms-select1-popup {
  border-width: 1px;
  top: 0px;
  left: 0px;
  border: 1px outset black !important;
  background-color: -moz-Field;
  font: -moz-list;
  text-align: start;
  visibility: hidden;
  overflow-y: auto;
  overflow-x: hidden;
  position: absolute;
  -moz-user-select: none;
  z-index: 2147482647;
  cursor: default;
}

html|*:root item[_moz_active] {
  color: HighlightText;
  background: Highlight;
}

html|*:root select1[appearance='minimal'] choices > label {
  display: block;
  font: -moz-list;
  line-height: normal !important;
  font-style: italic;
  font-weight: bold;
  font-size: inherit;
  -moz-user-select: none;
  text-indent: 0;
}

html|*:root select1[appearance='minimal'] choices > item,
html|*:root select1[appearance='minimal'] choices > itemset,
html|*:root select1[appearance='minimal'] choices > choices {
  padding-left: 20px;
  font-style: normal;
  font-weight: normal;
}

  /* select appearance="compact" (default) */
html|*:root select {
  -moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select-compact');
}
html|*:root select html|span[anonid="control"] {
  -moz-binding: url('chrome://xforms/content/select-xhtml.xml#controlwidget-select-compact');
}

xul|*:root select {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select-compact');
}
xul|*:root select xul|box[anonid="control"] {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select-compact');
}

  /* select appearance="full" */
html|*:root select[appearance="full"] {
  -moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select-full');
}
html|*:root select[appearance="full"] html|span[anonid="control"] {
  -moz-binding: url('chrome://xforms/content/select-xhtml.xml#controlwidget-select-full');
}

xul|*:root select[appearance="full"] {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select-full');
}
xul|*:root select[appearance="full"] xul|box {
  -moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select-full');
}

  /* select, select1 styles*/
select *|*.select-choice-label, select1 *|*.select-choice-label {
  font: -moz-list;
  font-style: italic;
  font-weight: bold;
}

select *|*.select-choice-content, select1 *|*.select-choice-content {
  padding-left: 10px;
}

xul|*:root select1[appearance="full"] xul|box xul|radiogroup:focus xul|radio[selected] + label,
xul|*:root select[appearance="full"] xul|box xul|checkbox:focus + label {
  outline: 1px dotted invert;
}

xul|*:root select, xul|*:root select1 {
  display: -moz-box;
  margin: 2px 4px;
}

/* upload widgets */
html|*:root upload {
  -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-upload-disabled');
}

html|*:root upload[mozType|type="http://www.w3.org/2001/XMLSchema#anyURI"],
html|*:root upload[mozType|type="http://www.w3.org/2001/XMLSchema#base64Binary"],
html|*:root upload[mozType|type="http://www.w3.org/2001/XMLSchema#hexBinary"] {
  -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-upload');
}

/* default MIP styling */
*:disabled {
  display: none;
}
