/* components.css - минимальные кастомные стили поверх Bootstrap */

/* CSS Custom Properties для консистентности */
:root {
    --transition-duration: 0.3s;
    --border-radius: 0.5rem;
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 25px rgba(0, 0, 0, 0.15);
    --z-index-dropdown: 9999;
    --z-index-modal: 1050;
    --z-index-notification: 9999;
}

/* Анимация пульсации для индикаторов */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Адаптивность для навигационных табов на мобильных */
@media (max-width: 768px) {
    .nav-tabs {
        flex-direction: column;
    }
    
    .nav-tabs .nav-item {
        width: 100%;
    }
}

/* Bootstrap утилиты для карточек */
.border-transparent {
    border-color: transparent !important;
}

.transition-all {
    transition: all var(--transition-duration) ease;
}

.shadow-success {
    box-shadow: 0 4px 20px rgba(var(--bs-success-rgb), 0.2) !important;
}



/* Profile Files Upload Styles */
.progress-bar {
    position: relative;
    min-width: 2em;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

#uploadDetails {
    font-size: 0.875rem;
    color: #6c757d;
}

#uploadStatus {
    margin-top: 1rem;
}

/* File Cards */
.file-card {
    transition: all var(--transition-duration) ease-in-out;
    will-change: transform, box-shadow;
    position: relative;
}

.file-actions {
    opacity: 0;
    transition: opacity var(--transition-duration) ease-in-out;
    position: relative;
}

.file-card:hover .file-actions {
    opacity: 1;
}

/* File List Table Styles */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table.table-hover tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
    cursor: pointer;
}

.file-item {
    transition: background-color var(--transition-duration) ease-in-out;
}

.file-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

.file-item td {
    vertical-align: middle;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.file-item:last-child td {
    border-bottom: none;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    padding: 0.75rem;
    vertical-align: middle;
}

.table thead th:first-child {
    border-top-left-radius: var(--border-radius);
}

.table thead th:last-child {
    border-top-right-radius: var(--border-radius);
}

/* Sortable header styles */
.sortable-header {
    transition: background-color var(--transition-duration) ease-in-out;
    user-select: none;
}

.sortable-header:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
}

.sortable-header:active {
    background-color: rgba(var(--bs-primary-rgb), 0.2);
}

.sortable-header .d-flex {
    transition: transform var(--transition-duration) ease-in-out;
}



.sortable-header i {
    transition: color var(--transition-duration) ease-in-out;
}

.sortable-header:hover i {
    color: var(--bs-primary) !important;
}

/* File icon in table */
.file-item td:first-child i {
    transition: transform var(--transition-duration) ease-in-out;
}


/* Dropdown in table */
.file-item .dropdown {
    opacity: 0.7;
    transition: opacity var(--transition-duration) ease-in-out;
}

.file-item:hover .dropdown {
    opacity: 1;
}

/* Responsive table */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .file-item td {
        padding: 0.5rem;
    }
    
    .table thead th {
        padding: 0.5rem;
    }
}

/* Dropdown positioning fixes */
.file-actions .dropdown-menu {
    position: absolute !important;
    z-index: var(--z-index-dropdown);
    transform: none !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    margin-top: 0.125rem;
    min-width: 10rem;
}

.file-actions .dropdown-menu.dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
}

/* Ensure dropdown doesn't get clipped by parent containers */
.file-card .dropdown {
    position: relative;
}

/* Fix for Bootstrap dropdown positioning */
.dropdown-menu.show {
    display: block !important;
}

/* Ensure proper stacking context */
.card-body {
    position: relative;
    z-index: 1;
}

.file-actions .dropdown {
    z-index: 2;
}

/* Table dropdown positioning fixes */
.table .dropdown {
    position: relative;
}

.table .dropdown-menu {
    position: absolute !important;
    z-index: 99999 !important;
    transform: none !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    margin-top: 0.125rem;
    min-width: 10rem;
}

.table .dropdown-menu.dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
}

/* Ensure table cells don't clip dropdowns */
.table td {
    position: relative;
    overflow: visible;
}

.table th {
    position: relative;
    overflow: visible;
}

/* Fix for table overflow */
.table-responsive {
    overflow: visible;
}

.table {
    position: relative;
}

/* Maximum z-index for dropdowns */
.dropdown-menu {
    z-index: 99999 !important;
}

.dropdown-menu.show {
    z-index: 99999 !important;
}

