@import '../../shared/mixins',
        '../../shared/reset',
        '../../shared/about-dark';

/*
 * Copyright (c) 2013 Thibaut Courouble
 * http://www.cssflow.com
 *
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 */

body {
  font: 13px/20px 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: #404040;
  background: white;
}

.container {
  margin: 50px auto;
  width: 280px;
  text-align: center;

  > .switch {
    display: block;
    margin: 12px auto;
  }
}

$switchTransition: .15s ease-out;

.switch {
  position: relative;
  display: inline-block;
  vertical-align: top;
  width: 56px;
  height: 20px;
  padding: 3px;
  background-color: white;
  border-radius: 18px;
  box-shadow: inset 0 -1px white,
              inset 0 1px 1px rgba(black, .05);
  cursor: pointer;
  @include linear-gradient(top, #eee, white 25px);
}

.switch-input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

.switch-label {
  position: relative;
  display: block;
  height: inherit;
  font-size: 10px;
  text-transform: uppercase;
  background: #eceeef;
  border-radius: inherit;
  box-shadow: inset 0 1px 2px rgba(black, .12),
              inset 0 0 2px rgba(black, .15);
  @include transition($switchTransition);
  @include transition-property(opacity background);

  &:before, &:after {
    position: absolute;
    top: 50%;
    margin-top: -.5em;
    line-height: 1;
    @include transition(inherit);
  }

  &:before {
    content: attr(data-off);
    right: 11px;
    color: #aaa;
    text-shadow: 0 1px rgba(white, .5);
  }

  &:after {
    content: attr(data-on);
    left: 11px;
    color: white;
    text-shadow: 0 1px rgba(black, .2);
    opacity: 0;
  }

  .switch-input:checked ~ & {
    background: #47a8d8;
    box-shadow: inset 0 1px 2px rgba(black, .15),
                inset 0 0 3px rgba(black, .2);

    &:before { opacity: 0; }
    &:after { opacity: 1; }
  }
}

.switch-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 10px;
  box-shadow: 1px 1px 5px rgba(black, .2);
  @include linear-gradient(top, white 40%, #f0f0f0);
  @include transition(left #{$switchTransition});

  &:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -6px 0 0 -6px;
    width: 12px;
    height: 12px;
    background: #f9f9f9;
    border-radius: 6px;
    box-shadow: inset 0 1px rgba(black, .02);
    @include linear-gradient(top, #eee, white);
  }

  .switch-input:checked ~ & {
    left: 40px;
    box-shadow: -1px 1px 5px rgba(black, .2);
  }
}

.switch-green > .switch-input:checked ~ .switch-label { background: #4fb845; }
