@import "mixins.scss";

//
// Android theme
// Visuals and interactions in the style of Android
//
// --------------------------------------------------


// Variables
// --------------------------------------------------

// Type
$font-family-default: 'Roboto', sans-serif !global;
$font-size-default: 18px !global;
$font-weight: 500 !global;
$font-weight-light: 400 !global;
$line-height-default: 22px !global;

// Colors
//
// Main theme colors
$primary-color:  #33b5e5 !global;
$chrome-color:   #dddddd !global;
$text-color:     #222 !global;

// Action colors
$default-color:  #999 !global;
$positive-color: #99cc00 !global;
$negative-color: #ff4444 !global;

// Bars
$bar-base-height: 50px !global;
$bar-tab-height:  50px !global;

// Borders
$border-default: 1px solid #b1b1b1 !global;
$border-radius: 2px !global;


// Base
// --------------------------------------------------

body {
  font-family: $font-family-default;
  font-size: $font-size-default;
  line-height: $line-height-default;
  color: $text-color;
}

// Universal link styling
a {
  color: $primary-color;

  &:active {
    color: darken($primary-color, 10%);
  }
}

// Content
.content {
  background-color: #f2f2f2;
}
// Pad top/bottom of content so it doesn't hide behind .bar-title and .bar-tab.
// Note: For these to work, content must come after both bars in the markup
.bar-nav ~ .content {
  padding-top: $bar-base-height;
}
.bar-header-secondary ~ .content {
  padding-top: $bar-base-height*2;
}
.bar-tab ~ .content {
  padding-top: $bar-tab-height;
  padding-bottom: 0;
}
.bar-footer ~ .content {
  padding-bottom: $bar-base-height;
}
.bar-footer-secondary ~ .content {
  padding-bottom: ($bar-base-height*2);
}

// Buttons
// --------------------------------------------------

.btn {
  padding: 8px 15px;
  font-size: 14px;
  color: $text-color;
  background-color: #cecece;
  border: 0;
  border-radius: $border-radius;
  @include box-shadow(inset 0 -1px 0 rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 1px rgba(0,0,0,.25));

  // Active & filled button styles
  &:active,
  &.active {
    color: $text-color;
    background-color: $default-color;
    border: 0;
    @include box-shadow(inset 0 -1px 0 rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2));
  }
}


// Other button types
// --------------------------------------------------

// Primary button (Default color is blue)
.btn-primary {
  color: #fff;
  background-color: $primary-color;
  border: 0;

  &:active,
  &.active {
    color: #fff;
    border: 0;
    background-color: darken($primary-color, 10%);
  }
}

// Positive button (Default color is green)
.btn-positive {
  color: #fff;
  background-color: $positive-color;
  border: 0;

  &:active,
  &.active {
    color: #fff;
    background-color: darken($positive-color, 10%);
    border: 0;
  }
}

// Negative button (Default color is red)
.btn-negative {
  color: #fff;
  background-color: $negative-color;
  border: 0;

  &:active,
  &.active {
    color: #fff;
    background-color: darken($negative-color, 10%);
    border: 0;
  }
}

// Outlined buttons
.btn-outlined {
  background-color: transparent;
  border: 1px solid $default-color;
  @include box-shadow(none);


  &.btn-primary {
    color: $primary-color;
    border: 1px solid $primary-color;

    &:active {
      background-color: $primary-color;
      border: 1px solid $primary-color;
    }
  }
  &.btn-positive {
    color: $positive-color;
    border: 1px solid $positive-color;

    &:active {
      background-color: $positive-color;
      border: 1px solid $positive-color;
    }
  }
  &.btn-negative {
    color: $negative-color;
    border: 1px solid $negative-color;

    &:active {
      background-color: $negative-color;
      border: 1px solid $negative-color;
    }
  }
  // Active states
  &:active {
    background-color: $default-color;
    border: 1px solid $default-color;
    @include box-shadow(none);
  }
  &.btn-primary:active,
  &.btn-positive:active,
  &.btn-negative:active {
    color: #fff;
    @include box-shadow(none);
  }
}

// Link button (Buttons that look like links)
.btn-link {
  color: $primary-color;
  background-color: transparent;
  border: none;
  @include box-shadow(none);

  &:active,
  &.active {
    color: darken($primary-color, 10%);
    background-color: transparent;
    @include box-shadow(none);
  }
}

// Block buttons
.btn-block {
  padding: 15px 0;
  font-size: 18px;
}

// Buttons with badges
.btn {
  .badge {
    background-color: rgba(0,0,0,.15);

    &.badge-inverted {
      background-color: transparent;
    }
  }

  // Active states
  &:active .badge {
    color: #fff;
  }
}


// Bars
// --------------------------------------------------