/* Ensure dropdowns are above everything */
.table .dropdown-menu,
.file-actions .dropdown-menu,
.dropdown-menu {
    z-index: 99999 !important;
    position: absolute !important;
}

/* Prevent dropdown from closing when hovering over other elements */
.dropdown-menu.show {
    pointer-events: auto;
}

.dropdown-menu.show:hover {
    display: block !important;
}

/* Smooth transitions for dropdown */
.dropdown-menu {
    transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
}

.dropdown-menu:not(.show) {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Prevent hover effects from interfering with dropdown */
.file-item:hover .dropdown-menu.show {
    display: block !important;
}

/* Ensure dropdown stays open when hovering over menu items */
.dropdown-menu .dropdown-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
}

/* File Card Title - улучшенное отображение названий */
.file-card .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #212529;
    flex: 1;
    min-width: 0;
}

.file-card .card-title:hover {
    color: #0d6efd;
}

/* File Info - размер и тип файла */
.file-card .text-muted {
    font-size: 0.8rem;
    line-height: 1.2;
}

.file-card .text-muted i {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Upload Modal */
.upload-zone {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: all var(--transition-duration) ease-in-out;
    cursor: pointer;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
}

.upload-zone:focus-within {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.upload-zone.dragover {
    border-color: #0d6efd;
    background-color: #e7f3ff;
    transform: scale(1.02);
}

.upload-zone-content,
.upload-zone-dragover {
    width: 100%;
}

.upload-zone-dragover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(13, 110, 253, 0.1);
    border-radius: var(--border-radius);
    z-index: 10;
}

.upload-zone.dragover .upload-zone-content {
    opacity: 0.3;
}

.upload-zone.dragover .upload-zone-dragover {
    display: flex !important;
}

/* Drag & Drop Animation */
@keyframes dragPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.upload-zone.dragover {
    animation: dragPulse 1s infinite;
}

/* Selected Files List */
.selected-files-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    scrollbar-width: thin;
    scrollbar-color: #dee2e6 #f8f9fa;
}

.selected-files-list::-webkit-scrollbar {
    width: 6px;
}

.selected-files-list::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.selected-files-list::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
}

.selected-files-list::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.selected-file-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border-radius: 0.25rem;
    border: 1px solid #e9ecef;
    transition: all var(--transition-duration) ease-in-out;
    gap: 0.75rem;
}

.selected-file-item:hover {
    background-color: #f8f9fa;
    border-color: #0d6efd;
}

.selected-file-item:last-child {
    margin-bottom: 0;
}



