@font-face {
    font-family: "Open Sans";
    src: url('../../fonts/open-sans/OpenSans-Regular.ttf');
}

$background: #f5efe8;
$bad: #dc4e25;
$average: #eabe2a;
$good: #42a547;
$undefined-text: #727272;

// Цвета для строки статуса в панели состояния
// см. .dashboard-status-line*
$item-name-color: #fff !default;
$default: #6c757d !default;
$success: $good !default;
$warning: $average !default;
$danger: $bad !default;

.square {
    display: inline-block;
    float: left;
    height: 220px;
    width: 220px;
    background-color: $background;
    position: relative;
    margin: 8px;
    border-radius: 3px;
}

@mixin Xcentered {
    position: absolute;
    left: 50%;
    margin-right: -50%;
    transform: translateX(-50%);
    -ms-transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
}

@mixin centered {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
}

@mixin zone {
    @include centered;
    border-radius: 100%;
    width: 130px;
    height: 130px;
}

.ring {
    @include centered;
    height: 160px;
    width: 160px;
    border-radius: 100%;
    border: 2px solid $background;
    top: 45%;
}

.rielta-zone {
    @include zone;
    background-color: $background;
}

.cwl-zone {
    @include zone;
    background-color: $background;
}

.wired-zone {
    @include zone;
    background-color: white;
    top: 45%;
}

.flash {
    @include Xcentered;
    background: $bad url("../../icons/flash.svg") no-repeat;
    background-size: 12px 18px;
    background-position: 12px 6px, center;
    border-radius: 4px;
    width: 34px;
    height: 34px;
}

.rielta-zone + .flash {
    top: -11px;
}

.cwl-zone + .flash {
    top: -11px;
}

.wired-zone + .flash {
    top: 14px;
}

.warning {
    background-color: $bad;
    .zone-type, .zone-number, .zone-type-mini, .zone-number-mini {
        color: white;
    }
    .rielta-wired-zone-fault-mini > div {
        color: white;
    }
    .low-temperature {
        color: lightskyblue;
    }
    .high-temperature {
        color: white;
    }

}

.repeater {
    position: relative;
    float: right;
    right: 10px;
    top: 10px;
    background-color: $good;
    width: 2.4em;
    text-align: center;
    border-radius: 5px;
    color: white;
    font-family: "Open Sans";
    font-size: 15px;
    font-weight: bold;
}

.offline {
    @extend .repeater;
    background-color: $bad;
}

.under-text {
    @include Xcentered;
    bottom: 0;
    list-style-type: none;
    -webkit-padding-start: 0;
    -moz-padding-start: 0;
}

.under-text.multiline {
    text-align: center;
}

.under-text.multiline li {
    float: none;
}

@mixin under-text {
    font-family: "Open Sans";
    font-size: 15px;
    line-height: 20px;
    color: $bad;
}

.under-alarm {
    @include under-text;
    @include Xcentered;
    bottom: 22px;
}

.under-alarm-second-line {
    @extend .under-alarm;
    bottom: 6px;
}

.under-text li {
    @include under-text;
    float: left;
    padding-left: 3px;
    padding-right: 3px;
}

.under-alarm + .under-text {
    margin-bottom: 5px;
}

/* если under-alarm занимает две строки, для under-text не остаётся места */
.under-alarm-second-line + .under-text {
    display: none;
}

ul.rielta-wired-zone-fault {
    position: relative;
    top: 80%;
}

.rielta-wired-zone-fault.under-text {
    li {
        display: inline;
    }

    li:after {
        content: ",";
    }

    li:last-child:after {
        content: "";
    }
}

// Специфичные стили для CWL-устройств - центровка неисправностей
.under-text-cwl {
    @include Xcentered;
    bottom: -3px; // сдвигаем вниз для лучшего размещения многострочного текста
    list-style-type: none;
    -webkit-padding-start: 0;
    -moz-padding-start: 0;
    text-align: center;
}

.under-text-cwl li {
    @include under-text;
    display: inline-block;
    padding-left: 3px;
    padding-right: 3px;
    line-height: 18px; // уменьшаем для экономии места
}

.under-text-cwl li.undefined {
    color: $undefined-text;
}

.bad {
    background-color: $bad;
}

.average {
    background-color: $average;
}

.good {
    background-color: $good;
}

@for $i from 1 through 14 {
    .sector-#{$i} {
        background-image:
            linear-gradient(90deg + 12 * $i, transparent 50%, white 50%),
            linear-gradient(90deg, white 50%, transparent 50%);
    }
}

