/*
|   =========================================================
|   InvoicePlane Core Styles
|   https://invoiceplane.com
|   =========================================================
|   The following styles are needed to display InvoicePlane
|   properly. Only edit them if you know what you are doing!
|   =========================================================
*/

/*
|   =========================================================
|   Base Styles
|   =========================================================
*/

html {
  min-height: 100vh;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  vertical-align: middle;
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
}

/*
|   =========================================================
|   Forms
|   =========================================================
*/

form {
  margin: 0;
}

fieldset {
  border-radius: $border-radius-base;
  border: 1px solid #ddd;
  margin-bottom: 15px;
  padding: 15px;
}

fieldset legend {
  padding: 0 15px;
  font-size: $font-size-large;
  width: auto;
  border: none;
  margin: 0;
}

label {
  font-weight: normal;
}

textarea {
  resize: vertical;
}

.discount-field {
  float: right;
  max-width: 40%;
  margin-left: 10px;

  .input-sm {
    height: auto;
    padding: 3px 5px;
  }

  .input-group-addon {
    min-width: 20px;
  }
}

.optional {
  float: right;
  font-size: small;
  color: $color_grey;
}

/*
|   =========================================================
|   Tables
|   =========================================================
*/

.table {
  margin: 0 0 15px;
  font-size: $font-size-base - 1;

  &.no-margin {
    margin: 0 0 0 0;
  }

  td {
    vertical-align: middle !important;
  }

  tr.bold-border td {
    border-bottom-width: 2px;
  }

  &.items td {
    min-width: 150px;
    max-width: 300px;
    vertical-align: top !important;

    &.td-icon {
      max-width: 30px;
      min-width: unset;
    }

    &.td-amount {
      max-width: 200px;
      text-align: right;

      .form-control {
        text-align: right;
      }
    }

    &.td-textarea {
      min-width: 300px;
      max-width: 400px;
    }

    &.td-quantity {
      max-width: 200px;
    }

    &.td-vert-middle {
      vertical-align: middle !important;
    }
  }

  .input-group {
    width: 100%;
    height: 100%;
  }

  .input-group-addon {
    font-size: 12px;
    padding: 4px 8px;
  }
}

.table-responsive {
  margin-bottom: 0;
}

#item_table {
  td, th {
    padding: 3px;
  }

  .form-control {
    margin: 0;
  }

  tr.item {
    input, textarea {
      border-color: #e5e5e5;
      border-radius: 0;
      box-shadow: none;
    }
  }
}

/*
|   =========================================================
|   Navigation
|   =========================================================
*/

.navbar {
  .navbar-collapse {
    padding-left: 0;
    padding-right: 0;
  }

  .navbar-toggle {
    padding: 6px 8px;
    color: $navbar-inverse-link-color;
    border-color: $navbar-inverse-border;

    &:hover {
      color: $navbar-inverse-link-hover-color;
      border-color: $navbar-inverse-link-hover-bg;
    }
  }

  .navbar-form {
    margin-left: 0;
    margin-right: 0;
  }

  .navbar-nav .fa {
    font-size: $font-size-base + 1;
    line-height: $line-height-computed;
  }
}

.navbar-inner {
  border-radius: 0;
  padding: 0;
  border: none;
  text-align: right;
}

.navbar-search {
  margin-top: 0;
}

// Options Dropdown
.options {
  margin: 0;

  .dropdown-menu {
    right: 0;
    left: auto;
  }
}

// General dropdown style
.dropdown-button {
  // Same style as a normal link item
  display: block;
  padding: 3px 20px;
  width: 100%;
  clear: both;
  font-weight: normal;
  line-height: $line-height-base;
  color: $dropdown-link-color;
  text-align: left;
  background: transparent;
  border: 0;
  white-space: nowrap; // prevent links from randomly breaking onto new lines

  &:hover,
  &:focus {
    text-decoration: none;
    color: $dropdown-link-hover-color;
    background-color: $dropdown-link-hover-bg;
  }

  .active > & {
    &,
    &:hover,
    &:focus {
      color: $dropdown-link-active-color;
      text-decoration: none;
      outline: 0;
      background-color: $dropdown-link-active-bg;
    }
  }

  .disabled > & {
    &,
    &:hover,
    &:focus {
      color: $dropdown-link-disabled-color;
    }

    // Nuke hover/focus effects
    &:hover,
    &:focus {
      text-decoration: none;
      background-color: transparent;
      background-image: none; // Remove CSS gradient
      @include reset-filter;
      cursor: $cursor-disabled;
    }
  }
}