.remove-file-btn {
    opacity: 0.7;
    transition: opacity var(--transition-duration) ease-in-out;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.remove-file-btn:hover {
    opacity: 1;
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.selected-file-item:hover .remove-file-btn {
    opacity: 1;
}

.file-exists {
    border-color: #ffc107;
    background-color: #fff3cd;
}

.file-exists:hover {
    border-color: #ffca2c;
    background-color: #fff8dc;
}



.selected-file-item:hover .file-actions {
    opacity: 1;
}

.replace-file-btn {
    opacity: 0.8;
    transition: opacity var(--transition-duration) ease-in-out;
}

.replace-file-btn:hover {
    opacity: 1;
    background-color: #198754;
    border-color: #198754;
    color: white;
}

.file-info {
    min-width: 0;
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    line-height: 1.2;
    color: #212529;
    flex: 1;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}

.file-name:hover {
    color: #0d6efd;
}

.badge-wrapper {
    flex-shrink: 0;
    margin: 0 !important;
    padding: 0 !important;
}

/* Убираем все отступы слева у flex элементов */
.file-info .d-flex {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.file-info .d-flex > * {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.file-info .d-flex > *:not(:first-child) {
    margin-left: 0.25rem !important;
}

/* Агрессивное удаление отступов */
.selected-file-item .file-name,
.selected-file-item .badge-wrapper,
.selected-file-item .file-info,
.selected-file-item .file-info > * {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Переопределяем Bootstrap отступы */
.selected-file-item .d-flex {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.selected-file-item .d-flex > * {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.selected-file-item .d-flex > *:not(:first-child) {
    margin-left: 0.25rem !important;
}

/* Специальный класс для полного удаления отступов */
.no-left-margin {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.no-left-margin > * {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.no-left-margin > *:not(:first-child) {
    margin-left: 0.25rem !important;
}

.file-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.min-width-0 {
    min-width: 0;
}

/* Drag & Drop Zone States */
.upload-zone.has-files {
    border-color: #198754;
    background-color: #f8fff9;
}

.upload-zone.has-files .upload-zone-content {
    color: #198754;
}

/* File Type Icons */
.file-icon {
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

.file-icon.pdf { color: #dc3545; }
.file-icon.doc, .file-icon.docx { color: #0d6efd; }
.file-icon.txt { color: #6c757d; }
.file-icon.jpg, .file-icon.jpeg, .file-icon.png, .file-icon.gif { color: #198754; }
.file-icon.zip, .file-icon.rar { color: #fd7e14; }

/* Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-index-notification);
    min-width: 300px;
    max-width: 400px;
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
}

/* Скрываем нежелательные алерты на странице профиля */
.dashboard-profile-page .alert:not(.notifications-container .alert) {
    display: none !important;
}

/* Скрываем алерты, которые могут появиться в начале страницы */
.container-fluid > .alert:first-child,
.container > .alert:first-child {
    display: none !important;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .file-card,
    .upload-zone,
    .selected-file-item,
    .file-actions {
        transition: none;
    }
    
    .upload-zone.dragover {
        animation: none;
    }
}

/* Focus styles for better accessibility */
.btn:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.dropdown-item:focus {
    background-color: #e9ecef;
    color: #212529;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .file-actions {
        opacity: 1;
    }
    
    .upload-zone {
        padding: 1rem;
        min-height: 150px;
    }
    
    .notification-container {
        left: 10px;
        right: 10px;
        min-width: auto;
    }
    
    .selected-files-list {
        max-height: 150px;
    }
    
    /* Мобильные стили для карточек файлов */
    .file-card .card-title {
        font-size: 0.9rem;
        line-height: 1.2;
    }
    
    .file-card .text-muted {
        font-size: 0.75rem;
    }
    
    .file-card .card-body {
        padding: 0.75rem;
    }
    
    /* Мобильные стили для списка файлов */
    .file-name {
        font-size: 0.85rem;
    }
    
    .selected-file-item {
        padding: 0.5rem;
    }
}


/* High contrast mode support */
@media (prefers-contrast: high) {
    .upload-zone {
        border-width: 3px;
    }
    
    .file-card {
        border-width: 2px;
    }
    
    .selected-file-item {
        border-width: 2px;
    }
}

/* Print styles */
@media print {
    .upload-zone,
    .file-actions,
    .notification-container {
        display: none !important;
    }
    
    .file-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
} 

/* Убираем отступы слева только у названий файлов */
.selected-file-item .file-name {
    margin-left: 0 !important;
    padding-left: 0 !important;
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
}

/* Убираем отступы слева у плашки "Новый" */
.selected-file-item .badge-wrapper {
    margin-left: 0.25rem !important;
    padding-left: 0 !important;
}

/* Убираем центрирование у flex контейнера с названием файла */
.selected-file-item .d-flex.align-items-center {
    justify-content: flex-start !important;
    align-items: center !important;
}

/* Принудительно выравниваем название файла по левому краю */
.selected-file-item .file-name.text-truncate {
    text-align: left !important;
    display: block !important;
    width: 100% !important;
}

/* Password Field Styling */
.form-floating.position-relative {
    overflow: hidden;
}

.password-toggle-btn {
    z-index: 10;
    transition: all 0.2s ease-in-out;
    border-radius: 0.375rem;
    padding: 0.375rem;
    margin-right: 0.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
}

.password-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
    color: #0d6efd !important;
}

.password-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.password-toggle-btn:focus:not(:focus-visible) {
    box-shadow: none;
}

.password-toggle-btn i {
    font-size: 1rem;
    line-height: 1;
}

/* Validation styling */
.form-control.is-valid {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

.form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Remove validation borders from password fields to prevent button interference */
.form-floating input[type="password"].is-valid,
.form-floating input[type="password"].is-invalid {
    border-color: #dee2e6;
    box-shadow: none;
}

.form-floating input[type="password"].is-valid:focus,
.form-floating input[type="password"].is-invalid:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Field validation indicators */
.form-control.is-valid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23198754'%3e%3cpath d='M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    padding-right: 2.5rem;
}

.form-control.is-invalid {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23dc3545'%3e%3cpath d='M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z'/%3e%3cpath d='M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    padding-right: 2.5rem;
}

/* Password field with toggle button - adjust padding for validation icon */
.form-floating.position-relative .form-control.is-valid,
.form-floating.position-relative .form-control.is-invalid {
    padding-right: calc(3.5em + 0.75rem);
    background-position: right calc(2.5em + 0.75rem) center;
}

/* Hide validation feedback messages */
.invalid-feedback,
.valid-feedback {
    display: none !important;
}

/* Center form fields vertically */
.form-floating.h-100.d-flex.align-items-center {
    min-height: 58px;
}

.form-floating.h-100.d-flex.align-items-center .form-control {
    height: 58px;
}

/* Form field container */
.form-floating {
    position: relative;
}

/* Delete button styling */
.btn-outline-danger.btn-sm {
    transition: all 0.2s ease-in-out;
}

.btn-outline-danger.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

/* Account row alignment */
.row.g-3.align-items-center {
    align-items: center !important;
    min-height: 58px;
}

.col-md-2 .d-flex,
.col-md-1 .d-flex {
    height: 100%;
    align-items: center;
}

/* Ensure buttons are properly aligned */
.test-smtp-btn,
.btn-outline-danger.btn-sm {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}



/* Compact layout for account rows */
.border-bottom.p-4 {
    padding: 1.5rem !important;
}

.border-bottom.p-4 .row {
    margin: 0;
}

.border-bottom.p-4 .col-md-5,
.border-bottom.p-4 .col-md-4,
.border-bottom.p-4 .col-md-2,
.border-bottom.p-4 .col-md-1 {
    padding: 0 0.5rem;
}

/* Better spacing for form fields */
.form-floating.h-100.d-flex.align-items-center {
    min-height: 58px;
    margin: 0;
}

.form-floating.h-100.d-flex.align-items-center .form-control {
    height: 58px;
    margin: 0;
}

/* Account block styling */
.border-bottom.p-4.mb-3 {
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    background-color: #f8f9fa;
    transition: all 0.2s ease-in-out;
}

.border-bottom.p-4.mb-3:hover {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.1);
}

/* Better alignment for form elements */
.row.g-3.align-items-center {
    align-items: center !important;
    min-height: 58px;
}

.col-auto .badge {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Equal spacing between elements */
.col-md-4 {
    padding: 0 0.75rem;
}

.col-md-1 {
    padding: 0 0.5rem;
}

/* Modern form field styling */
.form-control {
    border-radius: 0.5rem;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease-in-out;
}

.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-floating > .form-control {
    padding: 1.25rem 0.75rem;
}

.form-floating > label {
    padding: 1.25rem 0.75rem;
}

/* Equal width fields */
.col-md-5 {
    flex: 0 0 40%;
    max-width: 40%;
}

/* Delete button in its own column */
.col-md-1 .btn-outline-danger.btn-sm {
    width: 100%;
    min-width: 38px;
    padding: 0.375rem;
}

.col-md-1 .d-flex {
    justify-content: center;
}

/* Test result styling */
.test-result {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    display: block;
    min-height: 1.2rem;
    line-height: 1.2;
}

.test-result.small {
    font-size: 0.7rem;
}

.test-result .text-success {
    color: #198754 !important;
}

.test-result .text-danger {
    color: #dc3545 !important;
}

.test-result .text-muted {
    color: #6c757d !important;
}

.col-md-2 .d-flex.flex-column {
    justify-content: center;
    min-height: 80px;
}

.col-md-2 .d-flex.flex-column .test-smtp-btn {
    margin-bottom: 0.5rem !important;
}

/* --- MOBILE ADAPTIVE PATCH --- */
@media (max-width: 576px) {
  .container-fluid, .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .table-responsive {
    overflow-x: auto;
  }
  table {
    min-width: 600px;
  }
  td, th {
    word-break: break-all;
    text-break: auto;
  }
  .d-flex > * {
    min-width: 0;
  }
  .text-truncate, .badge, .file-status, .file-name, .selected-file-item {
    max-width: 100vw;
    min-width: 0;
    word-break: break-all;
    overflow-wrap: break-word;
  }
  input, select, textarea {
    max-width: 100%;
    min-width: 0;
  }
}

/* --- MOBILE PATCH: profile-files table --- */
@media (max-width: 576px) {
  .table-responsive {
    overflow-x: auto;
  }
  table {
    min-width: 600px;
  }
  td, th {
    word-break: break-all;
    text-break: auto;
    max-width: 120px;
  }
  .table .text-truncate {
    max-width: 120px;
    min-width: 0;
    word-break: break-all;
    overflow-wrap: break-word;
  }
  .d-flex > * {
    min-width: 0;
  }
}

/* --- TABLE/FLEX PATCH до 1200px --- */
@media (max-width: 1200px) {
  .table-responsive {
    overflow-x: auto;
  }
  table {
    min-width: 600px;
  }
  td, th {
    word-break: break-all;
    text-break: auto;
    max-width: 200px;
  }
  .table .text-truncate {
    max-width: 200px;
    min-width: 0;
    word-break: break-all;
    overflow-wrap: break-word;
  }
  .d-flex > * {
    min-width: 0;
  }
}

/* --- JOBS OVERVIEW ADAPTIVE PATCH --- */
.jobs-overview .card {
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    min-width: 0;
}
.jobs-overview .card-header, .jobs-overview .card-body, .jobs-overview .card-footer {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
.jobs-overview .btn-lg, .jobs-overview .btn {
    font-size: 1.1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
}
.jobs-overview .progress {
    min-width: 0;
    overflow: hidden;
    border-radius: 0.5rem;
}
.jobs-overview .progress-bar {
    font-size: 0.95rem;
    min-width: 2em;
}
.jobs-overview .display-6, .jobs-overview .display-4 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}
.jobs-overview .fw-bold {
    font-weight: 700 !important;
}
.jobs-overview .gap-3, .jobs-overview .gap-4 {
    gap: 1.5rem !important;
}
@media (max-width: 768px) {
    .jobs-overview .card-header, .jobs-overview .card-body, .jobs-overview .card-footer {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .jobs-overview .btn-lg, .jobs-overview .btn {
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }
    .jobs-overview .display-6, .jobs-overview .display-4 {
        font-size: 1.3rem;
    }
    .jobs-overview .row-cols-1 > .col {
        width: 100%;
        max-width: 100%;
    }
    .jobs-overview .card {
        margin-bottom: 1rem;
    }
}
@media (max-width: 576px) {
    .jobs-overview .container-fluid, .jobs-overview .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    .jobs-overview .card-header, .jobs-overview .card-body, .jobs-overview .card-footer {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    .jobs-overview .btn-lg, .jobs-overview .btn {
        font-size: 0.95rem;
        padding: 0.5rem 0.75rem;
    }
    .jobs-overview .display-6, .jobs-overview .display-4 {
        font-size: 1.1rem;
    }
}

.profile-jobs .table-responsive {
    border-radius: var(--border-radius);
    overflow: auto;
    background: #fff;
}

.profile-jobs .table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    transition: background 0.2s;
}

.profile-jobs .table thead th.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.profile-jobs .table thead th.sortable-header.active {
    background: #e9ecef;
    color: #0d6efd;
}

.profile-jobs .table thead th .sort-indicator {
    margin-left: 0.25em;
    font-size: 1em;
    vertical-align: middle;
    color: #adb5bd;
    transition: color 0.2s;
}

.profile-jobs .table thead th.active .sort-indicator {
    color: #0d6efd;
}

.profile-jobs .table tbody tr {
    transition: background 0.2s, box-shadow 0.2s;
}

.profile-jobs .table tbody tr.fade-in {
    animation: fadeInRow 0.4s;
}

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

.profile-jobs .table tbody tr.no-results-row td {
    background: #f8f9fa;
    color: #adb5bd;
    text-align: center;
    font-size: 1.1em;
    padding: 2.5em 0;
}

.profile-jobs .search-loading-indicator {
    position: absolute;
    right: 1.5em;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    color: #0d6efd;
    font-size: 1.2em;
    display: none;
}

.profile-jobs .search-loading-indicator.active {
    display: inline-block;
}

.profile-jobs .table tbody tr:hover {
    background: #e9ecef;
}

@media (max-width: 768px) {
    .profile-jobs .table-responsive {
        font-size: 0.95em;
    }
    .profile-jobs .table thead th, .profile-jobs .table td {
        padding: 0.5em 0.4em;
    }
    .profile-jobs .table thead th {
        font-size: 0.95em;
    }
}

/* --- DASHBOARD PROFILE CARDS: одинаковая высота --- */
.equal-height {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.square-btn {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 0.375rem;
}

/* --- CONVERSATION CHAT: современный дизайн --- */
.conversation-detail {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 1rem;
    overflow: hidden;
}

.conversation-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-bottom: none;
}

.conversation-header .bg-primary {
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.conversation-header h5 {
    color: white;
    font-weight: 600;
}

.conversation-header .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.conversation-messages {
    background: #f8f9fa;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    padding: 1.5rem;
}

.message-bubble {
    border-radius: 1rem;
    padding: 1rem;
    position: relative;
    max-width: 85%;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-outgoing {
    margin-left: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.message-outgoing .badge {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white;
}

.message-outgoing .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.message-incoming {
    margin-right: auto;
    background: white;
    border: 1px solid #e9ecef;
}

.message-incoming .badge {
    background: #f8f9fa !important;
    color: #6c757d;
}

.message-body {
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.message-body img {
    max-width: 100%;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

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

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

/* Стили для вложений */
.message-bubble .btn-outline-secondary {
    border-radius: 0.75rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    color: #495057;
}

.message-bubble .btn-outline-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

/* Форма отправки */
#compose-form {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 1.5rem;
}

#compose-form .form-control {
    border-radius: 0.75rem;
    border: 1px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

#compose-form .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

#compose-form textarea {
    min-height: 100px;
    resize: vertical;
}

/* Стили для загрузки файлов в форме */
#compose-form .file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
    margin-bottom: 1rem;
}

#compose-form .file-upload-area:hover {
    border-color: #667eea;
    background-color: #f0f2ff;
}

#compose-form .file-upload-area.dragover {
    border-color: #667eea;
    background-color: #e8ecff;
    transform: scale(1.02);
}

#compose-form .file-input {
    display: none;
}

#compose-form .file-upload-label {
    cursor: pointer;
    color: #667eea;
    font-weight: 500;
    margin: 0;
}

#compose-form .file-upload-label:hover {
    color: #5a67d8;
}

#compose-form .selected-files {
    margin-top: 1rem;
}

#compose-form .selected-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
}

#compose-form .selected-file-item .file-name {
    flex: 1;
    margin-right: 0.5rem;
    font-size: 0.875rem;
}

#compose-form .selected-file-item .remove-file {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

#compose-form .selected-file-item .remove-file:hover {
    background-color: #dc3545;
    color: white;
}

#send-btn {
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

#send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#send-btn:disabled {
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

/* Статусы сообщений */
.message-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.message-status.sent {
    color: #28a745;
}

.message-status.pending {
    color: #ffc107;
}

.message-status.failed {
    color: #dc3545;
}

/* Скроллбар */
.conversation-messages::-webkit-scrollbar {
    width: 6px;
}

.conversation-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.conversation-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.conversation-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Адаптивность */
@media (max-width: 768px) {
    .conversation-messages {
        padding: 1rem;
        max-height: 400px;
    }
    
    .message-bubble {
        max-width: 95%;
        padding: 0.75rem;
    }
    
    .conversation-header {
        padding: 1rem;
    }
    
    #compose-form {
        padding: 1rem;
    }
}

/* Индикатор загрузки */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6c757d;
}

.loading-indicator .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.5rem;
}

/* Пустое состояние */
.empty-conversation {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-conversation i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Анимация обновления данных */
.updating {
    animation: updatePulse 0.4s ease-in-out;
}

@keyframes updatePulse {
    0% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.05);
    }
    100% { 
        opacity: 1; 
        transform: scale(1);
    }
}

/* Анимация для progress bars */
.progress-bar.updating {
    animation: progressUpdate 0.5s ease-in-out;
}

@keyframes progressUpdate {
    0% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.6; 
    }
    100% { 
        opacity: 1; 
    }
}

/* Profile Stats Animation */
.stats-value.updating {
    animation: statsUpdate 0.4s ease-in-out;
}

@keyframes statsUpdate {
    0% {
        transform: scale(1);
        color: inherit;
    }
    50% {
        transform: scale(1.1);
        color: var(--bs-primary);
        font-weight: 700;
    }
    100% {
        transform: scale(1);
        color: inherit;
    }
}

.stats-percent.updating {
    animation: percentUpdate 0.4s ease-in-out;
}

@keyframes percentUpdate {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
        font-weight: 600;
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Profile Jobs Table Animation */
.profile-jobs .table tbody tr.updating {
    animation: rowUpdate 0.4s ease-in-out;
}

@keyframes rowUpdate {
    0% {
        background-color: inherit;
    }
    50% {
        background-color: rgba(var(--bs-primary-rgb), 0.05);
    }
    100% {
        background-color: inherit;
    }
}

.profile-jobs .badge.updating {
    animation: badgeUpdate 0.4s ease-in-out;
}

@keyframes badgeUpdate {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
} 
