
@import url("ui.css");

img {
    display: block;
    max-width: 100%;
}

button {
	all: unset;
	display: inline-block;
	cursor: pointer;
	width: 200px;
	padding: 10px 20px;
	margin: 0 auto;
	border-radius: 15px;
	text-align: center;
    background-color: var(--firstColor);
    transition: all var(--animationDuration) ease;
}

button:hover {
    background-color: var(--secondColor);
    transform: scale(1.05);
}

button:active {
    transform: scale(0.98);
}

.hidden {
	display: none !important;
}

@keyframes spin {
	to {
		transform: rotate(360deg); 
	}
}

.preloader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background:var(--firstColor);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 18px;
	z-index: 1000000;
	transition: all var(--animationDuration) ease;
}

.preloader.hidden {
	opacity: 0;
	pointer-events: none;
}

.preloader .spinner {
	width: 50px;
	height: 50px;
	border: 5px solid rgba(255,255,255,0.3);
	border-top: 5px solid #fff;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin-bottom: 15px;
}

.chat-list,
.chat-window {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.chat-list__header,
.chat-list__content {
	padding: 10px 15px;
}

.chat-list__header {
    display: flex;
    justify-content: space-between;
	align-items: center;
	height: var(--headerHeight);
    background: var(--firstColor);
    border-bottom: 2px solid #000;
}

.chat-list__title {
	font-size: 24px;
    font-weight: 700;
	padding-left: 75px;
}

.chat-list__watermark {
    font-size: 14px;
    font-weight: normal;
	color: var(--fourthColor);
}

.chat-list__content {
	overflow-y: auto;
    overflow-x: hidden;
	padding-right: 8px;
}

.chat-list__item:not(:last-child) {
	border-bottom: 2px solid rgba(0, 0, 0, 0.2);
}

.chat-list__item {
	display: flex;
    align-items: center;
    gap: 15px;
	padding: 8px 0;
	/* transition: background 0.2s, transform 0.2s; */
	cursor: pointer;
	transition: all 0.3s ease;
}

.chat-list__item:active {
    transform: scale(0.98);
}

.chat-list__item:hover {
	background: rgba(0, 0, 0, 0.05);
	transform: translateX(4px);
}

.chat-list__avatar,
.chat-window__avatar {
	width: 50px;
	height: 50px;
	border-radius: 50%;
	background: center/cover no-repeat, linear-gradient(135deg, var(--secondColor), var(--thirdColor));
	overflow: hidden;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
	pointer-events: none;
}

.chat-list__avatar {
	width: 60px;
	height: 60px;
}

.chat-list__user-text {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.chat-list__username {
    font-size: 18px;
    font-weight: 600;
}

.chat-list__story-type,
.chat-list__hint {
	font-size: 14px;
	color: var(--fourthColor);
}

.chat-list__story-type {
    color: var(--fourthColor);
    margin-top: 5px;
}

.chat-list__hint {
	text-align: center;
	padding: 10px 15px 15px;
}

.chat-window__header {
	display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
	padding-right: 50px;
	height: var(--headerHeight);
    background: var(--firstColor);
    border-bottom: 2px solid #000;
}

.chat-window__back-button,
.chat-window__premium-button {
	width: 50px;
	height: 50px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	background-size: 25px 25px;
	background-position: center;
	background-repeat: no-repeat;
}

.chat-window__premium-button {
	margin-left: auto;
	animation: float 3s ease-in-out infinite;
}

@keyframes float {
	0%, 100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-5px);
	}
}

.chat-window__username {
    font-size: 1rem;
    font-weight: bold;
}

.chat-window__status {
    font-size: 0.9rem;
    color: var(--thirdColor);
}

.chat-window__start-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    font-size: 32px;
	transition: all var(--animationDuration) ease;
}

.chat-window__start-button:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.chat-window__start-button:active {
    transform: translate(-50%, -50%) scale(0.98);
}

.chat-window__watermark {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: var(--fourthColor);
    text-align: center;
    pointer-events: none;
	transition: all var(--animationDuration) ease;
}

.chat-window__start-button.fade-out,
.chat-window__watermark.fade-out {
    opacity: 0;
}

.chat-window__content {
	display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    overflow-y: auto;
    min-height: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-window__message {
    position: relative;
    max-width: 70%;
    display: inline-block;
    padding: 10px 20px;
    margin: 10px 0;
    font-size: 1rem;
    opacity: 0;
    animation: fadeIn var(--animationDuration) forwards;
	border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.chat-window__message.to {
    background-color: var(--firstColor);
    align-self: flex-start;
    margin-left: 11px;
    border-bottom-left-radius: 0;
	border-bottom-right-radius: 15px;
}

.chat-window__message.from {
    background-color: var(--secondColor);
    align-self: flex-end;
    margin-right: 11px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 0;
}

.chat-window__message.to::after {
    content: "";
    position: absolute;
    width: 11px;
    height: 18px;
    bottom: 0;
    left: -10px;
    background: url("../images/message-tail-to.webp") no-repeat;
    background-size: contain;
}

.chat-window__message.from::after {
    content: "";
    position: absolute;
    width: 11px;
    height: 18px;
    bottom: 0;
    right: -10px;
    background: url("../images/message-tail-from.webp") no-repeat;
    background-size: contain;
}

.chat-window__choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    animation: fadeIn var(--animationDuration) forwards;
}

.chat-window__choice-id {
	font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", "Source Code Pro", "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
	color: var(--fourthColor);
	margin: 0 auto;
}

.chat-photos {
	position: fixed;
	inset: 0;
	background:var(--backgroundColor);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
}

.chat-photos__title {
	margin-top: 20px;
}

.chat-photos__container {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
	justify-content: center;
	overflow-y: auto;
}

.chat-photos__photo {
	position: relative;
	width: 180px;
	height: 270px;
	border-radius: 15px;
	overflow: hidden;
	background-size: cover;
	background-position: center;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.chat-photos__photo.locked::before {
	content: "";
	position: absolute;
	inset: 0;
	backdrop-filter: blur(20px);
	background: rgba(0,0,0,0.4);
	z-index: 1;
}

.chat-photos__photo.locked::after {
	content: "";
	position: absolute;
	inset: 0;
	background: url("../images/video-icon.webp") center/64px no-repeat;
	z-index: 2;
}

.chat-photo {
	position: fixed;
	inset: 0;
	background: var(--backgroundColor);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 1000;
}

.chat-photo__photo {
	width: 80%;
	height: 80%;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	position: relative;
	pointer-events: none;
}

.chat-photos__close,
.chat-photo__close,
.chat-titles__back-button {
	display: block;
	font-size: 48px;
	cursor: pointer;
}

.chat-titles {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    padding: 0 50px 50px;
	background: no-repeat center top / cover;
    display: flex;
    font-size: 22px;
    text-align: center;
	flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    z-index: 10000;
}

.chat-titles__back-button {
    position: absolute;
	top: 10px;
	right: 20px;
}

.chat-titles__text {
    text-shadow: 3px 3px 6px rgba(0,0,0,0.9), 0 0 10px rgba(0,0,0,0.5);
}

.chat-titles__restart-button {
	box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.preloader__progress {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.preloader__progress-bar {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}
