body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header, footer {
    background-color: #222;
    color: #fff;
    padding: 1rem;
}

main {
    flex-grow: 1;
    padding: 1rem;
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 1.5rem;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
}

footer ul {
    list-style: none;
    padding: 0;
}

footer ul li {
    margin-bottom: 0.5rem;
}
.site-footer {
    background-color: #222;
    color: #ccc;
    padding: 1rem 2rem;
    font-size: 0.9rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.footer-left {
    font-weight: bold;
}

.footer-nav a {
    color: #ccc;
    margin-right: 1rem;
    text-decoration: none;
}

.footer-nav a:hover {
    text-decoration: underline;
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-box {
    background: #fff;
    padding: 2rem 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-box form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-box input {
    padding: 0.6rem;
    font-size: 1rem;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.login-box button {
    padding: 0.7rem;
    font-size: 1rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.login-box button:hover {
    background-color: #0056b3;
}

.login-box .error {
    color: #dc3545;
    font-size: 0.9rem;
    text-align: center;
}


/* 🎯 Общий стиль для всех таблиц */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.data-table th,
.data-table td {
    border: 1px solid #ddd;
    padding: 8px;
    vertical-align: top;
}

.data-table th {
    background-color: #f4f4f4;
    text-align: left;
}

.data-table tbody tr:hover {
    background-color: #fafafa;
}

/* Кнопки */
button {
    padding: 6px 10px;
    margin-right: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #e0e0e0;
}

/* Delete */
.delete-btn {
    color: #fff;
    background-color: #d9534f;
}

.delete-btn:hover {
    background-color: #c9302c;
}

/* Общая обёртка модалки */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1000;
    animation: overlay-fade-in 0.35s ease;
}
.modal-overlay.closing {
    animation: overlay-fade-out 0.3s ease forwards;
}

@keyframes overlay-fade-in {
    from { background: rgba(0,0,0,0); }
    to { background: rgba(0,0,0,0.35); }
}
@keyframes overlay-fade-out {
    from { background: rgba(0,0,0,0.35); }
    to { background: rgba(0,0,0,0); }
}

/* Контейнер модалки — панель слева */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 50vw;
    height: 100%;
    background: #fff;
    padding: 2rem;
    border-radius: 0;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    box-sizing: border-box;
    position: relative;
    animation: slide-in-left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.closing .modal {
    animation: slide-out-left 0.3s cubic-bezier(0.5, 0, 0.75, 0) forwards;
}

@keyframes slide-in-left {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}
@keyframes slide-out-left {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    z-index: 1;
}
.modal-close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

@media (max-width: 900px) {
    .modal {
        width: 80vw;
    }
}

/* Заголовок */
.modal h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Общий стиль формы */
.modal form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Поля ввода */
.modal .input,
.modal textarea,
.modal select {
    width: 100%;
    padding: 8px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    box-sizing: border-box;
}

.subject-autocomplete {
    position: relative;
}
.subject-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.subject-option {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.93rem;
}
.subject-option:hover {
    background: #eef2ff;
}

/* Кнопки */
.modal button {
    padding: 8px 12px;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Кнопка отправки */
.modal button[type="submit"] {
    background-color: #007bff;
    color: white;
}

.modal button[type="submit"]:hover {
    background-color: #0056b3;
}

/* Кнопка отмены */
.modal button[type="button"] {
    background-color: #f0f0f0;
    color: #333;
}

.modal button[type="button"]:hover {
    background-color: #ddd;
}

/* Таблица пользователей в модалке */
.modal .modal-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    table-layout: auto;
}
.modal-table-scroll {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}


.modal .modal-table th,
.modal .modal-table td {
    white-space: nowrap;
    padding: 6px 12px;
    border: 1px solid #ddd;
    text-align: left;
}

.modal .modal-table th {
    background-color: #f9f9f9;
    font-weight: bold;
}
/* В CSS */
.message-row.sent {
    background-color: rgba(0, 255, 0, 0.1);
}
.message-row.failed {
    background-color: rgba(255, 0, 0, 0.1);
}

.loader {
    text-align: center;
    margin-top: 1rem;
    font-size: 1.2rem;
}
.modal-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 10px;
}

.spinner {
    border: 4px solid #ccc;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fade-enter-active, .fade-leave-active {
    transition: opacity 0.5s ease;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
}
.fade-enter-to, .fade-leave-from {
    opacity: 1;
}

.toast {
    position: fixed;
    top: 6rem;
    right: 1rem;
    background: #333;
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    opacity: 0.95;
    z-index: 9999;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
/* Типы */
.toast.success {
    background-color: #28a745;
    color: #fff;
}

.toast.error {
    background-color: #dc3545;
    color: #fff;
}

.toast-icon {
    font-size: 1.2rem;
}
.msg-failed-note {
    font-size: 0.8rem;
    color: #999;
    margin-top: 4px;
    opacity: 0.8;
}
.inline-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid #ccc;
    border-top: 3px solid #666;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 5px;
}
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f9f9f9;
    cursor: pointer;
}
.pagination button.active {
    background-color: #222;
    color: #fff;
    border-color: #222;
}
.full-modal-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 10px;
}
.full-modal-loader-overlay .spinner {
    border: 4px solid #ccc;
    border-top: 4px solid #222;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 0.8s linear infinite;
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    padding: 0 4px;
    align-items: flex-end;
}
.tab-btn {
    padding: 7px 18px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #666;
    position: relative;
}
.tab-btn.active {
    color: #222;
    background: #fff;
    font-weight: 600;
    padding: 9px 20px;
    border-color: #ddd;
}
.tab-btn:hover:not(.active) {
    background: #e8e8e8;
    color: #333;
}
.tab-badge {
    display: inline-block;
    background: #007bff;
    color: #fff;
    border-radius: 10px;
    padding: 0 6px;
    font-size: 0.75rem;
    margin-left: 4px;
    vertical-align: middle;
}
.row-from-group {
    background-color: rgba(0, 123, 255, 0.06);
}
.groups-select {
    margin-top: 0.25rem;
}
.groups-select > label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}
.groups-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}
.group-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-weight: normal;
}

/* Chat button in users list */
.chat-btn {
    display: inline-block;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1rem;
    transition: background-color 0.2s;
    cursor: pointer;
}
.chat-btn:hover {
    background-color: #e0e0e0;
}

/* Message status icons in messages table */
.msg-status {
    font-size: 0.8rem;
    margin-left: 4px;
}
.msg-status-delivered {
    color: #28a745;
}
.msg-status-read {
    color: #007bff;
}
.msg-status-pending {
    color: #999;
}

