/* ============================================
   style.css — Единый стиль для всего сайта
   Версия 2.0 (с шапкой, профилем, уведомлениями)
   ============================================ */

/* ===== 1. ГЛОБАЛЬНЫЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 2. КОНТЕЙНЕРЫ ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    width: 100%;
}

/* ===== 3. ЗАГОЛОВКИ ===== */
h1 {
    color: #1a1a2e;
    font-size: 28px;
    margin-bottom: 4px;
}
h2 {
    color: #1a1a2e;
    font-size: 22px;
    margin-bottom: 12px;
}
h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 10px;
}

.page-subtitle {
    color: #6c757d;
    margin-bottom: 24px;
    font-size: 14px;
}

/* ===== 4. ШАПКА (header.php) ===== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-link {
    color: #1a1a2e;
    font-weight: 600;
    text-decoration: none;
    font-size: 15px;
}
.user-link:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.user-company {
    color: #4f46e5;
    font-weight: 600;
    background: rgba(79, 70, 229, 0.1);
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.role-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.role-badge.admin {
    background: #8b5cf6;
    color: white;
}
.role-badge.owner {
    background: #4f46e5;
    color: white;
}
.role-badge.manager {
    background: #10b981;
    color: white;
}
.role-badge.user {
    background: #f59e0b;
    color: white;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-icon {
    padding: 8px 12px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
    position: relative;
}
.btn-icon:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: #4f46e5;
    transform: translateY(-1px);
}
.btn-icon.active {
    background: rgba(79, 70, 229, 0.15);
    border-color: #4f46e5;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* ===== 5. КНОПКИ ===== */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    color: white;
    text-align: center;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn-primary {
    background: #4f46e5;
}
.btn-primary:hover {
    background: #4338ca;
}
.btn-success {
    background: #10b981;
}
.btn-success:hover {
    background: #059669;
}
.btn-danger {
    background: #ef4444;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-warning {
    background: #f59e0b;
}
.btn-warning:hover {
    background: #d97706;
}
.btn-secondary {
    background: #6c757d;
}
.btn-secondary:hover {
    background: #5a6268;
}
.btn-outline {
    background: transparent;
    color: #4f46e5;
    border: 2px solid #4f46e5;
}
.btn-outline:hover {
    background: #4f46e5;
    color: white;
}
.btn-sm {
    padding: 4px 14px;
    font-size: 12px;
    border-radius: 6px;
}
.btn-block {
    display: block;
    width: 100%;
}

/* ===== 6. ТАБЛИЦЫ ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 14px;
}
th {
    background: #f0f2f5;
    font-weight: 600;
    color: #333;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #e0e0e0;
}
td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}
tr:hover {
    background: #f8f9fa;
}
.clickable-row {
    cursor: pointer;
}
.clickable-row:hover {
    background: #f0f2f5;
}

/* ===== 7. СТАТУСЫ ===== */
.status {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.status.pending {
    background: #fef3c7;
    color: #92400e;
}
.status.approved {
    background: #d1fae5;
    color: #065f46;
}
.status.rejected {
    background: #fee2e2;
    color: #991b1b;
}
.status.distributed {
    background: #dbeafe;
    color: #1e40af;
}
.status.accepted {
    background: #d1fae5;
    color: #065f46;
}
.status.closed {
    background: #e5e7eb;
    color: #374151;
}

/* ===== 8. КАРТОЧКИ ===== */
.card {
    background: #f8f9fa;
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 16px;
}
.card-light {
    background: #f8f9fa;
    padding: 16px 20px;
    border-radius: 10px;
}

/* ===== 9. ФОРМЫ ===== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 140px;
}
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    background: white;
    transition: all 0.2s;
    width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-inline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* ===== 10. СООБЩЕНИЯ (flash) ===== */
.message {
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid;
}
.message-success {
    background: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}
.message-error {
    background: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}
.message-warning {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

/* ===== 11. КОММЕНТАРИИ ===== */
.comment-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}
.comment {
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}
.comment .meta {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}
.comment .text {
    font-size: 14px;
}
.comment-form textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
}

/* ===== 12. УТИЛИТЫ ===== */
.text-muted {
    color: #6c757d;
}
.text-sm {
    font-size: 13px;
}
.text-center {
    text-align: center;
}
.text-right {
    text-align: right;
}
.mt-8 {
    margin-top: 8px;
}
.mt-16 {
    margin-top: 16px;
}
.mb-8 {
    margin-bottom: 8px;
}
.mb-12 {
    margin-bottom: 12px;
}
.mb-20 {
    margin-bottom: 20px;
}
.flex {
    display: flex;
}
.flex-wrap {
    flex-wrap: wrap;
}
.items-center {
    align-items: center;
}
.justify-between {
    justify-content: space-between;
}
.gap-8 {
    gap: 8px;
}
.gap-12 {
    gap: 12px;
}

