* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f5f7fb;
    color: #1a202c;
    line-height: 1.5;
}
.badge-notification {
    display: inline-block;
    background-color: #e53e3e;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
    min-width: 18px;
    text-align: center;
}
.btn-xs {
    padding: 2px 6px;
    font-size: 11px;
    margin-left: 4px;
}
.nav-link {
    position: relative;
}
.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
/* Спиннер загрузки */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

.loader-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.loader-white {
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Стили для полей с ошибками */
.form-control.error {
    border-color: #e53e3e;
    background-color: #fff5f5;
}

.error-message {
    color: #e53e3e;
    font-size: 12px;
    margin-top: 4px;
}
/* Блок затемнения для кнопок */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading .btn-text {
    visibility: hidden;
}

.btn-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
/* Стили для таблицы гаражей */
.table td {
    vertical-align: middle;
    padding: 12px;
}

.badge-paid {
    background: #48bb78;
    color: white;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
}
.debt-positive {
    background-color: #fff5f5;
    font-weight: bold;
}
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: normal;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .table td {
        padding: 8px;
        font-size: 12px;
    }
    
    .table td button {
        font-size: 12px;
        padding: 4px 6px;
    }
}
/* Облачко сообщения */
.message-bubble {
    max-width: 100%;
    padding: 8px 12px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

/* Чужие сообщения - уголок слева внизу */
.bubble-other {
    background: #f1f5f9;
    color: #1e293b;
    border-top-left-radius: 4px;
    position: relative;
}

.bubble-other::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 0px;
    width: 16px;
    height: 16px;
    background: #f1f5f9;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* Свои сообщения - уголок справа внизу */
.bubble-own {
    background: #667eea;
    color: white;
    border-top-right-radius: 4px;
    position: relative;
}

.bubble-own::before {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 0px;
    width: 16px;
    height: 16px;
    background: #667eea;
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}

/* Кнопка отправки как самолётик */
.send-btn {
    background: #667eea;
    border: none;
    color: white;
    font-size: 18px;
    padding: 10px 18px;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    background: #5a67d8;
    transform: scale(1.02);
}

.send-btn:active {
    transform: scale(0.98);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Пузырьки сообщений */
.message {
    max-width: 80%;
    background: white;
    border-radius: 18px;
    padding: 8px 12px;
    margin: 4px 0;
}

/* Свои сообщения справа */
.message.own {
    margin-left: auto;
    background: #e3f2fd;
}

/* Аватарка слева */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #667eea;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Имя над сообщением */
.message-author {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}

/* Время под сообщением */
.message-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}



/* Стили для кнопок действий */
.message-actions {
    display: inline-flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-bubble:hover .message-actions {
    opacity: 1;
}

.action-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 4px;
    color: #64748b;
    transition: all 0.2s;
}

.action-icon:hover {
    background: #e2e8f0;
}

.action-icon.danger:hover {
    background: #fee2e2;
    color: #e53e3e;
}

.thread-actions {
    display: flex;
    gap: 8px;
}
/* ==================== ШАПКА ==================== */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1168px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}
.logo3{
    width: 36px;
    height: auto;
    margin-bottom: -2px;
    margin-right: 7px;
}
.logo {
    font-weight: bold;
    font-size: 25px;
    min-width: 238px;
    margin-left: 7px;
}

.logo a {
    text-decoration: none;
    /*background: linear-gradient(135deg, #667eea, #764ba2);*/
    background: #2c7da0;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    color: #4a5568;
    transition: color 0.2s;
    border: solid 1px #ccc;
    padding: 2px 13px 5px;
    border-radius: 8px;
}

.nav a:hover {
    color: #667eea;
}

.burger {
    display: none;
}

/* ==================== МОБИЛЬНОЕ МЕНЮ ==================== */
.mobile-menu {
    display: none;
}

.overlay {
    display: none;
}

/* ==================== ОСНОВНОЙ КОНТЕЙНЕР ==================== */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* ==================== КНОПКИ ==================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger {
    background: #e53e3e;
}

.btn-danger:hover {
    background: #c53030;
}

.btn-success {
    background: #48bb78;
}

.btn-success:hover {
    background: #38a169;
}

.btn-warning {
    background: #ed8936;
}

.btn-warning:hover {
    background: #dd6b20;
}

