/* common.css — общие стили для index.php и admin.php.
   Подключается ПЕРЕД page-специфичным css (index.css / admin.css),
   которые задают только уникальные для страницы вещи. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

h1, h2, h3 { color: #4c1d95; margin-bottom: 20px; }

#sound-toggle {
    background: #6d28d9;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
}

/* Табы */
.tab {
    padding: 10px 20px;
    cursor: pointer;
    color: #4c1d95;
    font-weight: 500;
    background: #f5f3ff;
    border-radius: 8px 8px 0 0;
}
.tab.active {
    background: #ede9fe;
    border-bottom: 3px solid #8b5cf6;
}

/* Файлы / сообщения — общий каркас карточки */
.file-item, .message-item {
    background: #faf5ff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e9d5ff;
    color: black;
}
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.file-date {
    font-size: 12px;
    color: #6b7280;
}

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

.message-header {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #4c1d95;
    margin-bottom: 5px;
}
.message-text { margin: 8px 0; color: black; }
.message-footer {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
}

/* Кнопки */
button {
    padding: 8px 16px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}
button:hover { background: #6d28d9; }
.btn-delete { background: #ef4444; }
.btn-delete:hover { background: #dc2626; }

.reply-box {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.reply-box textarea {
    flex: 1;
    padding: 10px;
    border: 2px solid #e9d5ff;
    border-radius: 8px;
    resize: none;
    font-family: inherit;
}

/* Прогресс загрузки файлов */
.progress-container {
    margin: 10px 0;
    background: #e9d5ff;
    border-radius: 8px;
    overflow: hidden;
}
.progress-bar {
    width: 0%;
    height: 8px;
    background: #ef4444;
    transition: width 0.3s, background 0.4s ease;
}
.progress-text {
    font-size: 12px;
    margin-top: 5px;
    color: #4c1d95;
}
.upload-item {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 12px;
    word-break: break-word;
    transition: background 0.4s ease, border-color 0.4s ease;
}
.upload-item.upload-success {
    background: #dcfce7;
    border-color: #86efac;
}
.upload-item.upload-success .progress-bar {
    background: #22c55e;
}
.upload-item.upload-error {
    background: #fee2e2;
    border-color: #ef4444;
}
.upload-status-icon { margin-left: 6px; }

/* Панель массовых действий (выбрать всё / скачать архивом / удалить) */
.bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 15px;
}
.bulk-toolbar label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #4c1d95;
    cursor: pointer;
}

@media (max-width: 768px) {
    .file-item { flex-direction: column; align-items: flex-start; }
    .file-info { margin-bottom: 10px; flex-wrap: wrap; }
}

/* Красивые уведомления вместо системных alert() — крупные, по центру экрана */
#toast-container {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.toast {
    pointer-events: none;
    background: white;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px 28px;
    width: 15cm;
    height: 3cm;
    max-width: 92vw;
    box-sizing: border-box;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    border: 3px solid #8b5cf6;
    background: #f5f3ff;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: scale(1); pointer-events: auto; }
.toast-success { border-color: #22c55e; background: #f0fdf4; }
.toast-error { border-color: #ef4444; background: #fef2f2; }
.toast-info { border-color: #8b5cf6; background: #f5f3ff; }
.toast-icon { font-size: 32px; flex-shrink: 0; }
.toast-message { line-height: 1.35; }
@media (max-width: 768px) and (orientation: portrait) {
    .toast {
        width: 100vw;
        height: 50vw;
        max-width: 100vw;
        border-radius: 0;
        font-size: 16px;
        padding: 16px;
    }
    .toast-icon { font-size: 28px; }
}

/* Красивое модальное подтверждение вместо confirm() */
#confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 20, 50, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
#confirm-overlay.show { display: flex; }
.confirm-box {
    background: white;
    border-radius: 14px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    text-align: center;
}
.confirm-box p {
    margin: 0 0 20px;
    font-size: 15px;
    color: #1f2937;
}
.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.confirm-buttons button { flex: 1; padding: 10px; }
.confirm-btn-cancel { background: #e5e7eb; color: #374151; }
.confirm-btn-cancel:hover { background: #d1d5db; }
