* { padding: 0; margin: 0; box-sizing: border-box; }
a img { border: 0; }

body {
    margin-top: 60px; /* Збільшено, щоб шапка не перекривала контент */
    background: #000000;
    font-family: Arial, sans-serif;
    overflow-x: hidden; /* Ховаємо горизонтальну прокрутку */
}

/* --- ШАПКА --- */
.heder {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 5px;
    background: rgba(0, 0, 0, 0.9); /* Трохи прозорий фон */
    text-align: center;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Кнопки переносяться на новий рядок */
    gap: 5px;
    
}

#nav {
    position: absolute; top: 3px; right: 2%;
    float: right;
    margin-bottom: 3%;
    font-size: 30px; 
}

/* --- МЕНЮ (SIDEBAR) --- */
.sidebar {
    padding: 10px;
    text-align: center;
    position: fixed;
    overflow-y: auto; 
    top: 0;
    left: -100%; /* Повністю ховаємо */
    width: 300px; /* Фіксована ширина на ПК */
    height: 100%;
    transition: left 0.3s ease-in-out;
    z-index: 1100;
    background: #0c0335;
    border-right: 2px solid #e2fa7b;
}

.sidebar.active {
    left: 0;
    box-shadow: 10px 0 50px rgba(0,0,0,0.8);
}

/* --- КНОПКИ --- */
.btn.full {
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

.btn {
    margin: 2px;
    padding: 8px 12px;
    border: none;
    outline: none;
    color: #f4e924;
    cursor: pointer;
    position: relative;
    z-index: 0;
    border-radius: 12px;
    font-size: 14px;
    background: #06567c; /* Фоновий колір, якщо градієнт не підтримується */
}

.btn::after {
    content: "";
    z-index: -1;
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #06567c;
    left: 0;
    top: 0;
    border-radius: 10px;
}

/* Ефект світіння кнопок */
.btn::before {
    content: "";
    background: linear-gradient(
        45deg,
        #FF0000, #FF7300, #FFFB00, #48FF00,
        #00FFD5, #002BFF, #FF00C8, #FF0000
    );
    position: absolute;
    top: -2px; left: -2px;
    background-size: 600%;
    z-index: -1;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    filter: blur(8px);
    animation: glowing 20s linear infinite;
    transition: opacity .3s ease-in-out;
    border-radius: 10px;
    opacity: 0;
}

@keyframes glowing {
    0% {background-position: 0 0;}
    50% {background-position: 400% 0;}
    100% {background-position: 0 0;}
}

.btn:hover::before { opacity: 1; }
.btn:active:after { background: transparent; }
.btn:active { color: #000; font-weight: bold; }

/* --- ОСНОВНИЙ КОНТЕНТ --- */
#content {
    color: #fff34c;
    display: grid;
    /* Адаптивна сітка: колонки мінімум 300px, інакше розтягуються */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 5px;
    text-align: center;
    padding: 10px;
    width: 100%;
    
    margin: 0 auto;
}

/* Стиль посту (карточки) */
.post1 {
    width: 100%;
    border: 1px solid #e2fa7b;
    background: #170955;
    padding: 10px;
    text-align: center;
    border-radius: 20px;
}
.post {
    width: 100%;
    border: 1px solid #e2fa7b;
    background: #170955;
    padding: 10px;
    text-align: center;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 280px; /* Мінімальна висота для краси на ПК */
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.products-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Автоматична кількість колонок */
	gap: 20px; /* Відстань між товарами */
	padding: 1%;
}
.product {
		font-size: 12px;
		color: #f6e602;
		border: 2px solid #f6e602;
		border-radius: 10px;
		padding: 15px;
		background-color: #060c5e;
		text-align: center;
	}
	
.product cart{
	display: grid;
}
.product img {
		max-width: 50%;
		height: auto;
		border-radius: 5px;
}
	#adModal{
		font-size: 38px;
		text-align: center; /* Центрування тексту */
		background-color: #0c0335;
		}
	#productModal{
		font-size: 38px;
		text-align: center; /* Центрування тексту */
		background-color: #0c0335;
	}
	.modal {
		display: none;
		position: fixed;
		z-index: 9999;
		left: 0;
		top: 0;
		width: auto;
		height: 100%;
		overflow: auto;
		background-color: #296987;
	  }
	
	  .modal-content {
		overflow-y: auto;
		color: #f5e905;
		font-size: 20px;
		border-radius: 20px;
		border: 4px solid #f5e905;
		margin: 15% auto;
		display: block;
		max-width: 90%;
		max-height: auto;
		background-color: #296987;
		padding: 2%;
	  }
	  #modalImage{
		width: 95%;       /* Займає всю доступну ширину батьківського елемента */
		max-width: 100%;   /* Не перевищує ширину батьківського елемента */
		height: auto;      /* Автоматично регулює висоту зі збереженням пропорцій */
		display: block;     /* Усуває можливі проблеми з inline-елементами */
		margin-bottom: 10px; /* За потреби додайте відступ знизу */
	}

	
	  .close {
		position: absolute;
		top: 15px;
		right: 35px;
		color: #f90505;
		font-size: 50px;
		font-weight: bold;
	  }
	
	  .close:hover,
	  .close:focus {
		color: #f60707;
		text-decoration: none;
		cursor: pointer;
	  }
	
	  .close-button {
		color: #f90505;
		float: right;
		font-size: 60px;
		font-weight: bold;
	}
	
	.close-button:hover,
	.close-button:focus {
		color: black;
		text-decoration: none;
		cursor: pointer;
	}


	.modal-details h4 {
		margin-top: 0;
	}


