/* Основные стили */
#contract-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-section {
    margin-bottom: 30px;
    padding: 25px;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    background: #fafbfc;
    transition: all 0.3s ease;
}

.form-section:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.form-section h3 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 12px;
    font-weight: 600;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: #f8fafc;
}

/* ✅ УСИЛЕННЫЙ ИСПРАВЛЕННЫЙ СТИЛЬ: для скрытия реального поля input file */
.hidden-file-input {
    /* Агрессивное скрытие для обеспечения программного клика */
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* Стили для загрузки документов */
.document-upload-group {
    background: #fff;
    border: 2px dashed #e1e5e9;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.document-upload-group:hover {
    border-color: #3498db;
    background: #f8fafc;
}

.document-upload-group.document-has-files {
    border-color: #27ae60;
    border-style: solid;
    background: #f8fff9;
}

.document-upload-group.document-required:not(.document-has-files) {
    border-color: #e74c3c;
    background: #fef7f7;
}

.document-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.document-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3498db;
    color: white;
    border-radius: 8px;
    flex-shrink: 0;
}

.document-info {
    flex: 1;
}

.document-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 15px;
}

.document-hint {
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
}

/* Расстояния между кнопками */
.upload-controls {
    display: flex;
    gap: 15px; 
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px; 
}

.upload-btn,
.add-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.upload-btn {
    background: #3498db;
    color: white;
}

.upload-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.add-more-btn {
    background: #27ae60;
    color: white;
}

.add-more-btn:hover {
    background: #219a52;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.upload-icon,
.add-icon {
    flex-shrink: 0;
}

/* Стили для списка файлов */
.file-list {
    margin-top: 15px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

.file-item:hover {
    border-color: #3498db;
    background: #f8fafc;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 11px;
    color: #7f8c8d;
}

.remove-file {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-size: 12px;
}

.remove-file:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* ... (остальные стили для формы и страницы скачивания не изменены) */
/* Стили для чекбокса */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 2px;
    transform: scale(1.2);
}

.checkbox-group label {
    font-weight: normal;
    margin-bottom: 0;
    line-height: 1.5;
}

.checkbox-group a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.checkbox-group a:hover {
    text-decoration: underline;
}

/* Стили для кнопки отправки */
.form-submit {
    margin-top: 30px;
    text-align: center;
}

#submit-documents {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 16px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#submit-documents:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.4);
}

#submit-documents:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Сообщения формы */
#form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    animation: slideIn 0.5s ease;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

.contract-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

/* Стили для страницы скачивания */
#contract-download-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.download-info {
    background: linear-gradient(135deg, #e8f4f8, #f0f7fb);
    border: 1px solid #d4e3ea;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.download-info p {
    margin: 5px 0;
    color: #34495e;
}

.documents-list h3 {
    color: #2c3e50;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.document-group {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 15px;
    background: #fafbfc;
}

.document-group h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #3498db;
    font-weight: 600;
    padding-bottom: 5px;
    border-bottom: 1px solid #ecf0f1;
}

.group-files {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.document-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #d4e3ea;
    border-radius: 6px;
    background: #fff;
    transition: all 0.2s ease;
}

.document-item:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.document-item .document-icon {
    background: none;
    color: #3498db;
    font-size: 20px;
    width: 28px;
    height: 28px;
    margin-right: 10px;
}

.document-item .document-info {
    flex: 1;
    min-width: 0;
}

.document-item .document-name {
    font-weight: 500;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-item .document-size {
    font-size: 11px;
    color: #7f8c8d;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: #3498db;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.download-btn:hover {
    background: #2980b9;
}

.download-actions {
    margin-top: 30px;
    text-align: center;
}

#download-all {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#download-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(39, 174, 96, 0.3);
}

#download-all:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#download-progress {
    margin-top: 15px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background-color: #ecf0f1;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background-color: #2ecc71;
    width: 0%;
    border-radius: 5px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    #contract-form-wrapper,
    #contract-download-wrapper {
        padding: 15px;
        margin: 10px;
    }
    
    .form-section {
        padding: 20px;
    }
    
    .document-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .document-item .document-icon {
        margin-right: 0;
    }
    
    .upload-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .upload-btn,
    .add-more-btn {
        justify-content: center;
    }
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.7s ease-out forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Добавим в конец файла */
#required-fields-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    animation: slideIn 0.5s ease;
}

#required-fields-error strong {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
}

#required-fields-error ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

#required-fields-error li {
    margin-bottom: 5px;
    font-size: 14px;
}

.document-required {
    border-color: #e74c3c !important;
    background: #fef7f7 !important;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}