:root {
    /*-- color --*/
    --text-color: #212529;
    --pale-text-color: #3a4249;
    --primary: #0066a8;
    --primary-light: #0087e0;
    --secondary: #FF8C00;
    --secondary-light: #FFA933;
    --dangerous: #D32F2F;
    --dangerous-light: #EF5350;
    --success: #4CAF50;
    --success-light: #66BB6A;

    /*-- size --*/
    --card-width: 60%;

    /*-- shadow --*/
    --main-shadow: 0px 5px 10px 2px rgba(34, 60, 80, 0.2);
    --button-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.15);

}

* {
    box-sizing: border-box;
}

body {
    padding: 0;
    margin: 0;
    width: 100vw;
    height: 100vh;
    font-family: "Open Sans", sans-serif;
    background-color: #fcfcfc;
    color: var(--text-color)
}

button {
    border: 0;
    background-color: inherit;
    font-size: 16px;
    border-radius: 8px;
}


input {
    border: 0;
}

table {
    border-collapse: collapse;
    vertical-align: baseline;
}

/*----- общие стили ---------*/

.text_bold {
    font-weight: 700;
}

.page {
    display: flex;
    width: 100%;
    height: 100vh;
}

/*---- калькулятор ----*/
.calculator {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 70vw;
    padding: 1rem;
    box-sizing: border-box;
}

.calculator__logo {
    height: 12%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.calculator__logo-image {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.calculator__title {
    margin: 1.5rem 0;
    text-align: center;
}

.calculator__card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: var(--card-width);
    min-height: 30%;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--main-shadow);
}

.input-section {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

/*---- секция ввода длинны участка ----*/
.input-section__container {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--pale-text-color);
}

.input-section__container span {
    padding-left: 8px
}

