/* ----------------------------------
* Input areas
* ---------------------------------- */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="url"],
input[type="number"],
textarea {
  -moz-box-sizing: border-box;
  display: block;
  overflow: hidden;
  width: 100%;
  height: 4rem;
  resize: none;
  padding: 0 1.2rem;
  font-size: 1.8rem;
  line-height: 4rem;
  border: 0.1rem solid #ccc;
  border-radius: 0.3rem;
  box-shadow: none; /* override the box-shadow from the system (performance issue) */
  background: #fff url(input_areas/images/ui/shadow.png) repeat-x;
}

textarea {
  height: 10rem;
  max-height: 10rem;
  line-height: 2rem;
  margin: 0;
}

/* fix for required inputs with wrong or empty value e.g. [type=email] */
input:invalid,
textarea:invalid {
  border: 0.1rem solid #820000;
  color: #b90000;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
  color: #858585;
  opacity: 1;
}

input:-moz-placeholder,
textarea:-moz-placeholder {
  color: #858585;
  opacity: 1;
}

form p {
  position: relative;
  margin: 0;
}

form p + p {
  margin-top: 1rem;
}

form p input + button[type="reset"],
form p textarea + button[type="reset"] {
  position: absolute;
  top: 50%;
  right: 0;
  width: 3rem;
  height: 4rem;
  padding: 0;
  border: none;
  font-size: 0;
  opacity: 0;
  pointer-events: none;
  background: transparent url(input_areas/images/icons/clear.png) no-repeat 50% 50% / 1.7rem auto;
}

form.skin-dark p input + button[type="reset"],
form.skin-dark p textarea + button[type="reset"] {
  background-image: url(input_areas/images/icons/clear-dark.png);
}

/* To avoid colission with BB butons */
li input + button[type="reset"]:after,
li textarea + button[type="reset"]:after {
  background: none;
}

form p input + button[type="reset"],
form p textarea + button[type="reset"] {
  top: 0;
  margin: 0;
}

textarea {
  padding: 1.2rem;
}

form p input:focus {
  padding-right: 3rem;
}

form p input:focus + button[type="reset"],
form p textarea:focus + button[type="reset"] {
  opacity: 1;
  pointer-events: all;
}

/* Fieldset */
fieldset {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border-radius: 0.3rem;
  border: 0.1rem solid rgba(0,0,0,.2);
  font-size: 1.8rem;
  line-height: 1em;
  background: #fff url(input_areas/images/ui/shadow.png) repeat-x left top;
}

fieldset  + fieldset {
  margin-top: 1.5rem;
}

fieldset legend {
  -moz-box-sizing: border-box;
  position: absolute;
  width: 9.5rem;
  height: 100%;
  padding: 0 0.5rem 0 1.5rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: #333;
  line-height: 4rem;
  text-transform: uppercase;
}

fieldset legend.action {
  background: url(input_areas/images/icons/arrow.png) no-repeat 100% 100% / 1.2rem;
}

fieldset legend:active {
  background-color: #008caa;
  text-shadow: 0.1rem 0.1rem 0 rgba(255,255,255,.3);
}

fieldset section input[type="text"],
fieldset section input[type="password"],
fieldset section input[type="email"],
fieldset section input[type="tel"],
fieldset section input[type="search"],
fieldset section input[type="number"],
fieldset section textarea {
  height: 4rem;
  border: none;
  border-radius: 0;
  background: none;
}

fieldset section {
  display: block;
  border-left: 0.1rem solid #ddd;
  border-radius: 0 0.3rem 0.3rem 0;
  overflow: hidden;
  margin-left: 9.5rem;
}

fieldset section p {
  margin: 0;
  border-bottom: 0.1rem solid #ddd;
}

fieldset section p:last-child {
  border-bottom: none;
}

/* Tidy (search/submit) */
form[role="search"] {
  position: relative;
  height: 3.7rem;
  background: #dbe3eb;
}

form[role="search"].skin-dark {
  background: url(input_areas/images/ui/background-dark.png) repeat;
  background-size: 2rem;
}

form[role="search"].bottom {
  background: #fff;
}

form[role="search"]:before {
  content: "";
  position: absolute;
  top: 1rem;
  left: 1rem;
  height: 1.6rem;
  width: 1.6rem;
  background: url(input_areas/images/icons/search.png) no-repeat;
  background-size: 1.6rem;
}

form[role="search"].bottom:before {
  display: none;
}

form[role="search"].skin-dark:before {
  background-image: url(input_areas/images/icons/search-dark.png);
}

