/* ========================================
   Модернизированный интерфейс загрузки файлов
   Стилистика сайта el-sirius.ru
   ======================================== */

/* Контейнер загрузки файла */
.file-upload-container {
    padding: 30px;
    background: #ffffff;
    border-radius: 10px;
}

/* Зона загрузки */
.upload-zone {
    border: 3px dashed #2768A0;
    border-radius: 10px;
    padding: 60px 30px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-zone:hover {
    border-color: #114171;
    background: linear-gradient(135deg, #e9ecef 0%, #f8f9fa 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 104, 160, 0.1);
}

.upload-zone.drag-over {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
    border-style: solid;
}

.upload-icon {
    margin-bottom: 20px;
}

.upload-icon i {
    font-size: 80px;
    color: #2768A0;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.upload-title {
    color: #2768A0;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 24px;
}

.upload-subtitle {
    color: #6c757d;
    margin: 15px 0;
    font-size: 16px;
}

.upload-hint {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 5px;
    border-left: 4px solid #ffc107;
}

.upload-hint small {
    display: block;
    line-height: 1.6;
}

/* Карточка файла */
.file-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #2768A0;
    border-radius: 12px;
    padding: 20px 25px;
    margin-top: 20px;
    box-shadow: 0 4px 16px rgba(39, 104, 160, 0.15);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

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

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
}

.file-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.file-icon i {
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.file-details {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-name {
    font-weight: 600;
    color: #2768A0;
    margin: 0;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.file-size {
    color: #6c757d;
    margin: 0;
    font-size: 14px;
    white-space: nowrap;
    font-weight: 500;
}

.file-status {
    flex-shrink: 0;
}

.file-status .badge {
    font-size: 12px;
    padding: 6px 12px;
    font-weight: 600;
}

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

.file-actions .btn {
    min-width: 150px;
}

/* Информационная панель */
.info-panel {
    margin-top: 30px;
}

.info-panel .alert {
    border-left: 4px solid #0dcaf0;
    background-color: #e7f6fd;
}

.info-panel .alert i {
    margin-right: 8px;
}

.info-panel ul {
    padding-left: 0;
    list-style-type: none;
    margin-bottom: 0;
}

.info-panel ul li {
    margin-bottom: 10px;
    padding-left: 30px;
    position: relative;
    line-height: 1.6;
}

.info-panel ul li::before {
    content: "\F012C";
    font-family: "Material Design Icons";
    position: absolute;
    left: 0;
    color: #2768A0;
    font-weight: bold;
    font-size: 18px;
    top: 0;
}

/* Предпросмотр позиций */
.positions-preview {
    margin-top: 30px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.positions-preview .card {
    border: 2px solid #2768A0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.positions-preview .card-title {
    color: #2768A0;
    font-weight: 600;
    margin-bottom: 20px;
}

.positions-preview .card-title i {
    margin-right: 8px;
}

.positions-preview .table {
    margin-bottom: 0;
}

.positions-preview .table thead {
    background: linear-gradient(135deg, #2768A0 0%, #114171 100%);
    color: white;
}

.positions-preview .table thead th {
    border: none;
    padding: 12px;
    font-weight: 600;
}

.positions-preview .table tbody tr {
    transition: background-color 0.2s ease;
}

.positions-preview .table tbody tr:hover {
    background-color: rgba(39, 104, 160, 0.05);
}

.positions-preview .table tbody td {
    padding: 12px;
    vertical-align: middle;
}

/* Прогресс поиска */
.search-progress {
    margin-top: 30px;
    animation: fadeIn 0.5s ease;
    position: relative;
    z-index: 100;
}

.search-progress .card {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 2px solid #2768A0;
    background: white;
}

.search-progress .progress {
    border-radius: 10px;
    overflow: hidden;
    background-color: #e9ecef;
}

.search-progress .progress-bar {
    font-size: 14px;
    line-height: 25px;
    background: linear-gradient(135deg, #2768A0 0%, #114171 100%);
}

.search-progress .spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .file-upload-container {
        padding: 20px;
    }
    
    .upload-zone {
        padding: 40px 20px;
    }
    
    .upload-icon i {
        font-size: 60px;
    }
    
    .upload-title {
        font-size: 20px;
    }
    
    .file-card {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .file-info {
        width: 100%;
    }
    
    .file-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .file-name {
        max-width: 100%;
    }
    
    .file-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .file-actions .btn {
        width: 100%;
    }
}

/* Скрыть стандартные элементы Dropzone */
#upload-form .dz-preview {
    display: none !important;
}

#upload-form .dz-message {
    margin: 0;
}

/* Дополнительные улучшения */
.btn-primary {
    background: linear-gradient(135deg, #2768A0 0%, #114171 100%);
    border: none;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #114171 0%, #2768A0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 104, 160, 0.3);
}

.btn-outline-primary {
    color: #2768A0;
    border-color: #2768A0;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background-color: #2768A0;
    border-color: #2768A0;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 104, 160, 0.2);
}

.btn-danger {
    transition: all 0.3s ease;
}

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

/* Скрываем стандартное сообщение Dropzone, так как используем свой дизайн */
.dropzone .dz-default.dz-message {
    display: none !important;
}

/* Убираем лишние отступы у Dropzone */
.dropzone {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    min-height: auto !important;
}

/* Скрываем превью Dropzone, так как используем свою карточку файла */
.dropzone .dz-preview {
    display: none !important;
}

/* ============================================
   СОВРЕМЕННЫЙ ДИЗАЙН ВКЛАДОК
   ============================================ */

/* Контейнер вкладок */
.nav-tabs {
    border-bottom: none !important;
    gap: 12px;
    margin-bottom: 0 !important;
    display: flex;
    justify-content: flex-start;
    padding-left: 20px;
    align-items: flex-end;
}

/* Элемент вкладки */
.nav-tabs .nav-item {
    margin: 0;
}

/* Ссылка вкладки */
.nav-tabs .nav-item .badge {
    position: relative;
    padding: 14px 28px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 12px 12px 0 0 !important;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    border: 2px solid transparent !important;
    box-shadow: none !important;
    text-transform: none;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    margin-bottom: 0 !important;
}

/* Добавляем иконки через псевдоэлементы */
.nav-tabs .nav-item:first-child .badge::before {
    content: "\f002";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 14px;
}

.nav-tabs .nav-item:last-child .badge::before {
    content: "\f15b";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 14px;
}

/* Эффект подсветки снизу */
.nav-tabs .nav-item .badge::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2768A0 0%, #4bbbce 100%);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px 3px 0 0;
}

/* Hover эффект */
.nav-tabs .nav-item .badge:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: rgba(255, 255, 255, 0.95) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Активная вкладка */
.nav-tabs .nav-item .badge.active {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
    color: #2768A0 !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 
        0 -2px 8px rgba(0, 0, 0, 0.1),
        0 4px 16px rgba(39, 104, 160, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
    transform: translateY(0);
}

.nav-tabs .nav-item .badge.active::after {
    transform: scaleX(1);
}

/* Анимация при клике */
.nav-tabs .nav-item .badge:active {
    transform: translateY(0) scale(0.98);
}

/* Контент вкладок */
.tab-content {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: 0;
}

.tab-content .tab-pane {
    padding: 30px;
    border-radius: 12px !important;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .nav-tabs {
        gap: 8px;
        padding-left: 15px;
    }
    
    .nav-tabs .nav-item .badge {
        padding: 12px 20px !important;
        font-size: 14px !important;
    }
    
    /* Скрываем текст, оставляем только иконки на очень маленьких экранах */
    @media (max-width: 480px) {
        .nav-tabs {
            padding-left: 10px;
        }
        
        .nav-tabs .nav-item .badge {
            padding: 12px 16px !important;
            font-size: 0 !important;
        }
        
        .nav-tabs .nav-item .badge::before {
            font-size: 18px;
            margin: 0;
        }
    }
}

/* Плавная анимация при переключении вкладок */
.tab-pane {
    animation: fadeInUp 0.4s ease-out;
}

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

/* ============================================
   СОВРЕМЕННАЯ ФОРМА ПОИСКА ПО ЗАПРОСУ
   ============================================ */

.search-form-modern {
    padding: 20px;
}

.search-input-group {
    position: relative;
}

.search-input-group .form-label {
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-input-group .form-label i {
    font-size: 16px;
}

.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #2768A0;
    font-size: 20px;
    pointer-events: none;
    z-index: 2;
}

.input-with-icon .form-control {
    padding-left: 45px;
    padding-right: 45px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: white;
    font-size: 15px;
    height: 50px;
}

.input-with-icon .form-control:focus {
    border-color: #2768A0;
    box-shadow: 0 0 0 0.2rem rgba(39, 104, 160, 0.15);
    background: white;
}

.input-with-icon .form-control::placeholder {
    color: #adb5bd;
}

.clear-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 22px;
    color: #adb5bd;
    z-index: 2;
    transition: all 0.2s ease;
}

.clear-icon:hover {
    color: #dc3545;
    transform: translateY(-50%) scale(1.1);
}

.search-btn {
    height: 50px;
    background: linear-gradient(135deg, #2768A0 0%, #114171 100%);
    border: none;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(39, 104, 160, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.search-btn:hover {
    background: linear-gradient(135deg, #114171 0%, #2768A0 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 104, 160, 0.4);
}

.search-btn:active {
    transform: translateY(0);
}

.search-btn i {
    font-size: 20px;
}

.search-limit-info {
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f8ff 100%);
    border: 2px solid #2768A0;
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #2768A0;
}

.search-limit-info i {
    font-size: 20px;
}

.search-limit-info strong {
    color: #114171;
    font-size: 16px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .search-form-modern {
        padding: 15px;
    }
    
    .search-input-group .form-label {
        font-size: 13px;
    }
    
    .input-with-icon .form-control {
        height: 45px;
        font-size: 14px;
    }
    
    .search-btn {
        height: 45px;
        font-size: 15px;
    }
    
    .search-limit-info {
        font-size: 13px;
        padding: 10px 15px;
    }
}

/* Анимация при вводе */
.input-with-icon .form-control:not(:placeholder-shown) {
    border-color: #2768A0;
}

/* Эффект при загрузке */
.search-btn.loading {
    pointer-events: none;
    opacity: 0.8;
    cursor: not-allowed;
}

.search-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

.search-btn.loading i,
.search-btn:disabled i.mdi-loading {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   КОЛОНКА ПОКУПКА В ТАБЛИЦЕ РЕЗУЛЬТАТОВ
   ============================================ */

.purchase-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    padding: 8px 0;
    flex-wrap: wrap;
}

.quantity-input-wrapper {
    display: flex;
    align-items: center;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
}

.quantity-input-wrapper:hover {
    border-color: #2768A0;
    box-shadow: 0 2px 8px rgba(39, 104, 160, 0.15);
}

.qty-btn {
    width: 32px;
    height: 38px;
    border: none;
    background: #f8f9fa;
    color: #2768A0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    padding: 0;
}

.qty-btn:hover {
    background: #2768A0;
    color: white;
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-input {
    width: 60px !important;
    height: 38px !important;
    border: none !important;
    text-align: center;
    font-weight: 600;
    color: #2768A0;
    padding: 0 8px !important;
    font-size: 15px;
    display: inline !important;
}

.qty-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.btn-add-basket {
    background: linear-gradient(135deg, #2768A0 0%, #114171 100%) !important;
    border: none !important;
    color: white !important;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(39, 104, 160, 0.2);
}

.btn-add-basket:hover {
    background: linear-gradient(135deg, #114171 0%, #2768A0 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 104, 160, 0.3);
}

.btn-add-basket:active {
    transform: translateY(0);
}

.btn-add-basket.added {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

.btn-add-basket.added:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%) !important;
}

.btn-add-basket i {
    font-size: 18px;
}

/* Адаптивность для таблицы */
@media (max-width: 1400px) {
    .btn-text {
        display: none;
    }
    
    .btn-add-basket {
        padding: 10px 14px;
    }
}

@media (max-width: 768px) {
    .purchase-cell {
        flex-direction: column;
        gap: 8px;
    }
    
    .quantity-input-wrapper {
        width: 100%;
    }
    
    .btn-add-basket {
        width: 100%;
        justify-content: center;
    }
    
    .btn-text {
        display: inline;
    }
}
