/* Подключение шрифта с несколькими форматами для надежности */
@font-face {
    font-family: 'PF Din Text Comp Pro Medium';
    src: url('fonts/PFDinTextCompPro-Medium_0.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Общие стили */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'PF Din Text Comp Pro Medium', Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Принудительное применение шрифта ко всем текстовым элементам */
body, 
.top-text, 
.center-text, 
.bottom-icons, 
.bottom-left-text, 
.bottom-right-text,
.large-text, 
.medium-text, 
.small-text,
.top-large-text, 
.top-small-text, 
.red-medium-text,
.skew-text,
.inline-text,
.icon-item p {
    font-family: 'PF Din Text Comp Pro Medium', Arial, sans-serif !important;
}

/* Контейнер для редактора и превью */
.editor-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

/* Панель редактора */
.editor-panel {
    width: 300px;
    height: 100%;
    overflow-y: auto;
    background-color: #f8f9fa;
    padding: 20px;
}

/* Контейнер превью */
.preview-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
    background-color: #ccc;
    position: relative;
}

/* Превью */
.container {
    position: relative;
    width: 1000px;
    height: auto;
    aspect-ratio: 1000 / 1414;
    background-color: white;
    transform-origin: center center;
    transform: scale(0.7);
    margin: 0 auto;
}

/* Стили элементов внутри контейнера */
.background,
.mask,
.snow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.logo {
    position: absolute;
    top: 25px;
    left: 30px;
    width: 120px;
    z-index: 10;
}

.top-text {
    position: absolute;
    top: -22px;
    right: 20px;
    text-align: right;
    transform: translate(var(--date-pos-x, 0px), var(--date-pos-y, 0px));
    z-index: 10;
}

.top-large-text {
    font-size: 100pt;
    font-weight: bold;
    text-transform: uppercase;
    font-family: 'PF Din Text Comp Pro Medium', Arial, sans-serif !important;
}

.top-small-text {
    font-size: 28pt;
    margin-top: -70px;
    margin-right: 8px;
    font-weight: bold;
    text-transform: uppercase;
    font-family: 'PF Din Text Comp Pro Medium', Arial, sans-serif !important;
}

.center-text {
    position: absolute;
    top: calc(63% + var(--main-text-pos-y, 0px));
    left: calc(50% + var(--main-text-pos-x, 0px));
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 5;
}

.skew-text {
    transform: skew(0deg, -7deg);
    display: inline-block;
}

.large-text {
    font-size: 100pt;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
    font-family: 'PF Din Text Comp Pro Medium', Arial, sans-serif !important;
}

.red-medium-text {
    font-size: 70pt;
    font-weight: bold;
    margin-top: -70px;
    margin-bottom: -60px;
    font-family: 'PF Din Text Comp Pro Medium', Arial, sans-serif !important;
}

.small-text {
    font-size: 20pt;
    font-weight: bold;
    text-transform: uppercase;
    font-family: 'PF Din Text Comp Pro Medium', Arial, sans-serif !important;
}

.inline-text {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
}

.bottom-icons {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: calc(100% - 40px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    font-size: 20pt;
    text-transform: uppercase;
}

.icon-item {
    display: flex;
    align-items: center;
}

.icon {
    width: 25px;
    height: 25px;
    margin-right: 10px;
    margin-bottom: 16px;
}

.bottom-left-text,
.bottom-right-text {
    position: absolute;
    bottom: 120px;
    font-size: 24pt;
    text-transform: uppercase;
    line-height: 1.2;
    font-family: 'PF Din Text Comp Pro Medium', Arial, sans-serif !important;
}

.bottom-left-text {
    left: 20px;
    text-align: left;
    transform: translate(var(--bottom-left-pos-x, 0px), var(--bottom-left-pos-y, 0px));
}

.bottom-right-text {
    right: 20px;
    text-align: right;
    transform: translate(var(--bottom-right-pos-x, 0px), var(--bottom-right-pos-y, 0px));
}

/* Слой снега */
.snow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 15;
}

/* Дополнительные стили для изменений цвета текста */
#main-text-preview {
    color: #000000;
}

#sub-text-preview {
    color: #ff0000;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
        height: 100%;
    }

    .editor-panel {
        width: 100%;
        height: 33vh;
    }

    .preview-container {
        height: 67vh;
    }

    .container {
        position: relative;
        width: 100%;
        max-width: 1000px;
        height: auto;
        margin: 0 auto;
        aspect-ratio: 1000 / 1414;
    }

    /* Корректируем размеры элементов внутри превью */
    .logo {
        width: 50px;
        top: 12px;
        margin-left: -15px;
    }

    .top-large-text {
        font-size: 40pt;
        margin-top: 15px;
        margin-right: -10px;
    }

    .top-small-text {
        font-size: 12pt;
        margin-top: -35px;
        margin-right: -6px;
    }

    .center-text {
        top: calc(64% + var(--main-text-pos-y, 0px));
    }

    .large-text {
        font-size: 45pt;
        text-transform: uppercase;
    }

    .red-medium-text {
        font-size: 32pt;
        margin-top: -40px;
        margin-bottom: -30px;
        text-transform: uppercase;
    }

    .small-text {
        font-size: 10pt;
        text-transform: uppercase;
    }

    .bottom-icons {
        font-size: 10pt;
        bottom: 2px;
    }

    .icon {
        width: 18px;
        height: 18px;
    }

    .bottom-left-text,
    .bottom-right-text {
        position: absolute;
        font-size: 12pt;
        bottom: 40px;
        line-height: 0.4;
        text-transform: uppercase;
    }
}