.input-section__field {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.input {
    width: 100%;
    border-radius: 8px;
    border: none;
    outline: 1px solid lightgray;
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    background-color: white;
    transition: 0.3s ease;
    box-sizing: border-box;
}

.input:focus {
    outline: 1px solid gray;
}

.input-section__actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.input_invalid {
    outline-color: var(--dangerous);
}

.error-message {
    font-size: .8rem;
    color: var(--dangerous)
}



/*---- карточка результата ----*/

.result {
    position: relative;
    visibility: hidden;
    min-height: 0;
    width: var(--card-width);
    margin-top: 3rem;
    padding: 2rem;
    border-radius: 1.5rem;
    line-height: 0;
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    color: inherit;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.result::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color, var(--success)), var(--secondary-color, #2196F3));
    border-radius: 1.5rem 1.5rem 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.result__title {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}

.result__title__text {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.result__title__text::before {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.result_success {
    visibility: visible;
    min-height: 120px;
    opacity: 1;
    line-height: 1.6;
    box-shadow: var(--main-shadow);
    transform: translateY(0) scale(1);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05), rgba(76, 175, 80, 0.02));
    border-color: rgba(56, 142, 60, 0.3);
}

.result_success::before {
    opacity: 1;
    background: linear-gradient(90deg, var(--success), var(--success-light));
}

.result_success .result__title__text {
    color: #2e7d32;
}

.result_success .result__title__text::before {
    background-image: url('assets/icon/success.svg');
    animation: successIcon 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.result_error {
    visibility: visible;
    min-height: 120px;
    opacity: 1;
    line-height: 1.6;
    display: block;
    box-shadow: var(--main-shadow);
    transform: translateY(0) scale(1);
    background: linear-gradient(135deg, rgba(198, 40, 40, 0.05), rgba(198, 40, 40, 0.02));
    border-color: rgba(198, 40, 40, 0.3);
}

.result_error::before {
    opacity: 1;
    background: linear-gradient(90deg, var(--dangerous), var(--dangerous-light));
}

.result_error .result__title__text {
    color: var(--dangerous);
}

.result_error .result__title__text::before {
    background-image: url('assets/icon/error.svg');
    animation: errorIcon 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.result__message {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 1rem;
    margin-top: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.result__message__text-container {
    display: flex;
    gap: 0.5rem;
}

.result__message__text {
    line-height: 1.7;
    color: #4a5568;
    font-size: 1rem;
    text-align: justify;
    padding-left: 1.5rem;
    position: relative;
}

.result__message__text::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #4CAF50;
    font-size: 1.5rem;
    line-height: 1;
}

.result_error .result__message__text::before {
    color: var(--dangerous);
}


/* Анимации */
@keyframes successIcon {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    70% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes errorIcon {
    0% {
        transform: scale(0) rotate(-90deg);
        opacity: 0;
    }

    70% {
        transform: scale(1.2) rotate(10deg);
    }

    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}


/*---- таблица участков ----*/

.sections-list {
    display: flex;
    justify-content: center;
    width: 30vw;
    height: 100vh;
    padding: 1rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.sections-list__container-table {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 .5rem;
    margin-top: 1rem;
    width: 100%;
    height: 90vh;
    overflow: auto;
}



.table_show {
    display: flex;
}

.table_hide {
    display: none;
}

.sections-list table {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--main-shadow);
    overflow: hidden;
}

.sections-list thead {
    background-color: var(--primary);
    color: white;
}

.sections-list thead tr th {
    padding: .5rem 1rem;
}

.sections-list tbody tr td {
    padding: .5rem 1rem;
    text-align: center;
}

.sections-list tbody tr {
    border-bottom: 1px solid #E0E0E0;
}

/* .sections-list tbody tr:hover {
    background-color: #f1f1f1;
} */

.sections-list table tbody tr:last-child {
    border-bottom: none;
}

.sections-list table tbody tr:last-child td {
    padding-bottom: 2rem;
    border-bottom: none;
}

.sections-list__count-container {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: end;
    padding: 1rem 0;
    margin-top: 1rem;
    background-color: white;
    box-shadow: 0px -0px 10px 10px white;
}

#sections-list__total-count {
    display: flex;
    align-items: center;
    text-align: start;
}

/*---- общие стили кнопок ----*/
.button {
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    box-shadow: var(--button-shadow)
}

.button_primary {
    background-color: var(--primary);
}

.button_primary:hover {
    background-color: var(--primary-light);
}

.button_secondary {
    background-color: var(--secondary);
}

.button_secondary:hover {
    background-color: var(--secondary-light);
}

.button_dangerous {
    background-color: var(--dangerous);
}

.button_dangerous:hover {
    background-color: var(--dangerous-light);
}

.button:active {
    transform: scale(0.95);
}

.button__img {
    display: flex;
    align-items: center;
    background-color: inherit;
    cursor: pointer;
    padding: 5px;
}

.button__img_dangerous {
    display: inline-block;
    width: 24px;
    height: 24px;
    background-image: url(assets/icon/delete-dark.svg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    transition: .3s ease-out;
}


.button__img_dangerous:hover {
    background-image: url(assets/icon/delete-red.svg);
}

@media (max-width:1025px) {

    .page {
        flex-direction: column;
        height: fit-content;
    }

    .calculator {
        width: 100vw;
        height: fit-content;
    }

    .calculator__title {
        margin: 1rem;
    }

    .calculator__logo {
        height: 70px;
    }

    /*------- ввод длины -------*/
    .calculator__card {
        width: 100%;
        min-height: auto;
        margin-top: 1rem;
    }

    .input-section {
        gap: 1rem;
    }

    .input-section__field {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }

    .input-section__button {
        width: fit-content;
    }

    /*------- вывод результата -------*/
    .result {
        display: none;
        width: 100%;
        margin-top: 1.5rem;
        padding: 1rem;
    }

    .result__message__text-container {
        justify-content: space-between;
    }

    /*------- таблица участков -------*/
    .sections-list {
        width: 100%;
        max-height: 40vh;
        overflow: hidden;
    }

    .sections-list__container-table {
        width: 100%;
    }

    .sections-list__container-table h3 {
        display: none;
    }

    .sections-list__container-table {
        max-height: 30vh;
        overflow: auto;
    }

    .sections-list__count-container {
        margin-top: 1rem;
        padding-bottom: .5rem;
    }

    .calculator:has(.result_success, .result_error) > .result {
        display: block;
    }

    .calculator:has(.result_success, .result_error) .sections-list {
        display: none !important;
    }

}