/* ===== 13. ПРОФИЛЬ ===== */
.profile-card {
    background: #f8f9fa;
    padding: 24px 28px;
    border-radius: 12px;
    max-width: 500px;
    margin: 20px 0;
}
.profile-field {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #eef2f7;
}
.profile-field:last-child {
    border-bottom: none;
}
.profile-field .label {
    width: 120px;
    font-weight: 600;
    color: #555;
    flex-shrink: 0;
}
.profile-field .value {
    flex: 1;
    color: #1a1a2e;
}
.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ===== 14. УВЕДОМЛЕНИЯ ===== */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #eef2f7;
    transition: background 0.2s;
}
.notification-item:hover {
    background: #f8f9fa;
}
.notification-item.unread {
    background: #f0f4ff;
    border-left: 3px solid #4f46e5;
	font-weight: 600; /* ← ДОБАВИТЬ ЭТУ СТРОКУ */
}
.notification-item .icon {
    font-size: 20px;
    margin-top: 2px;
}
.notification-item .content {
    flex: 1;
}
.notification-item .content .text {
    font-size: 14px;
    color: #1a1a2e;
}
.notification-item .content .time {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}
.notification-item .mark-read {
    background: none;
    border: none;
    color: #4f46e5;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
}
.notification-item .mark-read:hover {
    text-decoration: underline;
}
.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.notifications-header .btn {
    font-size: 13px;
    padding: 6px 16px;
}

/* ===== 15. ПОИСК В СООБЩЕНИЯХ ===== */
.search-in-messages {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 10px;
}
.search-in-messages input[type="text"] {
    flex: 1;
    min-width: 180px;
    padding: 8px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}
.search-in-messages input[type="text"]:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.search-in-messages select {
    padding: 8px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    background: white;
}
.search-in-messages .btn {
    padding: 8px 20px;
    font-size: 13px;
}

/* ===== 16. ФИЛЬТРЫ ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-bar .btn-filter {
    padding: 8px 20px;
    border-radius: 20px;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    text-decoration: none;
    color: #333;
}
.filter-bar .btn-filter:hover {
    border-color: #4f46e5;
}
.filter-bar .btn-filter.active {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

/* ===== 17. ПУСТЫЕ СОСТОЯНИЯ ===== */
.empty {
    text-align: center;
    color: #999;
    padding: 40px 0;
}
.empty .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ===== 18. ССЫЛКИ ===== */
a {
    color: #4f46e5;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ===== 19. РАЗДЕЛЫ ===== */
.section {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 2px solid #eef2f7;
}

/* ===== 20. СПИСОК ПАПОК ===== */
.folder-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.folder-tag {
    background: #e0e7ff;
    padding: 4px 14px;
    border-radius: 16px;
    font-size: 12px;
    color: #4f46e5;
}

/* ===== 21. ПРАВА (PERMISSION TAGS) ===== */
.perm-tag {
    display: inline-block;
    background: #e0e7ff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    margin: 2px;
    color: #4f46e5;
}
.perm-tag.empty {
    background: #f3f4f6;
    color: #999;
}

/* ===== 22. РЕДАКТИРУЕМЫЕ ФОРМЫ ===== */
.edit-form {
    display: none;
    margin-top: 10px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 10px;
}
.edit-form.show {
    display: block;
}

/* ===== 23. СЕТКИ ===== */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}
.info-item {
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
}
.info-item .label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}
.info-item .value {
    font-size: 16px;
    font-weight: 500;
}
.message-text {
    background: #f8f9fa;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    white-space: pre-wrap;
}

/* ===== 24. КНОПКИ ДЕЙСТВИЙ ===== */
.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

/* ===== 25. DISTRIBUTE FORM ===== */
.distribute-form {
    background: #f8f9fa;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 16px 0;
    width: 100%;
}
.distribute-form select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    min-width: 200px;
}

/* ===== 26. REJECT FORM ===== */
.reject-form {
    background: #fee2e2;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 16px 0;
    border: 2px solid #ef4444;
    width: 100%;
}
.reject-form textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

/* ===== 27. PERMISSION GRID ===== */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
    margin: 12px 0;
}
.perm-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.perm-grid label:hover {
    background: #f0f2f5;
}
.perm-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4f46e5;
    cursor: pointer;
}

/* ===== 28. БЭДЖ СЧЁТЧИКА ===== */
.count-badge {
    background: #e0e7ff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #4f46e5;
}

/* ===== 29. ССЫЛКА НАЗАД ===== */
.back-link {
    display: inline-block;
    margin-bottom: 16px;
    color: #4f46e5;
    text-decoration: none;
}
.back-link:hover {
    text-decoration: underline;
}

/* ===== 30. АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 16px;
        border-radius: 12px;
    }

    .top-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }

    .user-info {
        justify-content: center;
    }

    .header-actions {
        justify-content: center;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .form-group {
        min-width: 100%;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 6px 8px;
    }

    .search-in-messages {
        flex-direction: column;
        align-items: stretch;
    }

    .search-in-messages input[type="text"],
    .search-in-messages select {
        min-width: 100%;
    }

    .profile-field {
        flex-direction: column;
        gap: 4px;
    }
    .profile-field .label {
        width: 100%;
    }

    .notifications-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .header-actions .btn-icon {
        font-size: 16px;
        padding: 6px 10px;
    }
    .btn {
        font-size: 12px;
        padding: 8px 16px;
    }
    h1 {
        font-size: 22px;
    }
}