.post a {
    font-size: 16px; 
    color: #e2ff3e;
    text-decoration: none;
    display: block;
    height: 100%;
}

.post-thumbnail, .post img {
    max-width: 100%;
    width: auto;
    height: auto;
    max-height: 200px; /* Обмеження висоти картинки */
    object-fit: contain; /* Картинка не розтягується спотворено */
    border-radius: 5px;
    margin-top: 10px;
}

/* --- ПОГОДА ТА ІНШЕ --- */
#weatherTemp {
    padding: 10px;
    border-radius: 15px;
    color: #fff;
}
.sunny { background-image: url('/images/sunny.jpg'); background-size: cover; text-shadow: 1px 1px 2px black; }
.cloudy { background-image: url('/images/cold.jpg'); background-size: cover; text-shadow: 1px 1px 2px black; }
.rainy { background-image: url('/images/rainy.jpg'); background-size: cover; text-shadow: 1px 1px 2px black; }
.snowy { background-image: url('/images/very_cold.jpg'); background-size: cover; text-shadow: 1px 1px 2px black; }
.stormy { background-image: url('/images/storm.jpg'); background-size: cover; text-shadow: 1px 1px 2px black; }

/* --- ЧАТ --- */
/* Додайте цей блок у style.css, наприклад, поруч з #chat-box */


#chat-box {
    text-align: center;
    height: calc(100vh - 120px);
    width: 100%;
    overflow-y: auto;
    background-color: white;
    color: black;
    padding: 10px;
    margin-top: 50px;
    margin-bottom: 60px;
}
.chat-message { background-color: #b0f1a8; 
    font-size: 18px;
    padding: 5px; 
    border-bottom: 1px solid #16720a; 
    }
    .delete-btn, .reply-btn, .reply-private-btn{ color: rgb(250, 21, 40); cursor: pointer; margin-left: 10px; 
    }
    
    
    .private-message { background-color: #ffebcd; padding: 5px; border-left: 4px solid red; 
    font-size: 18px;
    }
    .low-stock{
        color: rgb(172, 4, 4);
        
    }
    .ok-stock{
        color: rgb(9, 82, 9);
        
    }

