/**
 * LOGIC DVLA Validator - Styles
 */

/* Validation container */
#dvla-validation-container {
    margin-top: 20px;
    padding: 20px;
    border: 2px solid #ddd;
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#dvla-validation-container h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

/* Vehicle info display */
.vehicle-info {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.vehicle-info p {
    margin: 8px 0;
    font-size: 15px;
    line-height: 1.5;
}

.vehicle-info strong {
    color: #555;
    display: inline-block;
    width: 120px;
}

/* Buttons */
#confirm-reg-btn {
    margin-left: 10px;
    padding: 10px 20px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

#confirm-reg-btn:hover {
    background: #005a87;
}

#confirm-reg-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.dvla-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

#dvla-confirm-btn {
    padding: 12px 24px;
    background: #28a745 !important;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s;
}

#dvla-confirm-btn:hover {
    background: #218838 !important;
}

#dvla-reject-btn {
    padding: 12px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

#dvla-reject-btn:hover {
    background: #545b62;
}

/* Messages */
.dvla-error {
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
}

.dvla-success {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 15px;
    border-radius: 6px;
    margin: 10px 0;
    font-weight: 600;
}

/* Validated field styling */
input.dvla-validated {
    border-color: #28a745 !important;
    background-color: #f0fff4 !important;
}

input.dvla-validated:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25) !important;
}

/* Success message that appears inline */
.dvla-inline-success {
    display: inline-block;
    margin-left: 10px;
    color: #28a745;
    font-weight: 600;
    animation: fadeIn 0.3s ease-in;
}

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

/* Mobile responsiveness */
@media (max-width: 768px) {
    .dvla-actions {
        flex-direction: column;
    }
    
    .dvla-actions button {
        width: 100%;
    }
    
    .vehicle-info strong {
        display: block;
        width: 100%;
        margin-bottom: 2px;
    }
    
    #confirm-reg-btn {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
}

/* Loading state */
#confirm-reg-btn.checking {
    position: relative;
    padding-right: 35px;
}

#confirm-reg-btn.checking::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Disabled form fields styling */
.dvla-disabled {
    opacity: 0.5 !important;
    pointer-events: none !important;
    background-color: #f5f5f5 !important;
}

/* Please confirm message box */
#dvla-please-confirm-msg {
    animation: fadeIn 0.3s ease-in;
}

/* Readonly reg field styling */
input[name="veh_reg"][readonly] {
    background-color: #f0fff4 !important;
    border-color: #28a745 !important;
    color: #155724 !important;
}

/* When form is disabled, fade out other sections */
form.dvla-form-disabled .ff-el-group:not(:has(input[name="veh_reg"])) {
    opacity: 0.4;
    pointer-events: none;
}

/* Make sure our buttons stay clickable */
#confirm-reg-btn,
#dvla-confirm-btn,
#dvla-reject-btn {
    pointer-events: auto !important;
    z-index: 1000 !important;
}

/* Validation container buttons should never be disabled */
#dvla-validation-container button {
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Radio button pills - make them larger and easier to click */
.ff-el-form-check {
    display: inline-block !important;
    margin: 5px 5px 5px 0 !important;
}

