@import "grid";
@import "select";

$loading: #1f5a80;
$orange: #ff7400;
$green: #16a085;
$red: #c0392b;
$black: #27292d;
$gray: #555;
$blueButton: #2c3e50;
$silver: #bdc3c7;

.ds-payment {
    font-family: 'Helvetica', 'Verdana', sans-serif;
    font-weight: 400;

    * {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
           box-sizing: border-box;
    }

    .ds-payment-header {
        padding: 0% 0 3%;
        font-weight: 700;
        color: #FFF;
        margin-top: -90px;
        margin-bottom: 37px;

        .ds-payment-title {
            display: block;
            text-align: center;
            font-size: 18px;
            line-height: .4em;
            color: #FFF;
        }

        .ds-payment-subtitle {
            text-align: center;
            display: block;
            font-size: 14px;
            color: #FFF;
            line-height: 1.3em;

            b {
                color: $green;
            }
        }
    }

    .ds-payment-form {
        margin-top: 10px;

        input[type="text"],
        input[type="number"],
        input[type="date"] {
            color: $gray;
            margin: 0 0 10px 0;
            display: block;
            width: 100%;
            border: 1px solid #f1f1f1;
            background-color: #f1f1f1;
            cursor: text;
            overflow: hidden;
            position: relative;
            height: 45px;
            font-size: 14px;
            padding: 10px;
            outline: none;
            text-transform: uppercase;
        }

        .error {
            input[type="text"],
            input[type="number"],
            input[type="date"] {
                border-color: $red;
                color: $red;
            }

            .Select {
                .Select-control {
                    border-color: $red;
                    color: $red;
                }
            }

            .ds-component-check-box {
                border-color: $red;
            }

            .error-message {
                display: block;
            }
        }

        .success {
            input[type="text"],
            input[type="number"],
            input[type="date"] {
                border-color: $green;
                color: $green;
            }

            .error-message {
                display: none;
            }
        }

        .Select {
            &.has-value {
                .Select-control {
                    border-color: $green;
                    color: $green;
                }
            }
        }

        .error-message {
            display: none;
            color: $red;
            font-size: 12px;
            position: absolute;
            right: 15px;
            top: 13px;
        }

        .ds-payment-alert-ico {
            width: 15px;
            height: 15px;
            background-color: $red;
            border-radius: 50%;
            display: block;
            text-align: center;
            font-size: 11px;
            padding-top: 2px;
            color: #FFF;
            cursor: pointer;

            &:hover {
                .ds-payment-error-text {
                    display: block;
                }
            }
        }

        .ds-payment-error-text {
            display: none;
            position: absolute;
            width: 120px;
            top: -60px;
            background-color: #c2c2c2;
            padding: 10px;
            font-size: 12px;
            color: #333;
            font-weight: 200;
            text-align: center;
            right: -5px;
            z-index: 9;

            &:after, &:before {
                top: 100%;
                left: 90%;
                border: solid transparent;
                content: " ";
                height: 0;
                width: 0;
                position: absolute;
                pointer-events: none;
            }

            &:after {
                border-color: rgba(194, 194, 194, 0);
                border-top-color: #c2c2c2;
                border-width: 10px;
                margin-left: -10px;
            }

            &:before {
                border-color: rgba(161, 161, 161, 0);
                border-top-color: #c2c2c2;
                border-width: 11px;
                margin-left: -11px;
            }
        }
    }

    .ds-payment-button {
        display: block;
        border: none;
        width: 100%;
        padding: 12px 15px;
        font-size: 16px;
        outline: none;
        background: $green;
        color: $blueButton;
        margin-top: 15px;
        cursor: pointer;
    }

    .ds-component-container-checkbox {
      clear: both;

        b {
            font-weight: 200;
        }
    }

    .ds-payment-loading {
        background: $loading;
        padding: 15px 0;
        border-radius: 3px;
        width: 100%;
        height: 95px;
        float: left;
        text-align: center;

        img {
            width: 55px;
        }
    }

    .ds-payment-success, .ds-payment-failed {
        padding: 15px 10px;
        border-radius: 10px;
        text-align: center;

        h1 {
            font-size: 18px;
            color: $green;
            font-weight: 200;
            margin-bottom: 20px;
        }

        h2 {
            font-size: 14px;
            font-weight: 200;
            color: #333;
        }
    }

    .ds-payment-failed {
        h1 {
            color: $red;
        }

        .error-item {
            display: block;
            font-size: 14px;
        }

        .ds-payment-button {
            margin-top: 35px;
        }
    }

    .ds-payment-installments {
        clear: both;
    }
}