.bar {
  height: $bar-base-height;
  background-color: $chrome-color;
  border-bottom: $border-default;
  @include box-shadow(inset 0 -2px 0 #d2d2d2, 0 3px 3px rgba(0,0,0,.07));

  // Modifier class to dock any bar below .bar-nav
  &.bar-header-secondary {
    top: $bar-base-height;
  }

  // Modifier class to dock any bar above a standard bar
  &.bar-footer-secondary {
    bottom: $bar-base-height;
  }

  // Modifier class to dock any bar above a .bar-tab
  &.bar-footer-secondary-tab {
    bottom: $bar-tab-height;
  }

  // Give the footers the correct border
  .bar-footer,
  .bar-footer-secondary,
  .bar-footer-secondary-tab {
    border-top: $border-default;
    border-bottom: 0;
    @include box-shadow(inset 0 -2px 0 $primary-color);
  }
}
.bar-tab {
  top: 0;
  bottom: auto;
  height: $bar-tab-height;
  border-top: 0;

  .tab-item {
    color: #929292;

    // Active states for the tab bar
    &.active {
      color: $primary-color;
      @include box-shadow(inset 0 -2px 0 $primary-color);
    }
    //Pressed state
    &:active {
      color: #929292;
      background-color: #78c6e3;
    }
    .icon {
      top: 3px;
      padding-top: 0;
      padding-bottom: 0;
    }
  }
}

// Left aligned text in the .bar-nav
.title {
  position: static;
  padding-left: 15px;
  font-size: $font-size-default;
  line-height: 49px;
  text-align: left;
}

// Bars with buttons
.bar {
  .btn {
    top: 7px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .btn-link {
    top: 0;
    padding: 0;
    font-size: $font-size-default;
    line-height: 49px;
    color: $primary-color;

    &:active,
    &.active {
      color: darken($primary-color, 10%);
    }

    // Make sure link buttons w/ icons line up with the content correctly
    .icon {
      top: 2px;
      padding: 0;
    }
  }
  .btn-block {
    top: 4px;
  }
}

// Bars with segmented-controls
//
// Remove standard segmented bottom margin
.bar .segmented-control {
  top: 7px;
}

// Bars with Ratchicons
.bar {
  .icon {
    padding-top: 13px;
    padding-bottom: 13px;
  }
  // Handle carets in the titles
  .title .icon {
    padding: 0;

    &.icon-caret {
      top: 10px;
      color: #777;
    }
  }
}

// Standard bars with search forms
//
// Position/size search bar within the bar
.bar input[type="search"] {
  height: 35px;
}


// Badges
// --------------------------------------------------

.badge {
  &.badge-inverted {
    color: $default-color;
    background-color: transparent;
  }
}

// Badge modifiers
//
// Main badge
.badge-primary {
  color: #fff;
  background-color: $primary-color;

  &.badge-inverted {
    color: $primary-color;
    background-color: transparent;
  }
}

// Positive badge
.badge-positive {
  color: #fff;
  background-color: $positive-color;

  &.badge-inverted {
    color: $positive-color;
    background-color: transparent;
  }
}

// Negative badge
.badge-negative {
  color: #fff;
  background-color: $negative-color;

  &.badge-inverted {
    color: $negative-color;
    background-color: transparent;
  }
}


// Cards
// --------------------------------------------------

.card {
  background-color: transparent;
  border-color: #d9d9d9;
  border-radius: $border-radius;
}


// Table views
// --------------------------------------------------

.table-view {
  background-color: transparent;

  .table-view-cell {
    border-bottom: 1px solid #d9d9d9;

    // Remove the border from the last table view item
    &:last-child {
      background-image: none;
    }
    > a:not(.btn):active {
      color: inherit;
      background-color: #e0e0e0;

      .icon {
        color: #fff;
      }
    }
  }

  // Table view dividers
  .table-view-divider {
    padding-top: 25px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    background-color: transparent;
    border-top: 0;
    border-bottom: 2px solid #a9a9a9;
  }
}

// Table-views with buttons, badges and toggles
// --------------------------------------------------
.table-view-cell,
.table-view-cell > a {
  // Android has no cheverons so don't bump the buttons, badges, or toggles over.
  .navigate-left,
  .navigate-right,
  .push-left,
  .push-right {
    > .btn,
    > .badge,
    > .toggle {
      right: 15px;
    }
  }
}

// Forms
// --------------------------------------------------

select,
textarea,
input[type="text"],
input[type="search"],
input[type="password"],
input[type="datetime"],
input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="week"],
input[type="number"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="color"],
.input-group {
  height: 40px;
  padding: 10px 15px;
  border: 1px solid rgba(0, 0, 0, .2);
  @include box-shadow(0 1px 1px rgba(0,0,0,.1));
}

input[type="search"] {
  border-radius: $border-radius;
}

select,
textarea,
.input-group {
  height: auto;
}

// Input groups (cluster multiple inputs together into a single group)
// -------------------------------------------------------------------
.input-group {
  padding: 0;
  border: 0;
}
.input-group input {
  border: 0;
  border-bottom: 1px solid #d9d9d9;
  @include box-shadow(none);
}
// Remove bottom border on last input to avoid double bottom border
.input-group input:last-child {
  background-image: none;
}

// Input groups with labels
// --------------------------------------------------

// To use labels with input groups, wrap a label and an input in an .input-row
.input-row {
  height: 40px; // Matches the height of inputs.
  border-bottom: 1px solid #d9d9d9;
}
.input-row label {
  padding-top: 10px;
  padding-bottom: 10px;
}
// Remove bottom border on last input-row to avoid double bottom border
.input-row label + input {
  background-image: none;
  border-bottom: 0;
}


// Segmented controllers
// --------------------------------------------------

.segmented-control {
  font-size: 14px;
  background-color: #cecece;
  border: 0;
  border-radius: $border-radius;
  @include box-shadow(0 1px 1px rgba(0,0,0,.25));

  .control-item {
    padding-top: 10px;
    padding-bottom: 10px;
    color: $text-color;
    border-left: 1px solid #999;
    @include box-shadow(inset 0 -1px 0 rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2));

    // Remove border-left and shadow from first section
    &:first-child {
      border-left-width: 0;
    }

    &:active,
    &.active {
      background-color: $default-color;
    }
  }
}