.btn-secondary {
    background: #718096;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-primary {
    background: #667eea;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ==================== КАРТОЧКИ ==================== */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ==================== ФОРМЫ ==================== */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #2d3748;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}

/* ==================== АЛЕРТЫ ==================== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-danger {
    background: #fff5f5;
    color: #c53030;
    border-left: 4px solid #e53e3e;
}

.alert-success {
    background: #f0fdf4;
    color: #22543d;
    border-left: 4px solid #48bb78;
}

.alert-warning {
    background: #fffbeb;
    color: #b45309;
    border-left: 4px solid #ed8936;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
}

/* ==================== ТАБЛИЦЫ ==================== */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

tr:hover {
    background: #f7fafc;
}

/* ==================== БЕЙДЖИ ==================== */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-paid {
    background: #c6f6d5;
    color: #22543d;
}

.badge-debt {
    background: #fed7d7;
    color: #c53030;
}

.badge-warning {
    background: #feebc8;
    color: #7b341e;
}

.badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.badge-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

/* ==================== СТАТИСТИКА ==================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
}

/* ==================== FAQ ==================== */
.faq-item {
    margin-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}

.faq-question {
    font-weight: bold;
    cursor: pointer;
    color: #2d3748;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s;
}

.faq-question:hover {
    color: #667eea;
}

.faq-answer {
    display: none;
    margin-top: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    color: #4a5568;
    line-height: 1.5;
}

/* ==================== ГАЛЕРЕЯ ==================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.gallery-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.gallery-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.gallery-caption {
    padding: 12px;
}

/* ==================== КАЛЕНДАРЬ ==================== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px;
    min-height: 80px;
    position: relative;
}

.calendar-day.today {
    background: #eff6ff;
    border: 2px solid #667eea;
}

.calendar-day.has-event {
    background: #fff9e6;
}

.calendar-day-number {
    font-weight: bold;
    margin-bottom: 5px;
}

.calendar-event {
    font-size: 10px;
    background: #667eea;
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== ЗАГРУЗКА ==================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
}

.loading-overlay.show {
    visibility: visible;
    opacity: 1;
}

.loading-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.loading-content .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.loading-content p {
    margin-top: 12px;
    color: #2d3748;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== ПРЕДПРОСМОТР ФОТО ==================== */
#photoPreview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* ==================== АНИМАЦИИ ==================== */
@keyframes slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in {
    animation: slide-in 0.3s ease-out;
}

.animate-fade-in {
    animation: fade-in 0.3s ease-out;
}

/* ==================== ПАГИНАЦИЯ ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pagination a {
    display: inline-block;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    text-decoration: none;
    color: #4a5568;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #667eea;
    color: white;
}

.pagination a.active {
    background: #667eea;
    color: white;
}

/* ==================== МОДАЛЬНЫЕ ОКНА ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: fade-in 0.2s ease-out;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-close {
    cursor: pointer;
    font-size: 24px;
    color: #a0aec0;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #4a5568;
}

/* ==================== ГРАФИКИ ==================== */
.chart-container {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin: 15px 0;
}

.chart-bar {
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.chart-bar-fill {
    background: #667eea;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

/* ==================== ПРОФИЛЬ ==================== */
.profile-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #667eea;
}

.garage-photo {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 768px) {
    .nav {
        display: none;
    }
    
    .burger {
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
        border: 1px solid #e2e8f0;
        font-size: 28px;
        cursor: pointer;
        color: #4a5568;
        padding: 0;
        border-radius: 12px;
        z-index: 1001;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        transition: all 0.2s;
        width: 52px;
        height: 48px;
        font-family: monospace;
        flex-shrink: 0;
        margin: 0;
        line-height: 1;
    }
    
    .burger:hover {
        background: #f1f5f9;
        transform: scale(1.02);
    }
    
    .mobile-menu {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background: white;
        flex-direction: column;
        padding: 80px 24px 24px 24px;
        gap: 8px;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
        transition: right 0.3s ease-out;
        z-index: 1000;
        overflow-y: auto;
        display: flex;
    }
    
    .mobile-menu.open {
        right: 0;
    }
    
    .mobile-menu a {
        padding: 12px 0;
        border-bottom: 1px solid #e2e8f0;
        font-size: 16px;
        font-weight: 500;
        color: #2d3748;
        text-decoration: none;
        display: block;
        transition: all 0.2s;
    }
    
    .mobile-menu a:hover {
        color: #667eea;
        padding-left: 8px;
    }
    
    .mobile-menu a:last-child {
        border-bottom: none;
    }
    
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        z-index: 999;
        cursor: pointer;
        display: block;
    }
    
    .overlay.open {
        opacity: 1;
        visibility: visible;
    }
    
    .container {
        padding: 0 15px;
    }
    
    th, td {
        padding: 8px;
    }
    
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .btn {
        padding: 8px 16px;
    }
}
.footer {
    margin-top: auto;
}

.footer a {
    color: #667eea;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}
/* ==================== ПЕЧАТЬ ==================== */
@media print {
    .header, .nav, .burger, .mobile-menu, .overlay, .btn, .pagination, .modal-close, .footer-actions {
        display: none !important;
    }
    
    body {
        background: white;
        padding: 0;
        margin: 0;
    }
    
    .container {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .btn, .btn-sm, .btn-primary, .btn-success, .btn-danger {
        display: none !important;
    }
    
    a {
        text-decoration: none;
        color: black;
    }
}

/* ==================== СКРОЛЛБАР ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ==================== ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ==================== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-muted {
    color: #718096;
}

.text-success {
    color: #48bb78;
}

.text-danger {
    color: #e53e3e;
}

.text-warning {
    color: #ed8936;
}

.text-primary {
    color: #667eea;
}

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }
.ml-3 { margin-left: 12px; }

.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.mr-3 { margin-right: 12px; }

.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }

.d-flex {
    display: flex;
}

.d-block {
    display: block;
}

.d-none {
    display: none;
}

.flex-wrap {
    flex-wrap: wrap;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.align-center {
    align-items: center;
}

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }

.w-100 {
    width: 100%;
}

.cursor-pointer {
    cursor: pointer;
}

.overflow-x-auto {
    overflow-x: auto;
}

.rounded {
    border-radius: 8px;
}

.shadow {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
/* ========== СТИЛИ ФОРУМА В СТИЛЕ TELEGRAM ========== */

/* Общий контейнер чата */
.forum-container, .chat-container {
    max-width: 800px;
    margin: 0 auto;
    background: #f0f2f5;
    border-radius: 12px;
    overflow: hidden;
}

/* Список сообщений */
.messages-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Отдельное сообщение */
.message-item {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

/* Своё сообщение (справа) */
.message-item.own {
    align-self: flex-end;
}

.message-item.own .message-bubble {
    background: #0084ff;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

/* Чужое сообщение (слева) */
.message-item.other {
    align-self: flex-start;
}

.message-item.other .message-bubble {
    background: white;
    color: #1c1c1e;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Пузырёк сообщения */
.message-bubble {
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

/* Информация о сообщении */
.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    color: #6c6c70;
    padding: 0 8px;
}

.message-item.own .message-meta {
    justify-content: flex-end;
}

/* Автор сообщения */
.message-author {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 4px;
}

.message-item.own .message-author {
    text-align: right;
}

/* Дата и время */
.message-date {
    font-size: 10px;
    color: #8e8e93;
}

/* Аватар */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e4e6eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-right: 8px;
}

.message-item.other {
    flex-direction: row;
    align-items: flex-start;
}

.message-item.other .message-content {
    flex: 1;
}

/* Форма ввода сообщения */
.message-form {
    background: white;
    padding: 12px 16px;
    border-top: 1px solid #e4e6eb;
    display: flex;
    gap: 10px;
}

.message-input {
    flex: 1;
    border: none;
    background: #f0f2f5;
    padding: 10px 16px;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
}

.message-input:focus {
    background: #e8eaed;
}

.send-btn {
    background: #0084ff;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #0073e6;
}

/* Список тем форума (как диалоги в Telegram) */
.topics-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.topic-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e4e6eb;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.topic-item:hover {
    background: #f0f2f5;
}

.topic-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
    color: white;
}

.topic-info {
    flex: 1;
}

.topic-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 15px;
}

.topic-preview {
    font-size: 13px;
    color: #6c6c70;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-meta {
    font-size: 11px;
    color: #8e8e93;
    text-align: right;
}

.topic-date {
    font-size: 11px;
    margin-bottom: 4px;
}

.topic-count {
    background: #e4e6eb;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

/* Новое сообщение - индикатор */
.topic-item.unread .topic-title {
    font-weight: 800;
    color: #0084ff;
}

/* Ввод темы */
.topic-form {
    background: white;
    padding: 20px;
    border-radius: 12px;
}

.topic-form input, .topic-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .message-item {
        max-width: 90%;
    }
    
    .topic-title {
        font-size: 14px;
    }
    
    .topic-preview {
        font-size: 12px;
    }
}

/* ========== TELEGRAM-СТИЛЬ ДЛЯ ФОРУМА ========== */

/* Контейнер чата */
.forum-container {
    max-width: 900px;
    margin: 0 auto;
    background: #f0f2f5;
    border-radius: 16px;
    overflow: hidden;
}

/* Список сообщений */
.messages-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 70vh;
    overflow-y: auto;
    background: #f0f2f5;
}

/* Отдельное сообщение */
.message-item {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

/* Своё сообщение (справа) */
.message-item.own {
    flex-direction: row-reverse;
}

/* Чужое сообщение (слева) */
.message-item.other {
    flex-direction: row;
}

/* Аватар */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

/* Контент сообщения */
.message-content {
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

/* Имя автора */
.message-author {
    font-size: 12px;
    font-weight: 600;
    color: #6c6c70;
    margin-bottom: 4px;
    margin-left: 8px;
}

.message-item.own .message-author {
    text-align: right;
    margin-right: 8px;
    margin-left: 0;
}

/* Пузырёк сообщения */
.message-bubble {
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
}

/* Чужое сообщение - белый пузырёк */
.message-item.other .message-bubble {
    background: white;
    color: #1c1c1e;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Своё сообщение - синий пузырёк */
.message-item.own .message-bubble {
    background: #0084ff;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

/* Мета-информация (время) */
.message-meta {
    font-size: 10px;
    color: #8e8e93;
    margin-top: 4px;
    margin-left: 8px;
}

.message-item.own .message-meta {
    text-align: right;
    margin-right: 8px;
    margin-left: 0;
}

/* Форма ввода сообщения */
.message-form {
    background: white;
    padding: 12px 16px;
    border-top: 1px solid #e4e6eb;
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-input {
    flex: 1;
    border: none;
    background: #f0f2f5;
    padding: 10px 16px;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    resize: none;
    font-family: inherit;
}

.message-input:focus {
    background: #e8eaed;
}

.send-btn {
    background: #0084ff;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #0073e6;
}

/* Список тем (диалогов) */
.topics-list {
    background: white;
    border-radius: 16px;
    overflow: hidden;
}

.topic-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e4e6eb;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.topic-item:hover {
    background: #f0f2f5;
}

.topic-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 12px;
    color: white;
    flex-shrink: 0;
}

.topic-info {
    flex: 1;
    min-width: 0;
}

.topic-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-preview {
    font-size: 13px;
    color: #6c6c70;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-author {
    font-size: 11px;
    color: #8e8e93;
    margin-top: 4px;
}

.topic-meta {
    text-align: right;
    flex-shrink: 0;
}

.topic-date {
    font-size: 11px;
    color: #8e8e93;
    margin-bottom: 4px;
}

.topic-count {
    background: #e4e6eb;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    display: inline-block;
}

/* Непрочитанная тема */
.topic-item.unread .topic-title {
    color: #0084ff;
    font-weight: 700;
}

/* Форма создания темы */
.topic-form {
    background: white;
    padding: 20px;
    border-radius: 16px;
}

.topic-form input,
.topic-form textarea,
.topic-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e4e6eb;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
    font-family: inherit;
}

.topic-form input:focus,
.topic-form textarea:focus,
.topic-form select:focus {
    outline: none;
    border-color: #0084ff;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .message-content {
        max-width: 85%;
    }
    
    .topic-title {
        font-size: 14px;
    }
    
    .topic-preview {
        font-size: 12px;
    }
    
    .forum-container {
        border-radius: 12px;
    }
}

/* Стили для кнопок */
.btn-primary {
    background: #0084ff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
}

.btn-primary:hover {
    background: #0073e6;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 20px;
    background: #e4e6eb;
    color: #1c1c1e;
    text-decoration: none;
}

/* Анимация появления сообщений */
.message-item {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Эффект пульсации для кнопки отправки */
.send-btn {
    position: relative;
    overflow: hidden;
}

.send-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.send-btn:active::after {
    width: 100%;
    height: 100%;
}

/* Индикатор набора текста */
.message-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.2);
}

/* Стиль для активного состояния */
.send-btn.active {
    background: #00a3ff;
    transform: scale(0.98);
}

/* Стили для личных сообщений (Telegram-стиль) */
.messages-container {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: #f0f2f5;
    border-radius: 16px;
    overflow: hidden;
}

.dialogs-list {
    width: 320px;
    background: white;
    border-right: 1px solid #e4e6eb;
    display: flex;
    flex-direction: column;
}

.dialogs-header {
    padding: 16px;
    border-bottom: 1px solid #e4e6eb;
    background: white;
}

.dialogs-items {
    flex: 1;
    overflow-y: auto;
}

.dialog-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f2f5;
}

.dialog-item:hover {
    background: #f0f2f5;
}

.dialog-item.active {
    background: #e4e6eb;
}

.dialog-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
}

.dialog-info {
    flex: 1;
    min-width: 0;
}

.dialog-name {
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unread-badge {
    background: #0084ff;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
}

.dialog-last-message {
    font-size: 13px;
    color: #6c6c70;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dialog-time {
    font-size: 11px;
    color: #8e8e93;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
}

.chat-header {
    background: white;
    padding: 16px;
    border-bottom: 1px solid #e4e6eb;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.no-chat-selected,
.empty-dialogs {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6c6c70;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .dialogs-list {
        width: 280px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

.badge {
    display: inline-block;
    background: #48bb78;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 8px;
}


/* Кнопки в ряд */
.btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.btn-group .btn,
.btn-group a.btn,
.btn-group button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 4px 8px;
    font-size: 14px;
}

/* Стили для кнопок в ряд (только в последней колонке) */
.table td:last-child {
    white-space: nowrap;
}
.table .btn {
    display: inline-block;
    margin: 0 2px;
    background: #f0f2f5;
    border: 1px solid #e4e6eb;
    padding: 4px 8px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
}