#submenu {
  max-width: 100% !important;

  .submenu-row {
    padding: 5px;
  }

  .nav-pills {
    > li > a {
      padding: 4px 10px;
    }
  }
}

/*
|   =========================================================
|   Sidebar
|   =========================================================
*/

.sidebar {
  display: table-cell;
  vertical-align: top;
  width: 66px;
  height: 100%;
  padding: 0;

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  li {
    a {
      padding: 14px;
      display: block;
      border-bottom: 1px solid #ddd;
      font-size: $font-size-large;
      color: $gray;
      text-align: center;

      &:hover {
        color: $brand-primary;
      }
    }
  }

}

/*
|   =========================================================
|   Main Layout
|   =========================================================
*/

#main-area {
  display: flex;
  max-width: 100%;
  flex-direction: row;
  padding: 0;
}

#main-content {
  width: 100%;
  border-left: 1px solid #ddd;

  @media screen and (min-width: $screen-md) {
    width: calc(100% - 66px);
  }
}

#content,
.tab-content {
  padding: 15px;
  align-content: flex-start;
  max-width: 100%;

  &.table-content {
    padding: 0;
  }

  .alert {
    margin-right: 0;
    margin-left: 0;
  }
}

// Content classes
.table-content {
  padding: 0;
}

.tab-rich-content {
  padding: 15px;
}

#headerbar {
  min-height: 47px;
  padding: 8px 15px;
  border-bottom: 1px solid #ddd;
  @include clearfix();

  .headerbar-item.pull-right {
    margin-left: 10px;
  }

  .headerbar-title {
    display: inline-block;
    font-size: $font-size-base;
    margin: $padding-small-vertical 0 $padding-small-vertical;
    line-height: $line-height-small;
  }
}

.hidden-sidebar {
  #main-area {
    display: block !important;
  }

  #main-content {
    width: 100%;
  }
}

#form-settings .tab-content,
div.table-content {
  .tab-pane {
    padding-bottom: 50px;
  }

  #filter_results,
  .table-responsive {
    min-height: 300px;
    overflow-x: inherit;
  }
}

.personal_logo {
  max-width: 100%;
  height: auto;
}

/*
|   =========================================================
|   Tabs
|   =========================================================
*/

.tabbable .table {
  margin-bottom: 15px;
}

/*
|   =========================================================
|   Invoices and Quotes
|   =========================================================
*/

// Invoices and Quotes Overview
.overview table {

  th, td {
    border: none;
  }

  th {
    text-transform: uppercase;
    font-weight: normal;
    font-size: 11px;
    padding-bottom: 0;
  }

  td {
    font-size: 1.1em;
    padding-left: 10px !important;
    font-weight: 500;
  }

}

/*
|   =========================================================
|   Client Profile
|   =========================================================
*/

.notes textarea {
  resize: both;
  width: 100%;
  max-width: 100%;
}

#actions {
  margin: 15px 0 0;

  /* Mimic table appearance */
  div.table {
    display: table;
  }

  div.table .file-row {
    display: table-row;
  }

  div.table .file-row > div {
    display: table-cell;
    vertical-align: top;
    border-top: 1px solid #ddd;
    padding: 8px;
  }

  div.table .file-row:nth-child(odd) {
    background: $table-bg-hover;
  }

  /* The total progress gets shown by event listeners */
  #total-progress {
    opacity: 0;
    transition: opacity 0.3s linear;
  }

  /* Hide the progress bar when finished */
  #previews .file-row.dz-success .progress {
    opacity: 0;
    transition: opacity 0.3s linear;
  }

  /* Hide the delete button initially */
  #previews .file-row .delete {
    display: none;
  }

  #previews img {
    width: 80px;
    height: 80px;
  }
  /* Hide the start and cancel buttons and show the delete button */

  #previews .file-row.dz-success .start,
  #previews .file-row.dz-success .cancel {
    display: none;
  }

  #previews .file-row.dz-success .delete {
    display: block;
  }
}

/*
|   =========================================================
|   Invoice and Quotes Global Styles
|   =========================================================
*/