// Other segmented controller types
// --------------------------------------------------

// Primary
.segmented-control-primary {
  border: 0;

  .control-item {
    color: #fff;
    border-color: inherit;

    &:active,
    &.active {
      color: #fff;
      background-color: $primary-color;
    }
  }
}

// Positive
.segmented-control-positive {
  border: 0;

  .control-item {
    color: #fff;
    border-color: inherit;

    &:active,
    &.active {
      color: #fff;
      background-color: $positive-color;
    }
  }
}

// Negative
.segmented-control-negative {
  border: 0;

  .control-item {
    color: #fff;
    border-color: inherit;

    &:active,
    &.active {
      color: #fff;
      background-color: $negative-color;
    }
  }
}


// Popovers
// --------------------------------------------------

.popover {
  top: 47px;
  left: 15px;
  width: 200px;
  margin-left: 0;
  border: 1px solid #9b9b9b;
  border-radius: 0;
  -webkit-transition: -webkit-transform .1s ease-in-out, opacity .2s ease-in-out;
     -moz-transition: -moz-transform .1s ease-in-out, opacity .2s ease-in-out;
          transition: transform .1s ease-in-out, opacity .2s ease-in-out;
  @include box-shadow(0 0 3px rgba(0,0,0,.2));
  @include transform(scale(.75));

  &:before {
    display: none;
  }
  &.visible {
    @include transform(scale(1));
  }
}

// Remove the popover's backdrop
.backdrop {
  background-color: transparent;
}

// Popovers with bars
.popover {
  .bar {
    border-radius: 0;
  }

  // Padding the content correctly.
  .bar-nav ~ .table-view {
    padding-top: $bar-base-height;
  }
}

// Popovers with table-views
.popover .table-view {
  border-radius: 12px;
}


// Toggles styles
// --------------------------------------------------

.toggle {
  width: 104px;
  height: 28px;
  background-color: #d7d7d7;
  border: 2px solid #d7d7d7;
  border-radius: 0;

  // Sliding handle
  .toggle-handle {
    top: 0;
    left: 0;
    width: 50px;
    height: 24px;
    background-color: #bebebe;
    border: 1px solid #b5b5b5;
    border-radius: 2px;
    @include box-shadow(inset 0 1px 0 rgba(255,255,255,.3), inset 0 -1px 0 rgba(0,0,0,.1));
  }
  &:before {
    top: 1px;
    right: auto;
    left: 11px;
    z-index: 3;
    color: #fff;
  }

  // Active state for toggle
  &.active {
    background-color: #d7d7d7;
    border: 2px solid #d7d7d7;

    .toggle-handle {
      margin-right: 2px;
      background-color: $primary-color;
      border-color: $primary-color;
      @include transform(translate3d(50px,0,0));
    }
    &:before {
      right: 14px;
      left: auto;
      color: #fff;
    }
  }
}


// Push icons
// --------------------------------------------------

// Deprecated `push-left` and `push-right` as of 2.0.1
.navigate-left:after,
.push-left:after {
  content: '';
}
.navigate-right:after,
.push-right:after {
  content: '';
}


// Ratchicons for Android
// --------------------------------------------------

.icon-caret:before         { content: '\e800'; }
.icon-down:before,
.icon-down-nav:before      { content: '\e801'; }
.icon-download:before      { content: '\e802'; }
.icon-left:before,
.icon-left-nav:before      { content: '\e803'; }
.icon-more-vertical:before { content: '\e804'; }
.icon-more:before          { content: '\e805'; }
.icon-right:before,
.icon-right-nav:before     { content: '\e806'; }
.icon-search:before        { content: '\e807'; }
.icon-share:before         { content: '\e808'; }
.icon-up:before,
.icon-up-nav:before        { content: '\e809'; }