.ff-el-form-check-label {
    display: flex !important;
    align-items: center !important;
    padding: 12px 20px !important;
    background: #f5f5f5 !important;
    border: 2px solid #ddd !important;
    border-radius: 25px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    min-width: 100px !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

.ff-el-form-check-label:hover {
    background: #e0e0e0 !important;
    border-color: #bbb !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Hide the actual radio input but keep it accessible */
.ff-el-form-check-input {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

/* Selected state */
.ff-el-form-check.ff_item_selected .ff-el-form-check-label,
.ff-el-form-check-label:has(.ff-el-form-check-input:checked) {
    background: #007cba !important;
    border-color: #007cba !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0,124,186,0.3) !important;
}

.ff-el-form-check.ff_item_selected .ff-el-form-check-label:hover,
.ff-el-form-check-label:has(.ff-el-form-check-input:checked):hover {
    background: #005a87 !important;
    border-color: #005a87 !important;
}

/* Selected state with different colors for different values */
.ff-el-form-check:has(input[value="OK"]:checked) .ff-el-form-check-label,
.ff-el-form-check.ff_item_selected:has(input[value="OK"]) .ff-el-form-check-label {
    background: #28a745 !important;
    border-color: #28a745 !important;
}

.ff-el-form-check:has(input[value="Fixed"]:checked) .ff-el-form-check-label,
.ff-el-form-check.ff_item_selected:has(input[value="Fixed"]) .ff-el-form-check-label {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: #fff !important;
}

.ff-el-form-check:has(input[value="Advisory"]:checked) .ff-el-form-check-label,
.ff-el-form-check.ff_item_selected:has(input[value="Advisory"]) .ff-el-form-check-label {
    background: #fd7e14 !important;
    border-color: #fd7e14 !important;
}

/* Not Working state - only when checked */
.ff-el-form-check:has(input[value="Not Working"]:checked) .ff-el-form-check-label,
.ff-el-form-check.ff_item_selected:has(input[value="Not Working"]) .ff-el-form-check-label {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}

/* Responsive - stack on mobile */
@media (max-width: 768px) {
    .ff-el-form-check {
        display: block !important;
        margin: 8px 0 !important;
    }
    
    .ff-el-form-check-label {
        width: 100% !important;
        min-width: auto !important;
    }
}

/* File upload styling - make them stack one per row */
.ff-el-group:has(.ff-uploaded-list),
.ff-el-group:has(.ff_file_upload_holder),
.ff-el-group:has(input[type="file"]) {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    clear: both !important;
}

/* Force file upload containers to be full width and stack vertically */
.ff_file_upload_holder,
.ff-uploaded-list,
.file-upload-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/* Stack file upload items vertically */
.ff-uploaded-list .ff-uploaded-item,
.file-upload-preview {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    margin-bottom: 10px !important;
    padding: 10px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    background: #f9f9f9 !important;
}

/* Hide file details (name, progress bar, size, completion text) */
.ff-uploaded-item .ff-uploaded-file-info,
.ff-uploaded-item .ff-upload-progress,
.ff-uploaded-item .ff-file-size,
.ff-uploaded-item .ff-file-status,
.file-upload-preview .file-name,
.file-upload-preview .file-size,
.file-upload-preview .upload-progress,
.ff_file_upload_holder .upload-progress,
.ff_file_upload_holder .file-info,
[data-file-size],
[data-progress],
.progress-bar-container,
.file-meta,
.upload-status,
.file-upload-preview span:not(.ff-uploaded-image) {
    display: none !important;
}

/* Show only the thumbnail image */
.ff-uploaded-item .ff-uploaded-image,
.ff-uploaded-item img,
.file-upload-preview img,
.ff_file_upload_holder img {
    display: block !important;
    max-width: 150px !important;
    max-height: 150px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Keep the delete/remove button visible */
.ff-uploaded-item .ff-delete-uploaded,
.ff-uploaded-item .ff-remove-file,
.file-upload-preview .remove-file,
.ff_file_upload_holder .delete-btn {
    display: inline-flex !important;
    margin-left: auto !important;
    padding: 5px 10px !important;
    background: #dc3545 !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
}

/* File upload input wrapper */
.ff_file_upload_holder .ff_file_upload_input_wrapper,
.file-upload-input-wrapper {
    width: 100% !important;
    margin-bottom: 15px !important;
}

/* Make the "Choose File" button more prominent */
.ff_file_upload_holder .ff_file_upload_input_wrapper button,
.file-upload-input-wrapper button,
input[type="file"]::-webkit-file-upload-button {
    padding: 12px 24px !important;
    background: #007cba !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
}

/* Ensure each file upload section takes full width */
.ff-t-cell:has(.ff_file_upload_holder),
.ff-t-cell:has(.ff-uploaded-list),
.ff-t-cell:has(input[type="file"]) {
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Override any grid layouts for file uploads */
.ff-t-container:has(.ff_file_upload_holder),
.ff-t-container:has(.ff-uploaded-list) {
    display: block !important;
}

.ff-t-container:has(.ff_file_upload_holder) .ff-t-cell,
.ff-t-container:has(.ff-uploaded-list) .ff-t-cell {
    display: block !important;
    width: 100% !important;
    flex-basis: 100% !important;
    margin-bottom: 20px !important;
}
