/* 🌞 БАЗА */
body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: #f4f6f9;
    color: #333;
}

/* 📦 контейнер */
.container {
    width: 1100px;
    max-width: 95%;
    margin: auto;
    padding: 30px 0;
}

/* 🔥 Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* 📁 Sidebar */
.sidebar {
    width: 230px;
    background: #fff;
    border-right: 1px solid #e6e6e6;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 30px;
    color: #ff6600;
}

/* 🔗 меню */
.nav {
    padding: 12px;
    border-radius: 8px;
    color: #666;
    text-decoration: none;
    margin-bottom: 10px;
    transition: 0.2s;
}

.nav:hover,
.nav.active {
    background: #fff3e6;
    color: #ff6600;
}

.bottom {
    margin-top: auto;
}

/* 🧠 Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 🔝 Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: #fff;
    border-bottom: 1px solid #e6e6e6;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    background: #fff3e6;
    color: #ff6600;
    font-size: 13px;
}

/* 📦 Контент */
.content {
    padding: 25px;
}

/* 📊 карточки */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e6e6e6;
    transition: 0.2s;
}

.card:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.06);
}

/* 🔥 кнопки */
.button {
    background: #ff6600;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: 0.2s;
}

.button:hover {
    background: #e65c00;
}

.button.small {
    padding: 6px 10px;
    font-size: 12px;
}

/* 📝 input */
input, select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* 📊 таблица */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead {
    background: #f9fafb;
}

.table th {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #eee;
    color: #666;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.table tr:hover {
    background: #f5f7fb;
}

/* 🟢 статус */
.status {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.status.active {
    background: #e6f9f0;
    color: #00a86b;
}

.status.blocked {
    background: #ffe6e6;
    color: #d10000;
}

/* 📤 drag & drop */
#dropZone {
    transition: 0.2s;
}

#dropZone:hover {
    background: #fff3e6;
}

/* 📊 прогресс */
#progressBar {
    transition: width 0.2s;
}

/* 📄 пагинация */
.pagination {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.pagination .button {
    min-width: 36px;
}

/* 📱 адаптив */
@media (max-width: 768px) {

    .sidebar {
        width: 70px;
        padding: 10px;
    }

    .logo {
        display: none;
    }

    .nav {
        text-align: center;
        font-size: 14px;
    }

    .topbar {
        padding: 10px;
        font-size: 14px;
    }

    .content {
        padding: 15px;
    }

}

.form {
    max-width: 400px;
}

.form input {
    width: 100%;
    margin-bottom: 10px;
}

.alert.success {
    background: #2ecc71;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}
/* =========================
   CHAT BUBBLE UI
========================= */

.bubble {
    position: relative;
    max-width: 70%;
    min-width: 180px; /* 👈 ВОТ ЭТО ГЛАВНОЕ */
    padding: 22px 14px 22px 14px;
    border-radius: 14px;
}

/* пользователь (справа) */
.msg.user {
    display: flex;
    justify-content: flex-end;
}

.msg.user .bubble {
    background: #c8f7d2;
    border: 1px solid #66d48f;
    color: #1e6b3a;
}

/* админ (слева) */
.msg.admin {
    display: flex;
    justify-content: flex-start;
}

.msg.admin .bubble {
    background: #f7c8c8;
    border: 1px solid #e57373;
    color: #7a1f1f;
}

/* header */
.msg-header {
    font-size: 11px;
    opacity: 0.7;
    margin-bottom: 4px;
}

/* текст */
.msg-text {
    white-space: pre-wrap;
}

/* файл */
.bubble a {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    opacity: 0.7;
}

/* =========================
   КНОПКА ВНУТРИ ПУЗЫРЯ
========================= */

.bubble-actions {
    position: absolute;
    top: 6px;
    right: 6px;
}

/* кнопка */
.bubble-actions button {
    background: #00cc77;
    border: none;
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

/* hover */
.bubble-actions button:hover {
    background: #00aa66;
}

/* =========================
   СТАТУС ✔✔
========================= */

/* текст */
.msg-text {
    margin-top: 16px;
}

/* правый низ */
.msg-status {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 12px;
    opacity: 0.7;
}

/* =========================
   ЦИТАТА (REPLY)
========================= */

.reply-box {
    background: rgba(0,0,0,0.08);
    border-left: 3px solid rgba(255,255,255,0.3);
    padding: 6px;
    margin-bottom: 6px;
    font-size: 12px;
    border-radius: 6px;
}

/* =========================
   СПИСОК ЧАТОВ (АДМИНКА)
========================= */

.chat-list {
    margin-top: 15px;
}

.chat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: 0.2s;
}

.chat-item:hover {
    background: rgba(255,255,255,0.05);
}

/* левая часть */
.chat-left {
    display: flex;
    flex-direction: column;
}

.chat-user {
    font-weight: 600;
}

.chat-last {
    font-size: 12px;
    opacity: 0.6;
}

/* правая часть */
.chat-right {
    text-align: right;
}

.chat-time {
    font-size: 12px;
    opacity: 0.5;
}

/* badge сообщений */
.chat-badge {
    background: red;
    color: #fff;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 12px;
    margin-top: 5px;
}

/* уведомление сверху */
#notifyBadge {
    background: red;
    color: #fff;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 12px;
}

/* =========================
   АДАПТИВ
========================= */

@media (max-width: 768px) {

    .bubble {
        max-width: 85%;
    }

    .chat-item {
        flex-direction: column;
        gap: 5px;
    }

    .chat-right {
        text-align: left;
    }
}

.user-badge {
    background: #f5e6d8;
    color: #ff6600;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
}
/* ЧАТ КОНТЕЙНЕР */
.chat-box {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ОБЩИЙ ПУЗЫРЬ */
.message {
    position: relative;
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* СООБЩЕНИЯ ПОЛЬЗОВАТЕЛЯ (слева) */
.message.user {
    background: #f1f1f1;
    align-self: flex-start;
}

/* хвостик слева */
.message.user::after {
    content: "";
    position: absolute;
    left: -6px;
    top: 10px;
    width: 12px;
    height: 12px;
    background: #f1f1f1;
    transform: rotate(45deg);
}

/* СООБЩЕНИЯ АДМИНА (справа) */
.message.admin {
    background: #ff6600;
    color: #fff;
    align-self: flex-end;
}

/* хвостик справа */
.message.admin::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 10px;
    width: 12px;
    height: 12px;
    background: #ff6600;
    transform: rotate(45deg);
}
.bubble-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    opacity: 0.7;
    margin-bottom: 5px;
}

/* правый верх */
.reply-btn {
    position: absolute;
    top: 6px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 12px;
    color: #ff6600;
    cursor: pointer;
}

.reply-btn:hover {
    opacity: 1;
    text-decoration: underline;
}

.bubble-bottom {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
    font-size: 11px;
    opacity: 0.7;
}
/* левый верх */
.msg-time {
    position: absolute;
    top: 6px;
    left: 10px;
    font-size: 11px;
    opacity: 0.6;
}

.chat-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #f5f5f5;
    padding: 12px;
    border-radius: 14px;
}

/* 🔥 БОЛЬШОЕ ПОЛЕ */
.chat-input textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;

    min-height: 80px;   /* 👈 стало больше */
    max-height: 200px;  /* 👈 ограничение */
    line-height: 1.4;

    background: #fff;
}

/* кнопка */
.chat-input button {
    background: #ff6600;
    border: none;
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
}
#filePreview {
    background: rgba(0,0,0,0.05);
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-block;
}