.ds-payment-card {
    line-height: 1;
    position: relative;
    width: 100%;
    height: 260px;
    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -ms-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transition: all 1s cubic-bezier(0.680, -0.550, 0.265, 1);
    -moz-transition: all 1s cubic-bezier(0.680, -0.550, 0.265, 1);
    -o-transition: all 1s cubic-bezier(0.680, -0.550, 0.265, 1);
    -ms-transition: all 1s cubic-bezier(0.680, -0.550, 0.265, 1);
    transition: all 1s cubic-bezier(0.680, -0.550, 0.265, 1);

    .ds-payment-card-front {
        webkit-transition: background-image 0.10s ease-out;
        -moz-transition: background-image 0.10s ease-out;
        -o-transition: background-image 0.10s ease-out;
        -ms-transition: background-image 0.10s ease-out;
        transition: background-image 0.10s ease-out;
        background: $silver;
        border-radius: 5px;
    }

    &.flipped {
        -webkit-transform: rotateY(180deg);
        -ms-transform: rotateY(180deg);
        transform: rotateY(180deg);

        .ds-payment-card-cvc {
            transition: all 0.20s ease-out;
            visibility: visible;
        }
    }

    .ds-payment-flags {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 100px;
        height: 50px;
    }

    &.visa {
      .ds-payment-card-front, .ds-payment-card-back {
        background: #2980b9;
      }

      .ds-payment-flags {
          background: url('https://dnnsjdj5swfc3.cloudfront.net/web-components/images/credit-card-flags/card-visa.svg') right no-repeat;
      }
    }

    &.mastercard {
      .ds-payment-card-front, .ds-payment-card-back {
        background: #e74c3c;
      }

      .ds-payment-flags {
          background: url('https://dnnsjdj5swfc3.cloudfront.net/web-components/images/credit-card-flags/card-mastercard.svg') right no-repeat;
      }
    }

    &.blanche {
      .ds-payment-card-front, .ds-payment-card-back {
        background: #3498db;
      }

      .ds-payment-flags {
          background: url('https://dnnsjdj5swfc3.cloudfront.net/web-components/images/credit-card-flags/card-diners.svg') right no-repeat;
      }
    }

    &.american {
      .ds-payment-card-front, .ds-payment-card-back {
        background: #34495e;
      }

      .ds-payment-flags {
          background: url('https://dnnsjdj5swfc3.cloudfront.net/web-components/images/credit-card-flags/card-amex.svg') right no-repeat;
      }

      .ds-payment-card-expireCVV {
          display: block !important;
      }
    }

    .ds-payment-card-back {
        -webkit-transform: rotateY(180deg);
        -ms-transform: rotateY(180deg);
        transform: rotateY(180deg);
        background: $silver;
        border-radius: 5px;

        .ds-payment-card-bar {
            margin: 25px -2px 10px;
            height: 55px;
            background: $black;
        }

        .bar-withe {
            height: 40px;
            background: rgba(5, 6, 6, 0.13);
            width: 75%;
            margin: 0 15px;
        }

        .ds-payment-card-cvc {
            position: absolute;
            top: 95px;
            left: 85%;
            color: #141414;
            text-shadow: none;
            background-color: #FFF;
            height: 27px;
            width: 50px;
            padding: 5px;
            text-align: center;
        }
    }

    .ds-payment-card-front, .ds-payment-card-back {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        overflow: hidden;
        -webkit-transform-style: preserve-3d;
        -moz-transform-style: preserve-3d;
        -ms-transform-style: preserve-3d;
        -o-transform-style: preserve-3d;
        transform-style: preserve-3d;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .ds-payment-card-display {
        font-size: 16px;
        position: absolute;
        left: 30px;
        color: #FFF;

        &.ds-payment-card-expireCVV {
            left: 335px;
            bottom: 105px;
            display: none;
        }
    }

    .ds-payment-card-number {
        clear: both;
        margin-bottom: 30px;
        bottom: 65px;
        font-size: 18px;
    }

    .ds-payment-card-name {
        bottom: 65px;
        text-transform: uppercase;
    }

    .ds-payment-card-expiry {
        bottom: 20px;
        text-transform: uppercase;

        b {
            display: block;
            font-size: 12px;
            text-transform: none;
            font-weight: 200;
            line-height: 1.6em;
        }
    }

    .ds-payment-card-cvc {
        left: 312px;
        bottom: 128px;
        font-size: 16px;
        visibility: hidden;
    }

    .ds-payment-shiny {
      margin: 80px 30px;
      width: 50px;
      height: 35px;
      border-radius: 5px;
      background: #95a5a6;
      position: relative;

      &:before {
        content: " ";
        display: block;
        width: 70%;
        height: 60%;
        border-top-right-radius: 5px;
        border-bottom-right-radius: 5px;
        background: #7f8c8d;
        position: absolute;
        top: 20%;
      }
  }
}