form[role="search"]:after {
  content: "";
  position: absolute;
  top: 3.6rem;
  right: 0;
  left: 0;
  height: 0.4rem;
  background: url(input_areas/images/ui/shadow-search.png) repeat-x left top;
  border-top: 0.1rem solid #fff;
}

form[role="search"].bottom:after {
  content: "";
  position: absolute;
  top: -0.4rem;
  background: url(input_areas/images/ui/shadow-invert.png) repeat-x 0 100%;
  border-color: transparent;
}
form[role="search"].skin-dark:after {
  border-color: #2b3538;
}

section[role="region"] > header:first-child + form[role="search"]:after{
  background: none;
}

form[role="search"] p {
  padding: 0.4rem 1.2rem 0 3.2rem;
  overflow: hidden;
}

form[role="search"].bottom p {
  padding: 0.4rem 1.2rem 0 1.2rem;
}

form[role="search"] p input,
form[role="search"] p textarea {
  height: 3rem;
  border: none;
  background: none;
  font-size: 1.8rem;
  padding: 0.5rem 0;
}

form[role="search"] p input:focus {
  padding: 0 2rem 0 0;
}

form[role="search"] p input:invalid, 
form[role="search"] p textarea:invalid {
  border: none;
}

form[role="search"].skin-dark p input,
form[role="search"].skin-dark p textarea {
  color: #fff;
}

form[role="search"] button.icon {
  float: left;
  height: 3.7rem;
  width: 3rem;
  border: none;
  font-size: 0;
  background: url(input_areas/images/ui/separator.png) no-repeat 100% 50%,
              url(input_areas/images/ui/background.png) repeat-x 0 100%;
  background-size: auto 100%;
  border-radius: 0;
  margin: 0;
  padding: 0;
  margin: 0;
  position: relative;
}

form[role="search"] button.icon:before {
  content: "";
  position: absolute;
  width: 3rem;
  height: 3.7rem;
  background: transparent center no-repeat;
  top: 0;
  left: 0;
}

form[role="search"] p button[type="reset"] {
  right: 0;
}

form[role="search"] button[type="submit"] {
  float: right;
  min-width: 6rem;
  height: 3.7rem;
  padding: 0 1.5rem;
  border: none;
  color: #000;
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 3.2rem;
  background: url(input_areas/images/ui/separator.png) no-repeat 0 50%;
  background-size: auto 100%;
  border-radius: 0;
  width: auto;
  border-radius: 0;
  margin: 0;
}

form[role="search"].bottom button[type="submit"] {
  color: #333;
  background: url(input_areas/images/ui/separator.png) no-repeat 0 50%,
              url(input_areas/images/ui/active.png) repeat-x 0 100%;
}

form[role="search"].skin-dark button[type="submit"] {
  color: #fff;
  background-image: url(input_areas/images/ui/separator-dark.png);
}

form[role="search"] button[type="submit"] + p > textarea {
  height: 3rem;
  line-height: 2rem;
  font-size: 1.8rem;
}

form[role="search"] button[type="submit"] + p button {
  height: 3.7rem;
}

form[role="search"].full button[type="submit"] {
  display: none;
}

form[role="search"] button.icon:active,
form[role="search"] button[type="submit"]:active {
  background: #008caa;
  text-shadow: 0.1rem 0.1rem 0 rgba(255,255,255,.3);
}

form[role="search"] button[type="submit"][disabled] {
  color: #adadad;
  background: url(input_areas/images/ui/separator.png) no-repeat 0 50%,
              url(input_areas/images/ui/background.png) repeat-x 0 100%;
}

form p button[type="reset"]:focus,
form p button[type="reset"]::-moz-focus-inner {
  border: none;
  outline: none;
}

/******************************************************************************
 * Right-to-Left layout
 */

html[dir="rtl"] form p input:valid,
html[dir="rtl"] form p input:valid:focus {
  padding: 0 1.2rem 0 3rem;
}

html[dir="rtl"] form p input + button[type="reset"],
html[dir="rtl"] form p textarea + button[type="reset"] {
  right: auto;
  left: 0;
}

html[dir="rtl"] fieldset legend.action:after {
  margin: 0 0.5rem 0 0;
}

html[dir="rtl"] fieldset legend {
  padding: 0 1.5rem 0 0.5rem;
}

html[dir="rtl"] form[role="search"] p input {
  padding: 0;
}

html[dir="rtl"] form[role="search"] p input:focus {
  padding: 0 0 0 2rem;
}

html[dir="rtl"] form[role="search"] button[type="submit"] + p > button {
  left: 0;
}
