/* Общие стили для сканера документов */

/* Информационная секция */
.info-section {
    background-color: #f8f9fa;
    margin-bottom: 20px;
}

.info-content {
    padding: 15px 20px;
}

.info-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-content li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.info-content li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #ffd000;
    font-weight: bold;
}

/* Поле ввода РНОКПП */
.rnokpp-input-wrapper {
    padding: 20px;
}

.rnokpp-input {
    width: 100%;
    max-width: 300px;
    padding: 15px;
    font-size: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    letter-spacing: 2px;
    font-weight: 600;
    transition: border-color 0.3s;
}

.rnokpp-input:focus {
    outline: none;
    border-color: #ffd000;
}

.rnokpp-input.error {
    border-color: #ff4444;
}

.rnokpp-input.valid {
    border-color: #44ff44;
}

/* Информация о документе */
.doc-info {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

/* Выбор типа документа */
.doc-type-selector {
    padding: 15px 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

.radio-label:hover {
    border-color: #ffd000;
    background-color: #fffef0;
}

.radio-label input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: #333;
}

/* Карточки документов с превью */
.doc-card {
    position: relative;
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
    min-width: 200px;
    flex: 1;
    max-width: 280px;
}

.doc-card input[type="radio"] {
    position: absolute;
    top: 15px;
    right: 15px;
    margin: 0;
    width: 20px;
    height: 20px;
}

.doc-card:has(input[type="radio"]:checked) {
    border-color: #ffd000;
    background-color: #fffef0;
    box-shadow: 0 2px 8px rgba(255, 208, 0, 0.3);
}

.doc-preview {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
}

.doc-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doc-label strong {
    font-size: 16px;
    color: #333;
}

.doc-label small {
    font-size: 13px;
    color: #666;
    font-weight: normal;
}

/* Кнопки загрузки */
.upload-buttons {
    padding: 15px 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-camera,
.btn-file,
.btn-upload {
    min-width: 200px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Кнопка загрузки файла - вторичный стиль */
.btn-upload {
    background-color: #fff;
    color: #333;
    border: 2px solid #e0e0e0;
}

.btn-upload:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.btn-file {
    position: relative;
    cursor: pointer;
}

.file-input {
    display: none;
}

/* Превью фотографий */
.photo-preview {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    min-height: 50px;
}

/* Для одиночных документов (ІПН, заява, наказ) - 1 в ряд */
#ipn-preview,
#agreement-preview,
#nakaz-preview {
    grid-template-columns: 1fr;
    max-width: 300px;
}

.photo-item {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background-color: #f5f5f5;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: white;
}

/* PDF превью */
.pdf-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 15px;
    background-color: #fff;
}

.pdf-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.pdf-name {
    font-size: 12px;
    color: #666;
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

.photo-item-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.photo-item-remove:hover {
    background-color: rgba(255, 0, 0, 1);
}

.photo-item-number {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Сообщения об ошибках */
.error-message {
    display: block;
    color: #ff4444;
    font-size: 14px;
    padding: 0 20px 10px;
    min-height: 20px;
}

/* Сообщение валидации над кнопкой */
.validation-message {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 15px;
    color: #856404;
    font-size: 15px;
    line-height: 1.5;
    width: 100%;
}

.validation-message ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.validation-message li {
    margin: 5px 0;
}

/* Контейнер кнопки - вертикальное расположение */
.documents__form-btns {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Прогресс бар */
.progress-wrapper {
    padding: 30px 20px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    max-width: 500px;
    height: 30px;
    background-color: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin: 0 auto 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd000, #ffed4e);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.progress-text {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Модальное окно камеры */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.camera-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.camera-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.camera-header h3 {
    margin: 0;
    font-size: 20px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: #333;
}

.camera-body {
    padding: 20px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.camera-body video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.camera-body:active {
    opacity: 0.8;
}

.camera-body:active .camera-frame {
    border-color: #ffd000;
    transform: scale(0.98);
    transition: all 0.1s ease;
}

.camera-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

/* Оверлей з рамкою для камери */
.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.camera-frame {
    position: relative;
    width: 70%;
    aspect-ratio: 3 / 4;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

.frame-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 4px solid #ffd000;
}

.frame-corner.top-left {
    top: -4px;
    left: -4px;
    border-right: none;
    border-bottom: none;
    border-top-left-radius: 8px;
}

.frame-corner.top-right {
    top: -4px;
    right: -4px;
    border-left: none;
    border-bottom: none;
    border-top-right-radius: 8px;
}

.frame-corner.bottom-left {
    bottom: -4px;
    left: -4px;
    border-right: none;
    border-top: none;
    border-bottom-left-radius: 8px;
}

.frame-corner.bottom-right {
    bottom: -4px;
    right: -4px;
    border-left: none;
    border-top: none;
    border-bottom-right-radius: 8px;
}

.camera-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 12px 20px;
    border-radius: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 10;
    max-width: 80%;
    line-height: 1.4;
}

/* Адаптивные стили */
@media (max-width: 768px) {
    .rnokpp-input {
        max-width: 100%;
        font-size: 18px;
    }

    .doc-type-selector {
        flex-direction: column;
    }

    .doc-card {
        max-width: 100%;
    }

    .upload-buttons {
        flex-direction: column;
    }

    .btn-camera,
    .btn-file {
        width: 100%;
        min-width: auto;
    }

    /* Превью остается 2 в ряд на мобильных для паспортов */
    .photo-preview {
        gap: 10px;
    }
    
    #ipn-preview,
    #agreement-preview {
        max-width: 100%;
    }

    .camera-modal-content {
        max-height: 95vh;
    }

    .camera-body {
        padding: 10px;
    }

    .camera-frame {
        width: 80%;
    }

    .camera-hint {
        font-size: 13px;
        padding: 10px 16px;
    }

    .frame-corner {
        width: 25px;
        height: 25px;
        border-width: 3px;
    }
}

@media (max-width: 480px) {
    .info-content li {
        font-size: 14px;
    }
}

/* Анимация успеха */
@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.documents__success {
    animation: successPulse 0.5s ease-in-out;
}

/* Состояние disabled для кнопки */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loader */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Предупреждение о горизонтальной ориентации */
.landscape-warning {
    display: none; /* Скрыто по умолчанию */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 20;
    justify-content: center;
    align-items: center;
}

.landscape-warning-content {
    text-align: center;
    color: white;
    padding: 30px;
    max-width: 400px;
}

.rotate-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: rotatePhone 2s ease-in-out infinite;
}

.landscape-warning-content h3 {
    font-size: 24px;
    margin-bottom: 15px;
    font-weight: 600;
}

.landscape-warning-content p {
    font-size: 16px;
    line-height: 1.5;
    color: #e0e0e0;
}

/* Анимация поворота телефона */
@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-90deg); }
    50% { transform: rotate(-90deg); }
    75% { transform: rotate(0deg); }
}

/* Стили для landscape ориентации на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    /* Показываем предупреждение о неправильной ориентации */
    .landscape-warning {
        display: flex !important;
    }
    
    /* Блокируем клики на видео в landscape режиме */
    .camera-body {
        pointer-events: none;
    }
    
    /* Разрешаем клики на предупреждении (чтобы можно было закрыть модалку) */
    .landscape-warning {
        pointer-events: auto;
    }
}

/* Скрываем header камеры для упрощения интерфейса */
.camera-header {
    display: none !important;
}

/* Убираем верхний отступ у camera-body так как header скрыт */
.camera-body {
    border-radius: 12px 12px 0 0;
}

/* Чекбокс відмови від ІПН */
.refusal-checkbox {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
}

.refusal-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
}

.refusal-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Текст предупреждения */
.warning-text {
    color: #d97706;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 0;
    display: block;
    line-height: 1.5;
    font-size: 14px;
}

