@import '../styles/_variables.scss';

.main {
    font-family: $duda-font;
    padding-block-start: 5px;
    padding-inline-end: 5px;
    padding-block-end: 5px;
    padding-inline-start: 5px;
    border-radius: $default-border-radius;
    text-align: start;
    font-size: 13px;
    outline: none;
    border: $default-border;
    width: 200px;

    &.seamless {
        box-shadow: none;
        border: none;
        background-color: inherit;
    }

    &.disabled {
        opacity: 0.5;
    }
    &.readOnly {
        opacity: 0.5;
        color: $font-dark-gray;
        background-color: $disabled-bg;
    }
    &.saveIndicator {
        padding-inline-end: 30px;
    }
}

textarea.main {
    height: 100px;
    resize: vertical;
    &.no-resize {
        resize: none;
    }
}

.container div[contentEditable='true'] {
    height: 100px;
    box-sizing: border-box;
    overflow: auto;
    &:empty:before {
        opacity: 0.3;
        font-weight: 700;
        font-size: 12px;
        content: attr(placeholder);
    }
}

.container {
    width: 100%;
    position: relative;
    display: flex;
    &.withcharcount {
        width: auto;
        align-self: flex-start;
        display: inline-block;
    }
    &.white-background {
        input {
            background-color: white;
        }
    }
    .error-message.error-message {
        top: calc(100% + 1px);
    }
}
.layout-small {
    composes: main;
    width: 35px;
    height: 15px;
    padding-block-start: 0;
    padding-inline-end: 0;
    padding-block-end: 0;
    padding-inline-start: 0;
    text-align: center;
}
.layout-medium {
    composes: main;
    width: 50px;
    text-align: center;
}
.layout-large {
    composes: main;
    width: 100px;
}
.layout-extra-large {
    composes: main;
    width: 285px;
}
.layout-xxl {
    composes: main;
    width: 617px;
}
.layout-full {
    composes: main;
    width: 100%;
    text-align: start;
}
.error {
    border-color: $red-error;
}

.saved {
    position: absolute;
    z-index: 10;
    top: 50%;
    transform: translateY(-50%);
    height: 12px !important;
    color: $duda-green;
    > * {
        fill: $duda-green;
    }
    cursor: pointer;
    padding-block-start: 2px;
    .textArea & {
        top: 15px !important;
    }

    [dir='rtl'] & {
        right: auto;
        left: 8px;
    }

    [dir='ltr'] & {
        left: auto;
        right: 8px;
    }
}

.readOnlyPrefix {
    position: absolute;
    padding-block-start: 5px;
    padding-block-end: 5px;
    padding-inline-start: 5px;
    font-family: $duda-font;
    font-size: 13px;
    color: $darker-gray;
    cursor: default;
    margin-block-start: 1px;
}

:global(.touchDevice) {
    .container {
        max-width: 100%;
        width: 100%;

        input,
        textarea {
            max-width: 100%;
        }

        .layout-xxl {
            width: 100%;
        }
    }
}

.mobileDevice .main {
    height: 34px;
    padding-block-start: 0;
    padding-inline-end: 0;
    padding-block-end: 0;
    padding-inline-start: 0;
    border-radius: 0;
    font-size: 15px;
    font-weight: 300;
    box-shadow: none;
    border: none;
    border-bottom: $input-border-bottom;

    &.error {
        border-color: $red-error;
    }

    &.valid {
        border-color: $duda-green;
    }

    &::placeholder {
        font-weight: 400;
    }
}