.sector-15 {
    background-image:
        linear-gradient(90deg, white 50%, transparent 50%);
}

@for $i from 16 through 20 {
    .sector-#{$i} {
        background-image:
            linear-gradient(-270deg + (12 * ($i - 15)), transparent 50%, $average 50%),
            linear-gradient(90deg, white 50%, transparent 50%);
    }
}

@for $i from 21 through 29 {
    .sector-#{$i} {
        background-image:
            linear-gradient(-270deg + (12 * ($i - 15)), transparent 50%, $good 50%),
            linear-gradient(90deg, white 50%, transparent 50%);
    }
}

.sector-30 {
    background-image: none;
}

.zone-number {
    font-family: "Open Sans";
    font-size: 60px;
    width: inherit;
    text-align: center;
    position: absolute;
    top: 44%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-wrap: auto;
}

.zone-number .dual {
    font-size: 40px;
}

.zone-number .multi {
    font-size: 28px;
}

.zone-type {
    text-align: center;
    font-family: "Open Sans";
    font-size: 15px;
    color: #727272;
    position: absolute;
    top: 79%;
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

.temperature {
    @extend .zone-type;
    color: black;
}

.rielta-wired-zone {
    @extend .zone-type;
    line-height: 1;
    top: 0;

    .serial-number {
        font-size: 13px;
        line-height: 1.6;
    }
}

.no-link {
    background-color: $bad;
    background-image: none;
}

.signal-quality-undefined {
  background-color: #bbbbbb;
  background-image: none;
}


.details {
    padding: 20px 15px;
    .header {
        font-weight: bold;
    }
    .fault {
        color: $bad
    }
    .undefined {
        color: $undefined-text;
    }
    .normal {
        color: $good
    }
    .low-temperature {
        color: blue;
    }
    .high-temperature {
        color: $bad;
    }
}

/* в случае большого количества текста в метке всё остаётся слева */
.checkbox label.control-label {
    text-align: left;
}

.dashboard-status-line {
    display: block;
    padding-bottom: 10px;
}

.dashboard-status-line-item {
    display: inline-block;
    padding-right: 10px;
}

.dashboard-status-line-item-name {
    display: inline-block;
    padding: .25em .5em;
    font-size: .75em;
    font-weight: 700;
    line-height: 1;
    color: $item-name-color;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25rem;
    text-transform: uppercase;
}

.state-unknown {
    background-color: $default;
}

.state-success {
    background-color: $success;
}

.state-warning {
    background-color: $warning;
}

.state-danger {
    background-color: $danger;
}

.dashboard-status-line-item-state {
    display: inline-block;
    vertical-align: baseline;
}

/* текст, выводимый вместо содержимого таба панели состояния */
.tab-replacement-text {
    margin-top: 30px;
    text-align: center;
    font-weight: bold;
  }


.zone-identification-mini {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    flex-wrap: nowrap;
    flex-direction: row;
    gap: 3px;
}

.zone-type-mini {
    text-align: center;
    font-family: "Open Sans";
    font-size: 15px;
    color: #727272;
}


.rielta-wired-zone-fault-mini {
    column-gap: 3px;
    padding-bottom: 3px;
    max-width: 123px;
    position: relative;
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    flex-wrap: wrap;
    padding-right: 35px;
}

.rielta-wired-zone-mini {
    @extend .zone-type-mini;
    padding-bottom: 3px;
    line-height: 1;
    top: 0;
    font-size: 10px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    .serial-number {
        line-height: 1.6;
    }
}


.zone-number-mini {
    float: left;
    font-family: "Open Sans";
    font-size: 25px;
    padding-left: 7px;
    text-align: center;
}


.fault-item-mini {
    font-size: 10px;
}

.under-text-mini {
    bottom: 0;
    color: $bad;
    list-style-type: none;
    -webkit-padding-start: 0;
    -moz-padding-start: 0;
}

.flash-mini {
    background: $bad url("../../icons/flash.svg") no-repeat;
    background-size: 12px 18px;
    background-position: 12px 8px, center;
    z-index: 999;
    width: 34px;
    border-radius: 3px;
    height: 34px;
}

.square-mini {
    @extend .square;

    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: flex-end;

    height: 36px;
    margin: 4px;
}

.wired-zone-mini {
    @include zone;
    width: 220px;
    height: 36px;
    border-radius: 3px;
    gap: 5px;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: space-between;
}
