/*
    JSPWiki - a JSP-based WikiWiki clone.

    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); fyou may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
*/
/*
Forms:
    Including Labels, form-values and form-help.

    Also the general formatting of fieldset, legends is defined here.
*/
// Based on bootstrap/forms.less


.form-frame {
    border: 1px solid @legend-border-color;
    border-radius: @border-radius-base;
    padding: (@grid-gutter-width / 2) (@grid-gutter-width / 2) 0 ;
    margin-bottom: @line-height-computed;
}

// Additional classes -- simplified stuff, borrowing from grid.less
.form-col-small, .form-col-wide {
    //see bootstrap/mixins .make-grid()
    position: relative;
    // Prevent columns from collapsing when empty
    min-height: 1px;
    // Inner gutter via padding
    padding-left:  (@grid-gutter-width / 2);
    padding-right: (@grid-gutter-width / 2);

    float:left;

    &[type="file"] { padding:0; }
}
.form-col-20 { width: 20%; display:inline-block; }
.form-col-25 { width: 25%; display:inline-block; }
.form-col-50 { width: 50%; display:inline-block; }
.form-col-75 { width: 75%; display:inline-block; }
.form-col-80 { width: 80%; display:inline-block; }
.form-col-offset-20 { margin-left: 20%; }


// hacking some improved dropdown select style
.form-group select {

  -webkit-appearance: none;  //remove default safari and chrome style
  -moz-appearance: none;    //remove default firefox style

  background-color: @btn-default-bg;
  background-image:
	linear-gradient(120deg, @wikiTriangleColor @wikiTriangleSize, transparent @wikiTriangleSize),
    linear-gradient(-120deg, @wikiTriangleColor @wikiTriangleSize, transparent @wikiTriangleSize);

  background-size: @wikiTriangleSize*2;
  background-repeat: no-repeat;
  background-position:
	( @padding-base-horizontal + @wikiTriangleSize/2 ) @padding-base-vertical*2,
	( @padding-base-horizontal - @wikiTriangleSize*3/2 ) @padding-base-vertical*2;

  text-indent: 0.01px;   //remove default arrow from firefox
  text-overflow: '';   //remove default arrow from firefox

  //inherit styles from .btn
  cursor: pointer;
  border: 1px solid transparent;
  padding: @padding-base-vertical @padding-base-horizontal @padding-base-vertical @padding-base-horizontal*2;
  border-radius: @border-radius-base;

  //inherit styles from .btn-default
  color: @btn-default-color;
  border-color: @btn-default-border;

}
/* CHECKME IEfix ?? .from-group select::-ms-expand { display: none; } */


.form-control  { color: @btn-default-color; } //consistent text color with eg select controls etc.

//toggle switch
label.form-switch {
	height:auto;
	font-weight:normal;
}
label.form-switch > input[type=checkbox],
input[type=checkbox].form-switch {
    -moz-appearance: none;
    -webkit-appearance: none;
    -o-appearance: none;
    position: relative;
    top:0.25em;
    height:1.25em;
    width:2.5em;
    margin:0;
    border-radius:0.6125em;
    box-shadow:inset -1.25em 0 0 1px @wikiFormSwitch-bg;
    background-color:@white;
    border:1px solid @wikiFormSwitch-border;
    cursor:pointer;
    user-select:none;
    transition:0.2s;

	&:hover {
	    box-shadow:inset -1.25em 0 0 1px darken(@wikiFormSwitch-bg,10%);
	}
    &:checked {
	    box-shadow: inset 1.25em 0 0 1px @wikiFormSwitchOn-bg;
        border: 1px solid @wikiFormSwitchOn-border;
		&:hover {
		    box-shadow:inset 1.25em 0 0 1px darken(@wikiFormSwitchOn-bg,10%);
		}
    }
    &:focus {
		outline:none;
		background:none !important;
	}
}


/* Wiki Form plugins*/
.page-content .wikiform {
    input[type=text], textarea{
        .form-control;
        height:auto;
    }
    input[type=submit]{
        .btn; .btn-default;
    }
    input[type=checkbox], input[type=radio]{
        margin:10px 1em 10px 0;
    }
}

/*User Preferences*/

//test support for var(--css-properties)
/*
:root {
	--someTestProp:red;
}
@supports not(--someTestProp: red ) {
	.form-group.pref-appearance {
		display:none;
	}
}

@supports ( not (--a: 0)) {
  // not supported
}
*/

//remove shadow from active radio-buttons; and define active color
.form-group .btn.active {
	box-shadow: none;
	.button-variant(@wikiRadioActive-color; @wikiRadioActive-bg; @wikiRadioActive-border);
}
