/* === Общие настройки === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    height: 100vh;
    font-family: 'Inter', system-ui, sans-serif;
    color: #1e1e1e;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #eef2f3, #dfe9f3);
}

/* === Фон с плавающим градиентом === */
.nova-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(at 20% 30%, #b5d0ff, transparent 60%),
        radial-gradient(at 80% 70%, #d7b8ff, transparent 60%),
        radial-gradient(at 50% 90%, #ffd1b8, transparent 60%);
    filter: blur(80px);
    z-index: 0;
    animation: move-bg 15s ease-in-out infinite alternate;
}

@keyframes move-bg {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(20px, -20px) scale(1.1);
    }
}

/* === Карточка приветствия === */
.welcome-card {
    position: relative;
    z-index: 1;
    max-width: 420px;
    margin: auto;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.welcome-card:hover {
    transform: translateY(-52%) scale(1.02);
    box-shadow: 0 6px 50px rgba(0, 0, 0, 0.15);
}

h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: #222;
}

.subtitle {
    font-size: 1.05rem;
    color: #555;
    margin-bottom: 30px;
    line-height: 1.5;
}

.btn-main {
    display: inline-block;
    background: linear-gradient(135deg, #4a8fff, #8f5eff);
    color: white;
    padding: 14px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 500;
    transition: 0.25s ease;
}

.btn-main:hover {
    background: linear-gradient(135deg, #3a7eff, #7d4eff);
    transform: scale(1.05);
}

/* === Футер === */
footer {
    position: absolute;
    bottom: 15px;
    width: 100%;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    z-index: 2;
}


/* === Страница авторизации === */
.auth-card {
    position: relative;
    z-index: 1;
    max-width: 380px;
    margin: auto;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 40px 30px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.auth-card h2 {
    margin-bottom: 25px;
    font-size: 1.6rem;
    color: #333;
}

.form-group {
    text-align: left;
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #444;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
}

input:focus {
    border-color: #6b8cff;
}

.error {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid #ff6b6b;
    color: #b00020;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.back-link {
    margin-top: 20px;
}

.back-link a {
    text-decoration: none;
    color: #555;
    font-size: 0.95rem;
    transition: 0.3s;
}

.back-link a:hover {
    color: #000;
}

/* === Dashboard layout === */
.dashboard-container {
    max-width: 900px;
    margin: 80px auto;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 0 20px;
}

/* Общие карточки */
section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 25px 30px;
    border-radius: 18px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
}

section h2 {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 15px;
}

/* === Платформы === */
.platform-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.platform-card {
    flex: 1 1 250px;
    min-width: 220px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-radius: 14px;
    padding: 14px 18px;
    border: 1px solid #eee;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.25s;
}

.platform-card img {
    width: 32px;
    height: 32px;
}

.platform-card span {
    font-weight: 600;
    flex-grow: 1;
    margin-left: 10px;
}

.platform-card.connected {
    border-left: 5px solid #00c853;
}

.platform-card.disconnected {
    border-left: 5px solid #ff3d00;
}

.platform-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.status {
    font-size: 0.9rem;
}

.status.ok {
    color: #00a650;
}

.status.not {
    color: #c62828;
}

/* === Навигация === */
.nav-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-nav {
    display: inline-block;
    background: linear-gradient(135deg, #4a8fff, #8f5eff);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    transition: 0.25s ease;
}

.btn-nav:hover {
    transform: scale(1.05);
}

.btn-nav.danger {
    background: linear-gradient(135deg, #ff6b6b, #ff3b3b);
}

/* === User info === */
.user-card p {
    margin-bottom: 6px;
    color: #444;
    font-size: 1rem;
}


/* === Новый стиль блока "Подключенные платформы" === */
.platform-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.platform-card-new {
    flex: 1 1 280px;
    min-width: 260px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 5px solid #ff4500;
    /* оранжевая полоска слева */
    transition: all 0.25s ease;
}

.platform-card-new:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.platform-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.platform-left img {
    width: 34px;
    height: 34px;
}

.platform-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.platform-right {
    text-align: right;
}

.status-ok {
    color: #00a650;
    font-weight: 600;
    font-size: 0.95rem;
}

.status-bad {
    color: #d33;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Заголовок */
.platforms h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #222;
}

.icon-globe {
    font-size: 1.2rem;
}


/* === Connections Page === */
.connections-container {
    max-width: 720px;
    margin: 70px auto;
    z-index: 1;
    position: relative;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 40px 40px 60px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.connections-container h1 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.platform-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.btn-platform {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    color: white;
    cursor: pointer;
    transition: 0.25s ease;
}

.btn-platform.tg {
    background: #229ED9;
}

.btn-platform.wa {
    background: #25D366;
}

.btn-platform.avito {
    background: #0060F0;
}

.btn-platform:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.connect-block {
    margin-top: 25px;
    padding: 25px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    display: none;
}

.connect-block h2 {
    margin-bottom: 10px;
}

.qr-preview {
    width: 220px;
    margin: 15px auto;
    display: block;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.form-group {
    margin: 12px 0;
    text-align: left;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

.status-ok {
    color: #009e3c;
    font-weight: 600;
    margin-top: 10px;
}

.back-link {
    display: inline-block;
    margin-top: 25px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
}


/* === Чаты === */
.chats-container {
    max-width: 850px;
    margin: 60px auto;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 30px 40px 50px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    position: relative;
}

.platform-switch {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.chat-block {
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 15px;
}

.chat-item {
    background: #fff;
    border-radius: 10px;
    padding: 10px 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.chat-item:hover {
    background: #f6faff;
}

.chat-window {
    background: #fff;
    border-radius: 14px;
    padding: 15px;
    margin-top: 25px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

#chatHeader {
    font-weight: 600;
    margin-bottom: 12px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.chat-messages {
    min-height: 120px;
    max-height: 260px;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 10px;
}

.msg-out {
    background: linear-gradient(135deg, #4a8fff, #8f5eff);
    color: white;
    padding: 8px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    align-self: flex-end;
    width: fit-content;
}

#chatForm {
    display: flex;
    align-items: center;
    gap: 10px;
}

#chatInput {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    outline: none;
    font-size: 1rem;
}

#sendBtn {
    background: linear-gradient(135deg, #4a8fff, #8f5eff);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.25s ease;
}

#sendBtn:hover {
    transform: scale(1.05);
}

.loader {
    width: 18px;
    height: 18px;
    border: 3px solid #ccc;
    border-top: 3px solid #4a8fff;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


.msg-in {
    background: #f2f2f2;
    color: #222;
    padding: 8px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    width: fit-content;
}

.msg-out {
    background: linear-gradient(135deg, #4a8fff, #8f5eff);
    color: white;
    padding: 8px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    margin-left: auto;
    width: fit-content;
}


.msg-text {
    display: block;
}

.msg-time {
    font-size: 0.8em;
    opacity: 0.6;
    margin-left: 6px;
}

.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 18px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .2s ease, transform .2s ease;
}

.alert-show {
    opacity: 1;
    transform: translateY(0);
}

.alert-success {
    background: #2e7d32;
}

.alert-error {
    background: #d32f2f;
}

.alert-info {
    background: #1976d2;
}

.status-ok {
    color: #2e7d32;
    font-weight: 600;
}

.qr-preview {
    width: 260px;
    height: 260px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.qr-meta {
    color: #555;
    margin-top: 8px;
}

.connections-container {
    max-width: 880px;
    margin: 40px auto;
    padding: 24px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .06);
}

.platform-buttons {
    display: flex;
    gap: 12px;
    margin: 16px 0 24px;
    flex-wrap: wrap;
}

.btn-platform {
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    color: #fff;
    font-weight: 600;
}

.btn-platform.tg {
    background: linear-gradient(135deg, #4a8fff, #7c5cff);
}

.btn-platform.wa {
    background: #25D366;
}

.btn-platform.avito {
    background: #ff3b30;
}

.connect-block {
    display: none;
    padding: 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
}

.back-link {
    display: inline-block;
    margin-top: 18px;
    color: #444;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.inline-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-light {
    background: #f3f5ff;
    border: 1px solid #dfe4ff;
    color: #2e3a59;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
}

.btn-light:hover {
    background: #e9edff;
}