#input-container {
    position: fixed; bottom: 0; left: 0; width: 100%;
    z-index: 100; background-color: rgb(0, 0, 0);
    padding: 10px; display: flex; align-items: center;
}
#input-container #message {
    flex-grow: 1; /* Поле вводу займе весь вільний простір */
    margin-right: 10px;
}
#private_message_input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #f8c2c2;
    border-radius: 5px;
}

#message { width: 70%; font-size: 16px; padding: 5px; }

/* --- МОДАЛЬНІ ВІКНА --- */
.modal {
    display: none; position: fixed; z-index: 9999;
    left: 0; top: 0; width: 100%; height: 100%;
    overflow: auto; background-color: rgba(0,0,0,0.8);
}
.modal-content {
    background-color: #296987; color: #f5e905;
    margin: 10% auto; padding: 20px; border: 2px solid #f5e905;
    width: 90%; max-width: 600px; border-radius: 20px; text-align: center;
}
.close { color: red; float: right; font-size: 40px; font-weight: bold; cursor: pointer; }

/* --- БАЗОВІ СТИЛІ ДЛЯ ПРИВАТНОГО ЧАТУ --- */
#private-chat-container {
    position: relative;
    margin: 10px 0;
    color: #fff34c;
}

/* контейнер повідомлення */
.private-message {
    display: flex;
    flex-direction: column;
    margin: 6px 0;
    max-width: 78%;
    clear: both;
}

/* повідомлення іншого користувача — зліва */
.other-message {
    align-self: flex-start;
    background: rgba(255,255,255,0.06);
    color: #73f353;
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 12px 12px 12px 4px;
    padding: 8px 10px;
}

/* твоє повідомлення — справа */
.my-message {
    align-self: flex-end;
    background: linear-gradient(180deg, rgba(106, 87, 1, 0.12), rgba(9, 9, 9, 0.05));
    color: #f6fa10;
    border: 1px solid rgba(242,198,2,0.25);
    border-radius: 12px 12px 4px 12px;
    padding: 8px 10px;
}


/* дрібні деталі: ім'я, час */
.private-message .meta {
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 4px;
}
.private-message .text {
    font-size: 15px;
    line-height: 1.25;
}

/* картинка всередині повідомлення — щоб не ламає контейнер */
.private-message img {
    max-width: 350px;
    width: auto;
    height: auto;
    display: block;
    margin-top: 6px;
    border-radius: 8px;
}

/* щоб панель вводу не закривала останні повідомлення на мобільних */
@media (max-width: 768px) {
    #private-chat-box { max-height: calc(100vh - 320px); }
}
#private-chat-box {
	color: #e2ff3e;
    height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 50px;
    background-color: #170955;
    display: flex;
    flex-direction: column;
	
}


/* --- АДАПТИВНІСТЬ ДЛЯ МОБІЛЬНИХ (IMPORTANT) --- */
@media (max-width: 768px) {
    /* Робимо контент в одну колонку */
    #content {
        grid-template-columns: 1fr; /* Одна колонка */
        padding: 5px;
    }

    /* Адаптуємо пости */
    .post {
        height: auto !important; /* Дозволяємо блоку розтягуватись */
        min-height: auto; /* Прибираємо фіксований мінімум */
        margin-bottom: 15px;
    }

    /* Картинки на всю ширину */
    .post-thumbnail, .post img {
        width: 100%;
        height: auto;
        max-height: 300px;
        object-fit: cover;
    }

    /* iframe (карти, погода) */
    iframe {
        width: 100% !important;
        height: 250px !important;
    }
    
    /* Меню на весь екран або широке */
    .sidebar {
        width: 85%;
        left: -86%;
    }
    
    /* Кнопки в шапці менші */
    .heder .btn {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    /* Текст новин */
    #news, #news1 {
        width: 100% !important;
        display: block !important;
    }
}