// Invoices and Quotes Status Colors
.draft {
  color: $color_status_draft;
}

.sent {
  color: $color_status_sent;
}

.viewed {
  color: $color_status_viewed;
}

.paid,
.approved {
  color: $color_status_paid_approved;
}

.rejected,
.overdue {
  color: $color_status_rejected_overdue;
}

.canceled {
  color: $color_status_canceled;
}

// Invoices and Quotes Status
.label {
  font-weight: normal;
  padding: $padding-base-vertical $padding-base-horizontal;
  color: white !important; // override status text color on labels
  display: block;
  width: 100%;

  &.label-inline {
    display: inline;
    width: auto;
  }

  &.draft {
    background-color: lighten($color_status_draft, 10%);
  }

  &.sent {
    background-color: lighten($color_status_sent, 10%);
  }

  &.viewed {
    background-color: lighten($color_status_viewed, 10%);
  }

  &.paid,
  &.approved {
    background-color: lighten($color_status_paid_approved, 10%);
  }

  &.rejected,
  &.overdue {
    background-color: lighten($color_status_rejected_overdue, 10%);
  }

  &.canceled {
    background-color: lighten($color_status_canceled, 10%);
  }
}

/*
|   =========================================================
|   Quotes
|   =========================================================
*/

.quote .cf {
  margin-bottom: 30px;

  .quote-properties {
    margin-bottom: 5px;

    label {
      margin: 0;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }
}

/*
|   =========================================================
|   Invoices
|   =========================================================
*/

.invoice {
  .total td:first-child,
  .total:hover td:first-child {
    background: none !important;
  }

  .total td:last-child {
    border-left: none;
  }

  .subtotal, .tax, .total,
  th.align-right, td.align-right {
    text-align: right;
  }

  .tax {
    background: none;
  }

  .invoice-properties {
    margin-bottom: 5px;

    label {
      margin: 0;
    }

    &:last-child {
      margin-bottom: 0;
    }
  }
}

.invoice-labels {
  span.label {
    float: left;
    width: auto;
    margin: 6px 3px 4px 0;

    &:last-child {
      margin-right: 0;
    }
  }
}

/*
|   =========================================================
|   Dashboard
|   =========================================================
*/

#panel-overdue-invoices,
#panel-recent-quotes,
#panel-recent-invoices {
  .panel-body {
    padding: 0;
  }

  table {
    td:first-child,
    th:first-child {
      padding-left: 10px;
    }
  }
}

#panel-overdue-invoices p {
  margin: 15px;
}

.quick-actions .btn {
  border: none;
  border-right: 1px solid #ddd;

  &:last-child {
    border-right: none;
  }
}

/*
|   =========================================================
|   Various Styles
|   =========================================================
*/

.alert {
  margin-left: 15px;
  margin-right: 15px;
}

.alert.alert-default {
  background: lighten($gray-lighter, 5%);
  border: 1px solid $gray-lighter;
}

.fa {
  min-width: 15px;
  text-align: center;
}

.fa.fa-margin {
  margin-right: 7px;
}

.fa-credit-invoice {
  &:before {
    content: '-';
  }

  &:after {
    font-family: FontAwesome;
    content: '\f155';
  }
}

.fa-read-only {
  @extend .fa-ban;
}

.cursor-pointer {
  cursor: pointer;
}

.cursor-move {
  cursor: move;
}

.amount {
  text-align: right;
}

.no-border-radius {
  border-radius: 0;
}

.no-margin {
  margin: 0 !important;
}

.no-padding {
  padding: 0 !important;
}

.modal {
  margin: 30px auto;
  overflow-y: auto;
}

.details-box {
  @extend .panel;
  @extend .panel-default;
  @extend .panel-body;
  padding: 10px;

  label {
    margin: 3px 0;
  }
}

#email_template_pdf_template > option {
  display: none;
}

#settings-tabs {
  text-align: center;

  > li {
    float: none;
    display: inline-block;
  }
}

#ipnews-results {
  margin-top: 15px;

  .alert {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

// Fullpage loader
#fullpage-loader {
  z-index: 99999;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .65);
  color: #fff;

  .loader-content {
    position: absolute;
    top: 20%;
    left: 0;
    font-size: 200px;
    width: 100%;
    text-align: center;

    #loader-error {
      font-size: $font-size-large;
      margin-bottom: 1rem;
    }
  }

  .fullpage-loader-close {
    font-size: $font-size-large;
    margin: 2rem 2rem 0 0;
  }
}

