/* ***** 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.org code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2001
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *  Brian Ryner <bryner@brianryner.com>
 *
 * 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/1999/xhtml); /* set default namespace to HTML */
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

select[size] {
  -moz-binding: url("chrome://forms/content/select.xml#select-size");
  -moz-box-orient: vertical;
  -moz-user-focus: normal;
  -moz-user-select: none;
}

select, select[size="1"] {
  -moz-binding: url("chrome://forms/content/select.xml#select");
  display: -moz-inline-box;
  -moz-box-orient: horizontal;
  -moz-user-focus: normal;
  font: -moz-list;
}

select[size] > option,
select[size] > optgroup {
  -moz-binding: none;
}

select option,
select[size="1"] option {
  -moz-binding: url("chrome://forms/content/select.xml#select-option");
}

select > optgroup,
select[size="1"] > optgroup {
  -moz-binding: url("chrome://forms/content/select.xml#select-optgroup");
  display: -moz-box;
  -moz-box-orient: horizontal;
  -moz-user-focus: normal;
}

xul|*.select-treecol {
  -moz-binding: none;
}

xul|*.select-treerows {
  -moz-binding: url("chrome://forms/content/select.xml#select-treerows");
}

xul|*.select-treebody {
  -moz-binding: url("chrome://forms/content/select.xml#select-treebody");
  display: -moz-box;
}

xul|*.select-scrollbar[disabled="true"] {
  visibility: hidden;
}

xul|*.select-menupopup,
xul|*.select-optgrouppopup {
  display:-moz-popup!important;
}

/* note: theme css MUST set the background color on 
   select-optgrouppopup.  we can't set it to inherit
   because it will inherit the highlight color if the
   optgroup is open. */

xul|*.select-menupopup {
  background-color: inherit !important; 
}

input[type="checkbox"],
input[type="radio"] {
  display: -moz-inline-box;
  margin: 3px 3px 3px 4px;

  /* override these values from the input rule */
  background-color: transparent;
  border: none;
  color: inherit;
  cursor: default;
  font: inherit;
  text-align: inherit;
  padding-top: 0px;
  padding-bottom: 0px;
  -moz-box-sizing: border-box;
}

input[type="checkbox"] {
  -moz-binding: url("chrome://forms/content/checkbox.xml#checkbox");
}

input[type="radio"] {
  -moz-binding: url("chrome://forms/content/radio.xml#radio");
}

button {
  -moz-binding: url("chrome://forms/content/button.xml#button");
  -moz-box-sizing: border-box;
}

input[type="button"],input[type="submit"],input[type="reset"] {
  cursor: default;
  -moz-box-sizing: border-box;
  padding-top: 0px;
  padding-bottom: 0px;
}

input[type="button"] {
  -moz-binding: url("chrome://forms/content/button.xml#inputButton");
}

input[type="submit"] {
  -moz-binding: url("chrome://forms/content/button.xml#submitButton");
}

input[type="reset"] {
  -moz-binding: url("chrome://forms/content/button.xml#resetButton");
}

input[type="file"] > input[type="button"] {
  -moz-binding: url("chrome://forms/content/button.xml#fileButton");
}

/*
 * The following rules are copied from forms.css, for widgets that aren't yet
 * defined in XBL.
 */
*|*::-moz-fieldset-content {
  display: block;
  height: inherit;   /* Need this so percentage heights of kids work right */
}

form {
  display: block;
  margin: 0 0 1em 0;
}

/* miscellaneous form elements */

legend {
  padding-left: 2px;
  padding-right: 2px;
  border: none;
}

fieldset {
  display: block;
  border: 2px solid black;
  padding: 4px 4px 4px 4px;
  margin-left: 2px;
  margin-right: 2px;
}

label {
  /* our <label> support is badly broken. 
     does not support display types other than inline(b=100801) 
   */
  display: inline !important;
}

/* default inputs, text inputs, and selects */
input {
  background-color: -moz-Field;
  border: 2px inset ThreeDFace;
  color: -moz-FieldText;
  cursor: text;
  font: -moz-field;
  text-align: start;
  vertical-align: text-bottom;
  -moz-box-sizing: border-box;
  -moz-user-focus: normal;
  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#inputFields");
  padding: 1px 0 1px 0;
}

input > .anonymous-div {
  white-space : nowrap;
}

textarea {
  background-color: -moz-Field;
  border: 2px inset ThreeDFace;
  color: -moz-FieldText;
  cursor: text;
  font: medium -moz-fixed;
  margin: 1px 0 1px 0;
  text-align: start;
  vertical-align: text-bottom;
  -moz-box-sizing: border-box;
  -moz-user-focus: normal;
  -moz-binding: url("chrome://global/content/platformHTMLBindings.xml#textAreas");
}

textarea > scrollbar {
  cursor: default;
}

textarea > .anonymous-div,
input > .anonymous-div {
  -moz-user-focus: none;
  overflow: auto;
  border: 0px !important;
  padding: 0px;
  margin: 0px;
  /* XXXldb I'm not sure if we really want the 'text-decoration: inherit',
     but it's needed to make 'text-decoration' "work" on text inputs. */
  text-decoration: inherit;
}

input:disabled,
textarea:disabled,
option:disabled,
optgroup:disabled,
select:disabled,
select:disabled::-moz-display-comboboxcontrol-frame {
  color: GrayText;
  cursor: inherit; 
}

/* hidden inputs */
input[type="hidden"] {
  display: none;
  -moz-binding: none;
}

/* image buttons */
input[type="image"] {
  border: none;
  vertical-align: baseline;
  background-color: transparent;
  cursor: pointer;
  font-family: sans-serif;
  font-size: small;
  -moz-binding: none;
  padding: 0;
}

input[type="image"]:disabled {
  cursor: inherit;
}

input[type="image"]:focus {
  outline: 1px dotted -moz-FieldText;
}

/* file selector */
input[type="file"] {
  white-space: nowrap;
  border: none;
  cursor: default;
  -moz-binding: none;
  padding: 0;
}

/* button part of file selector */
input[type="file"] > input[type="button"] {
  height: inherit;
}

input[type="file"] > input[type="button"]::-moz-focus-inner
 {
  padding: 0px 2px 0px 2px;
  border: 1px dotted transparent;
}

@media print {
  input, textarea, select, button {
    -moz-user-focus: none !important;
  }
}