.model-pager {
  .btn .fa {
    font-size: $font-size-small;
    line-height: $font-size-small * $line-height-small;
  }
}

.index-options {
  margin-bottom: 0;
}

.padded {
  padding: 15px 0;
}

legend, .install-step h2 {
  border-image: none;
  border-style: none none solid;
  border-width: 0 0 1px;
  color: $gray;
  display: block;
  font-size: $font-size-large;
  line-height: 40px;
  margin-bottom: 15px;
  padding: 0;
  width: 100%;
}

.login-logo {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 15px;
}

.font-overdue {
  color: $brand-danger;
  font-weight: bold;
}

.nav-tabs-noborder > li > a {
  border-top-right-radius: 0;
  border-top-left-radius: 0;
  border-top: 0 !important;
}

.html-tags {
  .html-tag {
    border-bottom: none;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    min-height: 30px;
    vertical-align: middle;
  }
}

#email_template_body {
  border-top-left-radius: 0;
}

#email-template-preview {
  width: 100%;
  border: 0;
}

.webpreview-header {
  h2 {
    display: inline-block;
    vertical-align: baseline;
  }

  .btn-group {
    display: inline-block;
    vertical-align: baseline;
    float: right;
  }
}

.invoice-items {
  position: relative;
}

.paid-stamp, .overdue-stamp {
  position: absolute;
  bottom: 0;
  left: -20px;
  transform: rotate(22deg);
}

.passwordmeter-input {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 0;
  padding-bottom: $padding-base-vertical + 3px;

  + .progress {
    height: 3px;
    margin: -3px 0 0;
  }
}

/*
|   =========================================================
|   Login
|   =========================================================
*/

#login {
  @extend .panel;
  @extend .panel-default;
  @extend .panel-body;

  .form-horizontal {
    margin-bottom: 15px;
  }

  .form-group {
    margin-bottom: 15px;
  }

  h1 {
    margin: 0 0 15px;
  }

  .alert {
    margin-bottom: 15px;
  }
}

/*
|   =========================================================
|   Error Pages
|   =========================================================
*/

body.error {

  #ip-logo {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 400px;
    height: 200px;
  }

  div.error-container {
    display: block;
    width: 80%;
    height: auto;
    margin-top: 5em;
    margin-left: auto;
    margin-right: auto;
    text-align: center;

    h1 {
      margin-bottom: 1em;
    }
  }
}

/*
|   =========================================================
|   Responsive Media Queries
|   =========================================================
*/

// Styles for large devices (> lg)
@media (min-width: $screen-lg) {

  .navbar-nav .visible-lg {
    display: inline-block !important;
  }

  #submenu {
    .submenu-row {
      float: left;
      margin-right: 10px;
    }
  }

}

// Styles for medium devices (sm > md)
@media (max-width: $screen-md-max) {

  #submenu {
    .submenu-row {
      float: left;
      margin-right: 10px;
    }
  }

}

// Styles for  small devices (xs > sm)
@media (max-width: $screen-sm-max) {

  .sidebar li a {
    padding: 7px;
  }

  #content {
    padding: 15px;
  }

  .navbar-nav {
    margin: 7px 0;
  }

  .text-left-xs {
    text-align: left;
  }

  #submenu .navbar-collapse {
    margin-top: 7px;
  }

  // put icons on same line as text
  .navbar-nav {
    .visible-xs {
      display: inline-block !important;
    }
  }

}

// Styles for very small devices (< xs)
@media (max-width: $screen-xs-max) {

  .navbar-nav {
    margin: 7px 0;

    .dropdown .dropdown-menu {
      background: $navbar-inverse-border;
    }
  }

  #content {
    padding: 10px;

    .row {
      margin-left: -10px;
      margin-right: -10px;
    }
  }

  .headerbar {
    padding: 8px !important;
  }

  .pull-right {
    margin-left: 5px !important;
  }

  #fullpage-loader .loader-content {
    font-size: 150px;
    top: 10%;
    left: 0;
    margin-top: 0;
    margin-left: 0;
  }
}
